iLoveConverter
Categories 11 categories

The DOCX (.docx) Format, Explained

iLoveConverter Team 3 min read

On this page

DOCX replaced the proprietary .doc binary format in Word 2007 and has been the standard ever since. Technically a DOCX is a ZIP archive containing XML files. This ZIP-inside trick means any tool that can read ZIP can peek at a DOCX, and any XML parser can understand it — a huge improvement over the opaque .doc format that came before.

What’s inside a DOCX

Unzip any .docx and you see:

[Content_Types].xml        # MIME types for every file inside
_rels/
    .rels                  # relationships (what files point to what)
word/
    document.xml           # THE main document content
    styles.xml             # paragraph and character styles
    settings.xml           # document settings (page size, margins)
    theme/
        theme1.xml         # colors, fonts, effects for the theme
    media/                 # embedded images (PNG, JPEG, EMF)
    fontTable.xml          # fonts used in the document
    notes.xml              # footnotes and endnotes
    comments.xml           # reviewer comments (Track Changes)
    numbering.xml          # bullet and numbering definitions

The main document content lives in word/document.xml, which uses the WordprocessingML namespace (http://schemas.openxmlformats.org/wordprocessingml/2006/main).

Paragraphs and runs

DOCX splits content into paragraphs (<w:p>) and runs (<w:r>). A paragraph is a line of text with its own style (heading, normal, list item). A run is a fragment of text within that paragraph sharing the same formatting (bold, italic, font, size). So “Hello world” is one paragraph with two runs — “Hello ” (normal) and “world” (bold).

Styles

Styles define reusable formatting. A paragraph style sets font, size, line spacing, indentation, and more. Character styles set font, bold, italic, etc., but inherit paragraph-level properties. The theme adds a color scheme and font scheme (major/minor fonts for East Asian, Latin, and Complex Scripts).

Tables and images

Tables use <w:tbl>, <w:tr> (rows), and <w:tc> (cells). Cell borders, shading, and row spanning are all explicit XML attributes and children. Images are stored in word/media/ and referenced in document.xml via <wp:inline> or <wp:anchor> elements pointing to image1.png, etc.

OOXML and compatibility

DOCX is part of OOXML (Office Open XML), the ECMA-376 standard. Word, LibreOffice Writer, Google Docs, and Apple Pages all support DOCX, but each implements a slightly different subset. Word-specific features (content controls, certain shape effects, SmartArt) do not always survive round-trips to LibreOffice or Docs.

Converting DOCX

# LibreOffice headless (best open-source converter):
libreoffice --headless --convert-to pdf input.docx
libreoffice --headless --convert-to txt input.docx

# Pandoc (great for Markdown ↔ DOCX):
pandoc input.md -o output.docx
pandoc input.docx -o output.md

# python-docx for programmatic manipulation:
python3 -c "import docx; d = docx.Document('input.docx'); print([p.text for p in d.paragraphs])"

Common problems

  • Track Changes lost — some converters accept tracked changes as final; re-export with “Accept All Changes” or use a tool that preserves the Revision data.
  • Images missing or blank — the ZIP may have corrupted media entries; re-extract with a ZIP tool or check if the DOCX itself is damaged.
  • Cross-reference errors — after round-tripping through non-Word tools, fields like TOC, page numbers, and formula references may break.
  • Encoding issues — DOCX is UTF-8; old .doc was often Windows-1252. If content shows mojibake, check whether a converter treated DOCX as .doc.

FAQ

Is DOCX lossless?

When opened in a DOCX-capable tool and saved again, yes. But converting to PDF, HTML, or TXT loses DOCX-specific features (track changes, content controls, comments).

DOCX vs DOC — which should I use?

DOCX. .doc is the legacy binary format, unsupported in modern tools, and prone to corruption. Save as DOCX always.

What is the difference between DOCX and ODT?

Both are open XML-based formats. DOCX is OOXML (Microsoft), ODT is ODF (LibreOffice/Apache). They are similar in spirit but use different XML namespaces and sometimes different behavior for the same feature. Most modern tools read both.

Can DOCX contain macros?

Yes. A DOCM is a DOCX with macros (.docm extension). Regular .docx cannot contain macros — Word will warn if you try to save one.

Try it yourself — free, right in your browser

Everything mentioned in this guide runs locally on this site: no upload, no watermark, no sign-up.

Format deep-dives: DOCX (.docx) , PDF (.pdf) , TXT (.txt) , HTML (.html.htm) , ODT (.odt)