Introduction
.doc is the extension of
Microsoft Word’s binary
documents, the default format until Word 2007 replaced it with
DOCX. Billions of these files still
exist, and every current word processor can open them.
The format changed several times. Word for Windows 1.x and 2.0 wrote a plain binary
file. Word 6.0 (1993) and Word 95 moved the document into a compound file, a small file
system inside the file. Word 97 kept the compound file but changed the document inside
it, adding Unicode text, and Word 2000, 2002 and 2003 kept the Word 97 format. Word for
MS-DOS and early versions of Word for the Mac also used .doc for formats of
their own.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.DOC | Word 6.0 and 95 document | Word 6.0 and 95 documents: single-byte text in one compound file stream. | Open |
.DOC | Word 97–2003 document | Word’s binary document from Word 97 to 2003: streams in a compound file. | Open |
Word 6.0 and 95
The format of Word 6.0 and Word 95 (Word 7). Text is stored in single-byte characters of a Windows code page, and all of the document, its text, formatting and tables, is in one stream.
The file is a compound file holding a WordDocument stream, which starts
with the File Information Block. Its first two bytes, wIdent, are
0xA5DC, and nFib is 101 for Word 6.0 or 104 for Word 95.
There is no 0Table or 1Table stream.
Word 97 to 2003
The format of Word 97, 2000, 2002 and 2003, and the one most .doc files
use. Text can be Unicode, and the tables that describe the document, such as the
piece table, styles and fonts, move to a separate table stream.
The WordDocument stream starts with a File Information Block whose
wIdent is 0xA5EC and whose nFib is 193
(0x00C1). The compound file also holds a table stream named
0Table or 1Table.
Links
Software
- Microsoft Word (Windows, macOS, web, mobile)
- LibreOffice Writer (Windows, macOS, Linux)
- Google Docs (web browsers)
- Apple Pages (macOS, iOS)
Developers
- Apache POI, Java library for Office files, Word documents through its HWPF classes
Reference
- [MS-DOC]: Word (.doc) Binary File Format, Microsoft
- [MS-CFB]: Compound File Binary File Format, Microsoft