File types · Explainer

The DOC file (.doc)

A DOC file is a Microsoft Word document in the binary format that Word 97 to 2003 saved by default. This guide explains what's inside one, how it differs from DOCX, the quirks and risks worth knowing, and has free sample DOC files to download for testing.

At a glance

Full name
Word 97-2003 Document (Word Binary File Format)
Extensions
.doc; templates use .dot
MIME type
application/msword
Kind
Binary: records stored as streams inside an OLE2 compound file
Owner
Microsoft; documented in the [MS-DOC] open specification, not a formal standard
First released
1997, with Word 97; Word's default format until Word 2007
Opens with
Microsoft Word, LibreOffice Writer, Google Docs, Apple Pages
Magic number
D0 CF 11 E0 A1 B1 1A E1 (any OLE2 file); a WordDocument stream starting EC A5 marks it as Word
Macros
Allowed: VBA projects are stored in a Macros storage inside the file
Encryption
Optional password: XOR obfuscation, 40-bit RC4 or RC4 CryptoAPI

The basics

What is a DOC file?

DOC is the binary file format of Microsoft Word 97, 2000, 2002 (XP) and 2003. Those versions saved every document as a .doc file, so for about ten years it was the way documents travelled: by email, on floppy disks and USB sticks, on intranets. Word 2007 replaced it with DOCX as the default, but every current word processor still opens DOC files, and some older systems still produce them.

The extension is older than the format. Word for DOS and the first versions of Word for Windows also used .doc, with different binary formats, and so did Word 6.0 and Word 95. Other programs used it too, for plain text. A .doc file today is almost always the Word 97-2003 kind, but not quite always.

  • It's binary. Open it in a text editor and you'll see the text scattered among unreadable bytes.
  • It's a container. Text, formatting, pictures, embedded objects and macros are separate streams inside one compound file.
  • It can contain macros. Unlike .docx, the same .doc extension is used with or without VBA code, which is why DOC attachments were the classic carrier of macro viruses.

Anatomy

What's inside a DOC file

A DOC file is a small file system packed into one file: a 512-byte header, then sectors that hold named streams, like files in a folder. This is our sample-minimal.doc, two short paragraphs saved by LibreOffice, part by part.

sample-minimal.doc (hex and structure)
$ xxd -l 80 sample-minimal.doc      (first 80 of the 512 header bytes)
00000000: d0cf 11e0 a1b1 1ae1 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 3b00 0300 feff 0900  ........;.......
00000020: 0600 0000 0000 0000 0000 0000 0100 0000  ................
00000030: 2100 0000 0000 0000 0010 0000 0200 0000  !...............
00000040: 0100 0000 feff ffff 0000 0000 0000 0000  ................

Directory (file size 18,432 bytes = 36 sectors of 512)
Root Entry         storage, class 00020906-…-000000000046
  WordDocument                     3,645 bytes
  1Table                          10,483 bytes
  \x05SummaryInformation              456 bytes
  \x05DocumentSummaryInformation      240 bytes
  \x01CompObj                         106 bytes
  \x01Ole                              20 bytes

WordDocument stream, first 16 bytes (start of the FIB):
ec a5 01 01 4d 20 09 04 00 00 f0 12 bf 00 00 00
  1. 1d0cf 11e0 a1b1 1ae1

    The OLE2 signature

    The first 8 bytes of every Compound File Binary file: old Word, Excel and PowerPoint files, Outlook .msg files, Windows Thumbs.db, MSI installers. So these bytes say "compound file", not "Word".

  2. 23b00 0300

    Version numbers

    Minor version 0x003B and major version 3. Version 3 means 512-byte sectors; version 4 uses 4,096. The spec asks writers to put 0x003E in the minor version, and LibreOffice writes 0x003B; readers don't depend on it.

  3. 3feff 0900 0600

    Byte order and sector sizes

    FE FF marks little-endian numbers. Sector shift 9 means sectors of 2⁹ = 512 bytes, and mini sector shift 6 means mini sectors of 2⁶ = 64 bytes.

  4. 40100 0000 · 2100 0000

    FAT and directory

    At offset 0x2C, the number of FAT sectors (1). The FAT is the chain table that says which sector follows which. At 0x30, the directory starts in sector 33, at byte (33 + 1) × 512 = 0x4400.

  5. 50010 0000

    The mini stream cutoff

    4,096. Streams smaller than this are stored in 64-byte pieces inside a separate mini stream, so small streams don't each waste a whole sector. Here everything except 1Table is small enough.

  6. 6feff ffff

    No extra DIFAT sectors

    FFFFFFFE means "end of chain". The header itself lists the first 109 FAT sectors from offset 0x4C; only files above roughly 7 MB need more.

  7. 7Root Entry … 00020906-…

    The root storage

    Its class ID, {00020906-0000-0000-C000-000000000046}, is the one registered for Word 97-2003 documents. The root entry also owns the mini stream.

  8. 8WordDocument

    The main stream

    Starts with the File Information Block (FIB), which holds the offsets and sizes of everything else, followed by the document's text.

  9. 91Table

    The table stream

    Styles, fonts, lists, the piece table that maps text positions to bytes, and much more. It's called 1Table or 0Table, and a bit in the FIB says which one to use.

  10. 10\x05SummaryInformation

    Document properties

    Title, subject, author, keywords and dates, in a format shared by all Office binary files. The first character of the name is byte 0x05, which is why it often shows up as ♣SummaryInformation.

  11. 11ec a5

    wIdent

    0xA5EC, little-endian: the identifier [MS-DOC] requires at the start of every Word binary file.

  12. 1201 01 · 09 04

    nFib and language

    nFib is the format version. The spec says it should be 0x00C1, Word 97's number, with later versions recorded further on; LibreOffice writes 0x0101, the Word 2002 number. 0x0409 is the language of the app that saved it: English (US).

Under the hood

How a DOC file is put together

A DOC file is a Compound File Binary file, also called OLE2 or structured storage: a FAT-style file system inside one file, with storages (folders) and streams (files). The Word data sits in a few streams:

Stream or storageWhat it holds
WordDocumentThe File Information Block (FIB), then the text of the main document, footnotes, headers and comments, one after another.
1Table or 0TableStyles, fonts, lists, fields, bookmarks, comments' authors, and the piece table that says where each stretch of text is.
DataPictures and some other binary data. Our sample-document.doc has one; the minimal file doesn't need it.
ObjectPoolA storage holding embedded objects, such as an Excel chart pasted into the document.
MacrosA storage holding the VBA project, when the document has macros.
\x05SummaryInformation, \x05DocumentSummaryInformationDocument properties: title, author, company, dates, revision number, page and word counts.
  • Text and formatting are kept apart. The text is a long sequence of characters. Character and paragraph formatting live in 512-byte formatted disk pages (FKPs) that say "characters 120 to 135 are bold".
  • Text is Unicode where it needs to be. Since Word 97, each piece of text is stored either as 8-bit characters or as 16-bit Unicode, so any language survives.
  • Pictures are anchored by a special character in the text that points into the Data stream.
  • Saves could be incremental. With "Allow fast saves" switched on, Word 97 to 2003 appended changes to the end of the file instead of rewriting it. A flag in the FIB, fComplex, records that the last save was incremental. Text you had deleted could stay inside the file until the next full save.

Reading it without Word

Python's olefile lists and extracts the streams; LibreOffice, Apache POI (HWPF, Java), antiword and catdoc extract the text. The format is documented in Microsoft's [MS-DOC] and [MS-CFB] open specifications, several hundred pages between them.

Versions

Word 6.0/95, Word 97-2003 and Compatibility Mode

Word versionFile formatNotes
Word for DOS, Word for Windows 1.x and 2.0Older binary formatsNot compound files. Support in current software is patchy.
Word 6.0 (1993) and Word 95Word 6.0/95 binaryAlready an OLE2 compound file with a WordDocument stream, but text is stored in an 8-bit code page, not Unicode.
Word 97, 2000, 2002, 2003Word 97-2003 binary ([MS-DOC])The format on this page. Unicode text. Later versions added data at the end of the FIB without breaking older readers.
Word 2007 and laterDOCX by defaultStill opens and saves .doc, as "Word 97-2003 Document".

When a current version of Word opens a .doc, the title bar shows Compatibility Mode. Word turns off features the old format can't store and keeps the old layout rules, so lines and pages break as they did. File, Info, Convert turns the document into a DOCX and switches to the current rules.

Saving a newer document as .doc loses things. Before saving, Word's Compatibility Checker (File, Info, Check for Issues, Check Compatibility) lists them. According to Microsoft:

  • Equations become pictures, and SmartArt becomes a single object you can't edit.
  • Content controls, citations and bibliographies become static text.
  • Tracked moves become separate deletions and insertions.
  • Text effects are removed and WordArt becomes plain text.

Comparison

DOC vs DOCX, RTF, ODT and PDF

DOCDOCXRTFODTPDF
StructureBinary records in an OLE2 fileZIP of XMLText with control wordsZIP of XMLBinary objects and streams
Open standardDocumented, not a standardYes (ISO/IEC 29500)Documented by MicrosoftYes (ISO/IEC 26300)Yes (ISO 32000)
MacrosYes, same extensionNo (.docm instead)NoYesNo (but JavaScript)
SizeLarger, not compressedSmall: compressedLarge for imagesSmall: compressedDepends on fonts and images
Opens in a browserNo, it downloadsNoNoNoYes
Readable with simple toolsHard: needs a format libraryYes, unzip and read XMLYes, it's textYes, unzip and read XMLNeeds a PDF library

There's little reason to create new DOC files. Use DOCX for editing and PDF for the final version. Keep DOC only when something at the other end, an old system or an old version of Word, can't handle anything else.

Troubleshooting

Common DOC problems and how to fix them

  • "[Compatibility Mode]" in the title bar. Not an error: the file is in the old format. Choose File, Info, Convert if you want the current features and don't need to send it back to someone on Word 2003.
  • Features greyed out. Compatibility Mode switches off what DOC can't store, such as newer equations, content controls and text effects. Convert the document to enable them.
  • Word says the file type is blocked. Office's Trust Center can block old file formats (File, Options, Trust Center, File Block Settings), often by company policy. LibreOffice opens many of them.
  • "The file is corrupt and cannot be opened." Damage to the compound file's FAT or directory hides streams that are still there. Word's Open and Repair, LibreOffice, or extracting the WordDocument stream with a tool such as olefile can recover the text.
  • Renaming it to .docx doesn't work. The two formats are completely different inside. Open it and use Save As, or convert it with LibreOffice.

How to

How to open, edit and convert a DOC file

  • Microsoft Word on Windows and Mac opens DOC files in Compatibility Mode. Word for the web and the mobile apps open them too; Word for the web converts a DOC to DOCX before you can edit it.
  • Without Word: LibreOffice Writer (free, Windows, Mac, Linux) opens and saves DOC. Google Docs opens a DOC uploaded to Google Drive, and Apple Pages imports it.
  • In a browser: browsers can't display DOC files, so a link to one downloads it.
  • Convert to DOCX: in Word, File, Info, Convert, or Save As, Word Document. On a server: soffice --headless --convert-to docx old.doc.
  • Convert to PDF: in Word, File, Save As, PDF; or soffice --headless --convert-to pdf old.doc.
  • Extract the text only: antiword file.doc or catdoc file.doc on Linux and macOS, or LibreOffice's --convert-to txt.

Security

Is it safe to open a DOC file?

Be more careful with DOC files than with DOCX. A .doc can contain VBA macros without any sign in its name, and Word documents with macros were the most common email malware for years, from the Concept virus in 1995 and Melissa in 1999 to the malware loaders of the 2010s.

  • Macros. Code in a Macros storage runs once you click Enable Content; an AutoOpen macro then runs as soon as the document opens. Since 2022, Office on Windows blocks macros in files that came from the internet and shows a Security Risk banner with no Enable button.
  • Embedded objects and links. OLE objects in the ObjectPool and fields can start other programs or fetch remote content. Old components such as the Equation Editor have had exploitable bugs.
  • Parser bugs. The binary format is complex, and Word's old DOC parser has had security fixes over the years. Keep Office updated and leave Protected View on for files from outside.

DOC files also leak information:

  • Properties and revision history. Author, company and the names of people who saved it, in the summary streams and the table stream.
  • Deleted text. After a fast save, text you deleted could stay inside the file. Tracked changes and comments travel with it too: our sample-tracked-changes.doc still contains the deleted word "Tuesday".
  • Weak passwords. The original RC4 encryption of Word 97-2003 uses a 40-bit key, which can be broken by brute force whatever the password. The document properties may not be encrypted at all: in sample-password.doc, the title and author can be read without the password.

Don't enable macros or editing in a DOC you didn't expect. To protect a document properly, save it as DOCX, whose AES-based encryption is much stronger, or share a PDF.

Free downloads

Sample DOC files to download

Free sample Word 97-2003 documents for testing converters, previews, parsers and upload filters. LibreOffice wrote each one from a DOCX made with python-docx; all were checked with olefile and by converting them back with LibreOffice. None contains macros.

sample-document.doc · 29.5 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.doc

Browsers can't preview DOC files, so download it and open it in Word, LibreOffice, Google Docs or Pages. These are the parts to look for, and where they live inside the file.

  1. Document properties

    Title, subject, author, keywords and a comment in the \x05SummaryInformation stream, shown in Word under File, Info.

  2. Headings and styles

    Title, Heading 1, List Bullet, List Number, Quote and Caption, defined in the style sheet in the 1Table stream.

  3. Character formatting

    Bold, italic, underline, colour, highlighting, subscript and superscript in one sentence, and a line of Greek, Cyrillic and Chinese text stored as Unicode.

  4. Lists and a table

    A bulleted and a numbered list, and a five-row table comparing DOC with DOCX, RTF and ODT.

  5. A picture

    A PNG bar chart on page 2, stored in the Data stream, with a caption below it.

  6. A hyperlink and fields

    A link to this page, which is a HYPERLINK field in DOC, and PAGE and NUMPAGES fields in the footer.

  7. Header, footer and a comment

    A header line on every page and a comment by the fictional reviewer Ada Example.

All sample DOC files

  • Two-page sample document

    sample-document.doc · 29.5 KB (30,208 bytes)

    A realistic A4 document: properties, headings, formatted text, lists, a table, a picture with a caption, a hyperlink, a header, page-number fields and a comment.

    • Testing converters and previews
    • Checking a parser against a typical Word 97-2003 file
  • Minimal DOC

    sample-minimal.doc · 18 KB (18,432 bytes)

    Two short paragraphs, the file shown in the anatomy above. Even this has a 10 KB table stream: styles, fonts and settings are always written.

    • Learning the compound file structure
    • Smoke tests for DOC readers
  • Tracked changes and a comment

    sample-tracked-changes.doc · 19.5 KB (19,968 bytes)

    A deletion ("Tuesday"), an insertion ("Thursday") and a comment, all by the fictional author Ada Example.

    • Testing how text extractors handle revisions
    • Metadata-cleaning and privacy checks
  • Password-protected DOC (password: 99helpers)

    sample-password.doc · 19 KB (19,456 bytes)

    Encrypted with 40-bit RC4, the scheme LibreOffice writes for Word 97-2003. The password is 99helpers. The text is encrypted; the title and author in the document properties are not.

    • Testing how upload scanners and converters treat encrypted files
    • Checking password prompts
  • 1 MB DOC file

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

    A short document with a 2400 × 1500 JPEG photo and a filler paragraph whose length sets the size to exactly 1,048,576 bytes (1 MiB).

    • Upload limits and timeouts
    • Image extraction from the Data stream

Ways to test with them

  • File type detection: all five start with D0 CF 11 E0 A1 B1 1A E1, like XLS and PPT files. A detector should look for the WordDocument stream before calling it a Word document.
  • Encrypted files: sample-password.doc has the encryption flag set in its FIB. A converter should ask for the password or fail with a clear message, not produce an empty document; with 99helpers it should show the text.
  • Text extraction: in sample-tracked-changes.doc, decide whether your tool should output the deleted "Tuesday", the inserted "Thursday" or both.
  • Conversion fidelity: convert sample-document.doc to DOCX or PDF and check the header, the page numbers, the table, the picture and the comment.
  • Upload limits: sample-1mb.doc is exactly 1,048,576 bytes, so you can test a limit right at the boundary.

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 DOC file? Give it a link.

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

Questions

DOC files, frequently asked

What is a DOC file?

A Microsoft Word document in the binary format used by Word 97 to 2003. Word 2007 and later save DOCX by default but still open and save DOC files.

What's the difference between DOC and DOCX?

DOC is a binary format inside an OLE2 compound file; DOCX is a ZIP package of XML, smaller and an open standard. A DOC can contain macros, while a DOCX can't (macro documents use .docm). Word opens both.

How do I open a DOC file without Word?

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

How do I convert a DOC to DOCX?

Open it in Word and choose File, Info, Convert, or Save As, Word Document. LibreOffice can do it too: soffice --headless --convert-to docx file.doc.

Why does Word say Compatibility Mode?

Because the document is in an older format such as DOC. Word turns off features that format can't store and keeps the old layout rules. Convert it to DOCX to get the current features.

Can a DOC file contain a virus?

Yes. DOC files can hold VBA macros and embedded objects, and they were a common way to spread malware. Don't enable macros in a document you didn't expect, and keep Office updated.

Is a password-protected DOC file secure?

Not very. Word 97-2003 encryption uses RC4 with a 40-bit key, which can be broken regardless of the password, and the document properties stay readable. Use DOCX encryption or another tool for anything sensitive.

Why is my DOC file so large?

DOC files aren't compressed, unlike DOCX, so pictures and repeated formatting take more room. Fast saves could also leave old content inside. Saving as DOCX usually makes the file much smaller.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.