File types · Explainer

The DOCX file (.docx)

A DOCX file is a Microsoft Word document: a ZIP package of XML files holding the text, formatting, images and settings. This guide explains what's inside one, how it differs from DOC and PDF, the quirks worth knowing, and has free sample DOCX files to download for testing.

At a glance

Full name
Office Open XML word-processing document (WordprocessingML)
Extensions
.docx
MIME type
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Kind
Binary: a ZIP package of XML files and media
Standard
ECMA-376 and ISO/IEC 29500; created by Microsoft
First released
2006 as ECMA-376; Word's default format since Word 2007
Opens with
Microsoft Word, LibreOffice Writer, Google Docs, Apple Pages
Magic number
50 4B 03 04, the ZIP signature; a word/document.xml part inside marks it as Word
Macros
Not allowed; macro-enabled documents use .docm

The basics

What is a DOCX file?

DOCX is the file format Microsoft Word saves documents in. It replaced the older binary .doc format as Word's default in Word 2007, and it's an open standard (ECMA-376, then ISO/IEC 29500), so LibreOffice, Google Docs, Apple Pages and many other programs read and write it too.

A DOCX is made for editing: text reflows as you type, styles define headings and lists, and changes can be tracked and commented on. That's the main difference from a PDF, which fixes the layout of finished pages. CVs, letters, reports, contracts in negotiation and templates are usually DOCX files.

  • It's a package, not one file. Text, styles, images, comments and settings are separate parts inside a ZIP archive.
  • It's XML. The parts are readable text, so programs can create and change Word documents without Word.
  • Its layout is not fixed. Line and page breaks are worked out by whichever app opens the file, using the fonts that app has. The same DOCX can paginate differently in Word, LibreOffice and Google Docs.

Anatomy

What's inside a DOCX file

Rename a .docx to .zip and you can open it like any archive. Inside are XML files, called parts, that point to each other. Our sample-minimal.docx has only the three parts a document needs; here they are, part by part.

sample-minimal.docx (file list and XML)
$ unzip -l sample-minimal.docx
  Length      Date    Time    Name
---------  ---------- -----   ----
      441  2026-10-27 12:00   [Content_Types].xml
      303  2026-10-27 12:00   _rels/.rels
      565  2026-10-27 12:00   word/document.xml

First 4 bytes: 50 4b 03 04  (PK..)

word/document.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
  <w:body>
    <w:p>
      <w:r>
        <w:rPr><w:b/></w:rPr>
        <w:t>Hello, world.</w:t>
      </w:r>
    </w:p>
    <w:p>
      <w:r>
        <w:t xml:space="preserve">Sample DOCX from 99helpers.com/file-types/docx</w:t>
      </w:r>
    </w:p>
    <w:sectPr>
      <w:pgSz w:w="11906" w:h="16838"/>
      <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"/>
    </w:sectPr>
  </w:body>
</w:document>
  1. 150 4b 03 04

    The ZIP signature

    "PK", after Phil Katz, who created the ZIP format. Every DOCX starts with these bytes, which is why tools that only check the first bytes report it as a ZIP file.

  2. 2[Content_Types].xml

    The content types

    Says what kind of data each part holds, by file extension or by part name. Without it, Word refuses to open the package.

  3. 3_rels/.rels

    The package relationships

    The entry point. It points to word/document.xml as the main document, and in a full file also to the properties in docProps/.

  4. 4word/document.xml

    The main document part

    The text itself, in order. It's the only part a valid document strictly needs.

  5. 5<w:document xmlns:w="…/wordprocessingml/2006/main">

    The root element

    Declares the WordprocessingML namespace. The w: prefix on every element comes from here.

  6. 6<w:body>

    The body

    Holds the block-level content: paragraphs and tables, one after another.

  7. 7<w:p>

    A paragraph

    Every paragraph, heading and list item is a w:p. Headings are paragraphs with a heading style; list items are paragraphs with numbering.

  8. 8<w:r> <w:rPr><w:b/></w:rPr>

    A run

    A stretch of text with the same formatting, here bold. A paragraph with a bold word in the middle has three runs. Editing can split a word across several runs, which is why find-and-replace in DOCX code often misses text.

  9. 9<w:t xml:space="preserve">

    The text

    The characters themselves. xml:space="preserve" keeps spaces at the start or end, which XML would otherwise ignore.

  10. 10<w:pgSz w:w="11906" w:h="16838"/>

    Section properties

    Page size and margins, in twentieths of a point: 11906 × 16838 is A4, and 1440 is one inch. A document has one w:sectPr per section.

  11. 11(no styles.xml, no docProps)

    What's missing

    Real files also carry styles, fonts, a theme, settings, numbering, document properties and media. When they're absent, Word uses its defaults.

Under the hood

The parts of a typical DOCX

A document saved by Word, or our sample-document.docx, has more parts than the minimal file above. The usual ones:

PartWhat it holds
[Content_Types].xmlThe type of every part.
_rels/.relsLinks from the package to the main document and the properties.
docProps/core.xmlTitle, author, last modified by, created and modified dates.
docProps/app.xmlThe app that saved it, page and word counts, company.
word/document.xmlThe text, tables and their direct formatting.
word/_rels/document.xml.relsEverything the text points to: styles, images, headers, hyperlink addresses.
word/styles.xmlParagraph, character and table styles, such as Normal and Heading 1.
word/numbering.xmlHow bulleted and numbered lists are numbered and indented.
word/settings.xmlDocument settings, such as whether changes are being tracked.
word/header1.xml, word/footer1.xmlHeaders and footers, one part each.
word/comments.xmlComments, with author and date.
word/media/Images and other embedded files, in their original formats.
word/theme/theme1.xml, word/fontTable.xmlTheme colours and fonts, and the fonts the document uses.

Getting at the content without Word

Copy the file, change .docx to .zip and open it: the images are in word/media/ at full size, and the text is in word/document.xml. In code, libraries such as python-docx (Python), docx4j (Java) and the Open XML SDK (.NET) read and write the parts for you.

Versions

Versions: DOC, DOCX, Strict and the macro formats

The format was published by Ecma International as ECMA-376 in 2006 and approved as ISO/IEC 29500 in 2008; later editions mostly clarified and corrected it. The ISO standard has two flavours:

  • Transitional, which allows legacy features for old documents. It's what Word, LibreOffice and Google Docs save by default.
  • Strict, without those legacy features. Word can save it ("Strict Open XML Document"), but few other tools write it, and some older readers can't open it.
ExtensionWhat it is
.docxWord document. Can't contain macros.
.docmWord document with macros (VBA). Same structure plus a vbaProject.bin part.
.dotxWord template without macros: double-clicking it starts a new document based on it.
.dotmWord template with macros.
.docThe binary format used by Word 97 to 2003. Still opens, in Compatibility Mode.
.odtOpenDocument Text, LibreOffice's own format, also an ISO standard.

When Word opens an older document, its title bar may say Compatibility Mode: Word is imitating the layout rules of the older version so the pages don't move. File, Info, Convert updates the document to the current rules.

Comparison

DOCX vs DOC, PDF, ODT and RTF

DOCXDOCPDFODTRTF
StructureZIP of XMLBinaryBinary objects and streamsZIP of XMLText with control words
Made forEditingEditingFinal, fixed pagesEditingExchange between word processors
Open standardYes (ISO/IEC 29500)Documented, not a standardYes (ISO 32000)Yes (ISO/IEC 26300)Documented by Microsoft
Opens in a browserNo, it downloadsNoYesNoNo
MacrosNoYesNo (but JavaScript)YesNo
SizeSmall: compressedLargerDepends on fonts and imagesSmall: compressedLarge for images

In practice: edit and collaborate in DOCX (or ODT), and send the final version as PDF when the layout must not change or the reader might not have a word processor. Convert old .doc files to DOCX when you edit them.

Troubleshooting

Common DOCX problems and how to fix them

  • The layout changed on another computer. Fonts aren't normally embedded, so the other computer substituted different ones, and line and page breaks moved. Use common fonts, embed them (Word: File, Options, Save, "Embed fonts in the file"), or send a PDF.
  • It looks different in Google Docs or LibreOffice. Each app has its own layout engine and supports Word features to a different degree. Text boxes, complex tables and fields suffer most.
  • "Word found unreadable content". The package is damaged, often by an interrupted download or a tool that wrote invalid XML. Let Word recover what it can; if it can't, rename to .zip and copy the text out of word/document.xml.
  • The file is huge. Almost always images, stored at full resolution. In Word, select an image, choose Compress Pictures and apply it to all images.
  • My computer calls it a ZIP file. Some tools only look at the first bytes, which are a ZIP signature. Check the extension is .docx, and that the server sends the DOCX MIME type, not application/zip.
  • Comments or tracked changes print or show up for others. They are part of the file until you accept or reject every change and delete the comments (Review tab).
  • A yellow "Protected View" bar. Word opens files from the internet and email attachments read-only until you choose Enable Editing. It's a safety feature, not an error.

How to

How to open, edit and convert a DOCX file

  • Microsoft Word on Windows and Mac, Word for the web (free with a Microsoft account) and the Word apps for iPhone, iPad and Android.
  • Without Word: LibreOffice Writer (free, Windows, Mac, Linux), Google Docs (upload to Google Drive; it can edit the DOCX directly or convert it), and Apple Pages on Mac, iPhone and iPad, which opens DOCX and exports to it.
  • In a browser: browsers can't display DOCX files, so a link to one downloads it. To have a document read in the browser, save it as PDF.
  • Convert to PDF: in Word, File, Save As (or Export), PDF. On a server: soffice --headless --convert-to pdf report.docx.
  • Convert to Markdown, HTML or text: pandoc report.docx -o report.md. Headings, lists, tables and links come across; layout doesn't.
  • Convert old .doc files: open them in Word and save as Word Document (.docx), or soffice --headless --convert-to docx old.doc.

Security

Is it safe to open a DOCX? And what does it reveal?

A .docx can't hold macros: Word strips them when you save in this format, and macro-enabled documents must be .docm. Office on Windows has also blocked macros in files from the internet by default since 2022. But a DOCX can still be used in attacks:

  • Remote templates. A DOCX can name a template on a web server, which Word fetches when the file opens. Attackers use this to pull in a macro-enabled template from outside.
  • Links and embedded objects. External links, embedded OLE objects and fields can fetch content or start other programs. In 2022 the "Follina" flaw (CVE-2022-30190) let a Word document start a Windows diagnostic tool and run code; it was fixed in Windows updates that June.
  • Phishing. A document that asks you to click Enable Editing or Enable Content, or to follow a link to sign in, is the most common trick of all.

DOCX files also carry more than you see:

  • Author names in the document properties, comments and tracked changes.
  • Deleted text that is still tracked: our sample-tracked-changes.docx keeps the deleted word "Tuesday" inside.
  • Hidden text, comments and the original, uncropped versions of cropped images.

Before sending a document outside your organisation, accept or reject all changes, delete comments and run Word's Document Inspector (File, Info, Check for Issues, Inspect Document), or send a PDF instead.

Free downloads

Sample DOCX files to download

Free sample Word documents for testing converters, previews, parsers and uploads. Each one is a valid ZIP package with well-formed XML, opens with python-docx and converts with LibreOffice.

sample-document.docx · 38.2 KBDownload

Browsers can't show this kind of file in a page. Download it to open it in the app it belongs to.

What's inside sample-document.docx

Open it in Word, LibreOffice or Google Docs to see the features below, or rename a copy to .zip to find the parts each one lives in. Browsers can't preview DOCX, so there's no live preview here.

  1. Document properties

    Title, author, subject, keywords, a comment and dates in docProps/core.xml, shown in Word under File, Info.

  2. Styles

    Title, Heading 1, List Bullet, List Number, Quote and Caption, all from word/styles.xml. The headings appear in Word's navigation pane.

  3. Runs of formatting

    One sentence with bold, italic, underline, colour, highlighting, subscript and superscript: each a separate run in word/document.xml.

  4. Lists and a table

    Bulleted and numbered lists defined in word/numbering.xml, and a five-row table with a built-in table style.

  5. An image

    A PNG chart stored as word/media/image1.png, placed inline with a caption.

  6. A hyperlink

    The link text is in the document; its address sits in word/_rels/document.xml.rels with TargetMode="External".

  7. Header, footer and fields

    A header line and a footer with PAGE and NUMPAGES fields that show "Page 1 of 2".

  8. A comment

    From the fictional reviewer Ada Example, stored in word/comments.xml and anchored to a paragraph.

All sample DOCX files

  • Two-page sample document

    sample-document.docx · 38.2 KB (39,120 bytes)

    A realistic A4 document: properties, headings, formatted runs, lists, a table, an image with a caption, a hyperlink, a header, a footer with page fields and a comment.

    • Testing converters and previews
    • Checking parsers against a typical Word file
  • Minimal DOCX, three parts

    sample-minimal.docx · 1.0 KB (1,066 bytes)

    Only [Content_Types].xml, _rels/.rels and word/document.xml, written by hand: no styles, no properties. It's the file shown in the anatomy above.

    • Parser tests: don't assume optional parts exist
    • Learning the package structure
  • Tracked changes and comments

    sample-tracked-changes.docx · 35.2 KB (36,056 bytes)

    A deletion, an insertion and a comment by the fictional author Ada Example, with Track Changes switched on.

    • Testing how tools handle revisions
    • Privacy and metadata-cleaning checks
  • 100 KB DOCX file

    sample-100kb.docx · 100 KB (102,400 bytes)

    Headings, text and a photo-like JPEG, padded to exactly 102,400 bytes with whitespace in a custom XML part.

    • Upload and size-limit tests
    • Converter tests
  • 1 MB DOCX file

    sample-1mb.docx · 1 MB (1,048,576 bytes)

    A short document with a 2000 × 1300 pixel JPEG, padded the same way to exactly 1,048,576 bytes (1 MiB).

    • Upload limits and timeouts
    • Image extraction and compression

Ways to test with them

  • Upload limits: the 100 KB and 1 MB files have exact sizes, so you can test a limit at the boundary.
  • File type detection: all five start with the ZIP signature 50 4B 03 04. A detector that reports application/zip instead of the DOCX type isn't looking inside the package.
  • Text extraction: in sample-tracked-changes.docx, decide what your extractor should output: the deleted "Tuesday", the inserted "Thursday" or both. Some libraries skip both: python-docx's paragraph.text returns the sentence with no day in it.
  • Conversion fidelity: convert sample-document.docx to PDF and check the header, the page numbers, the table style, the image and the comment.
  • Defensive parsing: sample-minimal.docx has no styles, settings or properties. Code that assumes they exist will fail on it.

Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.

Put it online

Have a DOCX file? Give it a link.

Drop a Word document on 99helpers and it gets its own link. Browsers can't display DOCX files, so visitors download it and open it in Word, Google Docs or another word processor; to have it read in the browser, upload a PDF version.

Questions

DOCX files, frequently asked

What is a DOCX file?

A Microsoft Word document in the Office Open XML format, Word's default since 2007. It's a ZIP package of XML files holding the text, formatting and images.

What's the difference between DOC and DOCX?

DOC is the older binary format used up to Word 2003. DOCX is XML in a ZIP, smaller, an open standard, and can't contain macros. Current Word versions open both, but save DOCX by default.

How do I open a DOCX file without Word?

Use LibreOffice Writer (free), Google Docs (upload it to Google Drive), Apple Pages on a Mac or iPhone, or Word for the web, which is free with a Microsoft account.

How do I convert a DOCX to PDF?

In Word, choose File, Save As and pick PDF. Google Docs and LibreOffice can export PDF too, and soffice --headless --convert-to pdf file.docx does it on a server.

Why does my document look different on another computer?

Fonts aren't usually embedded in a DOCX, so the other computer substitutes its own and the lines and pages break differently. Embed the fonts, stick to common ones, or send a PDF.

Is a DOCX file really a ZIP file?

Yes. Rename a copy to .zip and you can open it: the text is in word/document.xml and the images in word/media/.

Can a DOCX file contain a virus?

It can't contain macros, but it can load remote templates, contain links and embedded objects, or exploit bugs in Word. Keep Office updated, leave Protected View on for files you didn't expect, and don't enable content because a document tells you to.

How do I remove personal information from a Word document?

Accept or reject all tracked changes, delete comments, then run the Document Inspector (File, Info, Check for Issues, Inspect Document) to remove properties, hidden text and other personal data.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.