The header is everything between {\rtf1 and the document text: the
version, the character set, and the tables that the text refers to by number. Fonts,
colours, styles, lists and revision authors are all defined here once and then used by
index. The list tables have their
own page.
Order
<header> = \rtf <charset> \deff? <fonttbl> <filetbl>? <colortbl>? <stylesheet>? <listtables>? <revtbl>?
The tables that are present come in this order. Document properties may come before
and between them. Anything must be defined before it is used: the style sheet before
any style is applied, the font table before any font is named, and \deff
before any text that has no font of its own.
Version and character set
| Control word | Meaning |
|---|---|
\rtfN | Must follow the opening brace of the file. N is the major version of the specification, and is 1 for every version up to the last (1.9.1), which all stay syntactically version 1. |
\pwdN | Used instead of \rtfN by Pocket Word, to mark its files. Only 1 is written, and readers ignore the number. |
\urtfN | Used instead of \rtfN for a file whose text is all UTF-8; only binary data is left as it is. Word does not read this form. |
\ansi | Character set ANSI, the Windows code page (the default). |
\mac | Character set Apple Macintosh. |
\pc | Character set IBM PC code page 437. |
\pca | Character set IBM PC code page 850, used by the IBM Personal System/2 (not in version 1 of Word for OS/2). |
\ansicpgN | The ANSI code page used to convert between Unicode and the bytes in the file, in decimal, written straight after the character set word. Usually the system’s code page, for example \ansicpg1252 on US Windows. Values are those of \cpg. |
\deffN | The default font: the number of the entry in the font table used for text that names no font. Must come before the font table. |
The character set word must come before any text or table control word. All RTF
files must declare one of the four, even when every font sets its own character set,
so that old readers still work. The Unicode escapes \u,
\uc, \upr and \ud are described with the
syntax.
Font table
The font table is a destination, {\fonttbl …}, with one entry per font,
each ending in a semicolon and usually in its own braces. Text selects a font with
\fN, the number given to the entry here.
<fonttbl> = '{' \fonttbl (<fontinfo> | ('{' <fontinfo> '}'))+ '}'
<fontinfo> = <fontnum> <fontfamily> <fcharset>? <fprq>? <panose>? <nontaggedname>?
<fontemb>? <codepage>? <fontname> <fontaltname>? ';'
<fontnum> = \f
<fontfamily> = \fnil | \froman | \fswiss | \fmodern | \fscript | \fdecor | \ftech | \fbidi
<fcharset> = \fcharset
<fprq> = \fprq
<panose> = <data>
<nontaggedname> = \*\fname
<fontname> = #PCDATA
<fontaltname> = '{\*' \falt #PCDATA '}'
<fontemb> = '{\*' \fontemb <fonttype> <fontfname>? <data>? '}'
<fonttype> = \ftnil | \fttruetype
<fontfname> = '{\*' \fontfile <codepage>? #PCDATA '}'
<codepage> = \cpg
The table may list fonts the document does not use.
Font entry control words
| Control word | Meaning |
|---|---|
\fonttbl | Destination: the font table. |
\fN | The font’s number. Unique within the table. |
\fcharsetN | The font’s character set: see character set codes. |
\fprqN | Pitch: 0 default, 1 fixed, 2 variable. |
{\*\panose …} | Destination: the 10-byte PANOSE 1 classification of the font, in hexadecimal; each byte is one PANOSE property. |
{\*\fname …} | The font’s untagged name, such as Arial where the entry name is the tagged Arial (Cyrillic). Written by WordPad; Word ignores it and never writes it. |
\fbiasN | Chooses between a Far East and a non-Far East font for a character both can show: 0 non-Far East (default), 1 Far East. Word writes it only in list levels. |
{\*\falt …} | Alternative font name to use if this font is not available. |
{\*\fontemb …} | Destination: an embedded font, as a file name, as data, or both. |
\ftnil | Embedded font of unknown or default type (the default). |
\fttruetype | Embedded TrueType font. |
{\*\fontfile …} | Destination: the file name of the embedded font, optionally with \cpg for the name’s code page. |
\cpgN | The code page of the font, or of a file name: see code pages. |
Font families
The family lets a reader pick a similar font when the named one is missing. The
specification’s index also lists a font table flag \fetch, not described
anywhere; it is probably a misprint of \ftech.
| Control word | Family | Examples |
|---|---|---|
\fnil | Unknown or default (the default) | – |
\froman | Roman: proportional serif | Times New Roman, Palatino |
\fswiss | Swiss: proportional sans serif | Arial |
\fmodern | Fixed-pitch, serif or sans serif | Courier New, Pica |
\fscript | Script | Cursive |
\fdecor | Decorative | Old English, ITC Zapf Chancery |
\ftech | Technical, symbol and mathematical | Symbol |
\fbidi | Arabic, Hebrew or another bidirectional script | Miriam |
Character set codes
The values of \fcharset are the Windows LOGFONT character
set numbers. Each implies a code page, given here for reading \'hh bytes
in that font; the code page column is the usual Windows mapping, not part of the RTF
table.
| N | Character set | Usual code page |
|---|---|---|
| 0 | ANSI | 1252 |
| 1 | Default | the system’s |
| 2 | Symbol | none: bytes are glyph numbers in the font |
| 3 | Invalid | – |
| 77 | Mac | 10000 (Mac Roman) |
| 128 | Shift JIS | 932 |
| 129 | Hangul | 949 |
| 130 | Johab | 1361 |
| 134 | GB2312 | 936 |
| 136 | Big5 | 950 |
| 161 | Greek | 1253 |
| 162 | Turkish | 1254 |
| 163 | Vietnamese | 1258 |
| 177 | Hebrew | 1255 |
| 178 | Arabic | 1256 |
| 179 | Arabic Traditional | – |
| 180 | Arabic user | – |
| 181 | Hebrew user | – |
| 186 | Baltic | 1257 |
| 204 | Russian | 1251 |
| 222 | Thai | 874 |
| 238 | Eastern European | 1250 |
| 254 | PC 437 | 437 |
| 255 | OEM | the system’s OEM code page |
The 1.6 specification lists exactly these. Later versions add more Macintosh values (78 and up); they are not listed here because the later specifications are only published as Word documents, which this site has not checked.
Code pages
Values of \cpgN and \ansicpgN listed in the
specification:
| N | Code page | N | Code page |
|---|---|---|---|
| 437 | United States IBM | 874 | Thai |
| 708 | Arabic (ASMO 708) | 932 | Japanese |
| 709 | Arabic (ASMO 449+, BCON V4) | 936 | Simplified Chinese |
| 710 | Arabic (transparent Arabic) | 949 | Korean |
| 711 | Arabic (Nafitha Enhanced) | 950 | Traditional Chinese |
| 720 | Arabic (transparent ASMO) | 1250 | Windows 3.1 Eastern European |
| 819 | Windows 3.1 (United States and Western Europe) | 1251 | Windows 3.1 Cyrillic |
| 850 | IBM multilingual | 1252 | Western European |
| 852 | Eastern European | 1253 | Greek |
| 860 | Portuguese | 1254 | Turkish |
| 862 | Hebrew | 1255 | Hebrew |
| 863 | French Canadian | 1256 | Arabic |
| 864 | Arabic | 1257 | Baltic |
| 865 | Norwegian | 1258 | Vietnamese |
| 866 | Soviet Union | 1361 | Johab |
A font can use another character set than the document: the Symbol font, for example, has the same characters in the same places on Windows and the Macintosh.
File table
The file table lists other files the document refers to. Word writes it only when a
master document has subdocuments, which the text includes with
\subdocumentN.
<filetbl> = '{\*' \filetbl ('{' <fileinfo> '}')+ '}'
<fileinfo> = \file <filenum> <relpath>? <osnum>? <filesource>+ <file name>
<filenum> = \fid
<relpath> = \frelative
<osnum> = \fosnum
<filesource> = \fvalidmac | \fvaliddos | \fvalidntfs | \fvalidhpfs | \fnetwork
<file name> = #PCDATA
| Control word | Meaning |
|---|---|
\filetbl | Destination: the list of files referred to. |
\file | Destination: one file’s entry. |
\fidN | The file’s number, used to refer to it later. |
\frelativeN | The character position in the path, counting from 0, where the part relative to the owning document starts. A document at C:\Private\Resume\File1.doc that refers to C:\Private\Resume\Edu\File2.doc writes \frelative18, pointing at Edu. |
\fosnumN | An operating-system number for the file; so far only the Macintosh “file id”. |
\fvalidmac | Path is in the Macintosh file system. |
\fvaliddos | Path is in the MS-DOS file system. |
\fvalidntfs | Path is in NTFS. |
\fvalidhpfs | Path is in HPFS. |
\fnetwork | Path is on a network file system; combines with one of the four above. |
Colour table
<colortbl> = '{' \colortbl <colordef>+ '}'
<colordef> = \red? & \green? & \blue? ';'
| Control word | Meaning |
|---|---|
\colortbl | Destination: the colour table. |
\redN | Red, 0 to 255. |
\greenN | Green, 0 to 255. |
\blueN | Blue, 0 to 255. |
Every entry ends in a semicolon, even an empty one; an empty entry means the reader’s
default colour. Entries are numbered from 0 in order, and text, borders, shading and
highlighting refer to them by number (\cfN, \cbN,
\brdrcfN and so on). Word leaves entry 0 empty, which makes colour 0 the
“auto” colour. Word’s default table, as printed in the specification:
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;
\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;
\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
That is auto, then black, blue, cyan, green, magenta, red, yellow, white, dark blue, dark cyan, dark green, dark magenta, dark red, dark yellow, dark grey and light grey, numbered 0 to 16. A reader that does not show colour ignores the table.
Style sheet
A style is a named set of character, paragraph or section formatting. The style sheet
defines them, and the text applies one with \sN, \csN or
\dsN.
<stylesheet> = '{' \stylesheet <style>+ '}'
<style> = '{' <styledef>? <keycode>? <formatting> <additive>? <based>? <next>?
<autoupd>? <hidden>? <personal>? <compose>? <reply>? <stylename>? ';' '}'
<styledef> = \s | \*\cs | \ds
<keycode> = '{' \keycode <keys> '}'
<keys> = (\shift? & \ctrl? & \alt?) <key>
<key> = \fn | #PCDATA
<formatting> = (<brdrdef> | <parfmt> | <apoctl> | <tabdef> | <shading> | <chrfmt>)+
<stylename> = #PCDATA
With no style word the entry is paragraph style 0. Word for the Macintosh reads commas
in the name as separating alternative names. A <key> is exactly one
character.
| Control word | Meaning |
|---|---|
\stylesheet | Destination: the style sheet. |
\sN | Paragraph style number N. |
\*\csN | Character style number N. In the style sheet it is written with \* and first in its group, so readers that do not know character styles skip the entry. In the text it is written without \*. |
\dsN | Section style number N. |
\additive | In a character style: add its formatting to the paragraph style’s, rather than replacing it. |
\sbasedonN | The style this one is based on. Default 222, meaning none. |
\snextN | The style for the next paragraph after pressing Enter; if absent, the same style. |
\sautoupd | Update the style automatically from direct formatting. |
\shidden | Do not show the style in the list of styles (Word sets this only through Visual Basic for Applications). |
\spersonal | The style is a personal e-mail style. |
\scompose | The style is the e-mail compose style. |
\sreply | The style is the e-mail reply style. |
\keycode | Destination: the style’s shortcut key, for example {\s0 {\*\keycode \shift\ctrl n}Normal;}. |
\shift | Shortcut uses the Shift key. |
\ctrl | Shortcut uses the Ctrl key. |
\alt | Shortcut uses the Alt key. |
\fnN | Shortcut is function key N. |
Word writes a style’s formatting again after the style number wherever the style is used, so that readers that do not apply styles still get the formatting, and so that extra formatting can be added on top. A reader should not rely on the style number alone. An example from the specification:
{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}
{\*\cs10 \additive Default Paragraph Font;}
{\*\cs15 \additive \b\ul\cf6 \sbasedon10 UNDERLINE;}
{\s16\qc \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\b\fs24\cf2\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext16 \sautoupd CENTER;}}
Revision table
| Control word | Meaning |
|---|---|
\*\revtbl | Destination: the authors of tracked changes, each in its own group ending in a semicolon, as in {Author1;}. Revision marks in the text refer to an author by position (\revauthN, \pnrauthN and others). |
A revision conflict, such as one author deleting another’s insertion, is stored in one
group as the current author’s name, a zero byte, a byte giving the length of the
previous author’s name, that name, a zero byte and the time of the previous revision.
The four bytes of the time are written as characters, with values above 127 as
\'hh.
Date and time (DTTM)
Revision times are 32-bit DTTM values, written as a long integer, for example in
\revdttmN. The bits are:
| Bits | Field | Range |
|---|---|---|
| 0–5 | Minute | 0–59 |
| 6–10 | Hour | 0–23 |
| 11–15 | Day of the month | 1–31 |
| 16–19 | Month | 1–12 |
| 20–28 | Year | year − 1900 |
| 29–31 | Day of the week | 0 (Sunday) – 6 (Saturday) |
For example 13:45 on Thursday 12 November 2026 is minute 45, hour 13, day 12, month
11, year 126 and weekday 4: 45 + 13×64 + 12×2,048 + 11×65,536 + 126×1,048,576 +
4×536,870,912 = 2,280,350,573. That is above 231, so as a signed 32-bit
number it is written \revdttm-2014616723.