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.docextension 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.
$ 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
d0cf 11e0 a1b1 1ae1The OLE2 signature
The first 8 bytes of every Compound File Binary file: old Word, Excel and PowerPoint files, Outlook
.msgfiles, WindowsThumbs.db, MSI installers. So these bytes say "compound file", not "Word". - 2
3b00 0300Version numbers
Minor version
0x003Band major version 3. Version 3 means 512-byte sectors; version 4 uses 4,096. The spec asks writers to put0x003Ein the minor version, and LibreOffice writes0x003B; readers don't depend on it. - 3
feff 0900 0600Byte order and sector sizes
FE FFmarks 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
0100 0000 · 2100 0000FAT 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
0010 0000The 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
1Tableis small enough. - 6
feff ffffNo extra DIFAT sectors
FFFFFFFEmeans "end of chain". The header itself lists the first 109 FAT sectors from offset 0x4C; only files above roughly 7 MB need more. - 7
Root 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
WordDocumentThe 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
1TableThe table stream
Styles, fonts, lists, the piece table that maps text positions to bytes, and much more. It's called
1Tableor0Table, and a bit in the FIB says which one to use. - 10
\x05SummaryInformationDocument 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
ec a5wIdent
0xA5EC, little-endian: the identifier [MS-DOC] requires at the start of every Word binary file. - 12
01 01 · 09 04nFib and language
nFibis the format version. The spec says it should be0x00C1, Word 97's number, with later versions recorded further on; LibreOffice writes0x0101, the Word 2002 number.0x0409is 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 storage | What it holds |
|---|---|
WordDocument | The File Information Block (FIB), then the text of the main document, footnotes, headers and comments, one after another. |
1Table or 0Table | Styles, fonts, lists, fields, bookmarks, comments' authors, and the piece table that says where each stretch of text is. |
Data | Pictures and some other binary data. Our sample-document.doc has one; the minimal file doesn't need it. |
ObjectPool | A storage holding embedded objects, such as an Excel chart pasted into the document. |
Macros | A storage holding the VBA project, when the document has macros. |
\x05SummaryInformation, \x05DocumentSummaryInformation | Document 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
Datastream. - 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 version | File format | Notes |
|---|---|---|
| Word for DOS, Word for Windows 1.x and 2.0 | Older binary formats | Not compound files. Support in current software is patchy. |
| Word 6.0 (1993) and Word 95 | Word 6.0/95 binary | Already an OLE2 compound file with a WordDocument stream, but text is stored in an 8-bit code page, not Unicode. |
| Word 97, 2000, 2002, 2003 | Word 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 later | DOCX by default | Still 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
| DOC | DOCX | RTF | ODT | ||
|---|---|---|---|---|---|
| Structure | Binary records in an OLE2 file | ZIP of XML | Text with control words | ZIP of XML | Binary objects and streams |
| Open standard | Documented, not a standard | Yes (ISO/IEC 29500) | Documented by Microsoft | Yes (ISO/IEC 26300) | Yes (ISO 32000) |
| Macros | Yes, same extension | No (.docm instead) | No | Yes | No (but JavaScript) |
| Size | Larger, not compressed | Small: compressed | Large for images | Small: compressed | Depends on fonts and images |
| Opens in a browser | No, it downloads | No | No | No | Yes |
| Readable with simple tools | Hard: needs a format library | Yes, unzip and read XML | Yes, it's text | Yes, unzip and read XML | Needs 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
WordDocumentstream with a tool such asolefilecan 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.docorcatdoc file.docon 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
Macrosstorage runs once you click Enable Content; anAutoOpenmacro 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
ObjectPooland 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.docstill 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.
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.
Document properties
Title, subject, author, keywords and a comment in the
\x05SummaryInformationstream, shown in Word under File, Info.Headings and styles
Title, Heading 1, List Bullet, List Number, Quote and Caption, defined in the style sheet in the
1Tablestream.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.
Lists and a table
A bulleted and a numbered list, and a five-row table comparing DOC with DOCX, RTF and ODT.
A picture
A PNG bar chart on page 2, stored in the
Datastream, with a caption below it.A hyperlink and fields
A link to this page, which is a HYPERLINK field in DOC, and PAGE and NUMPAGES fields in the footer.
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 theWordDocumentstream before calling it a Word document. - Encrypted files:
sample-password.dochas 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; with99helpersit 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.docto DOCX or PDF and check the header, the page numbers, the table, the picture and the comment. - Upload limits:
sample-1mb.docis 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
- Microsoft: [MS-DOC] Word (.doc) Binary File Format
- Microsoft: [MS-DOC] FibBase (wIdent, nFib, fWhichTblStm)
- Microsoft: [MS-CFB] Compound File Binary File Format
- The National Archives (PRONOM): Microsoft Word Document 97-2003
- Microsoft: Compatibility changes between versions of Word
- Microsoft Learn: Macros from the internet are blocked by default in Office
Last reviewed 27 October 2026.