This page follows the TOML 1.0.0
specification (released 2021-01-11) and its
ABNF grammar, read
2026-11-12. A TOML document must be valid UTF-8, is designed to map unambiguously to a
hash table, and the specification gives the extension .toml and the media
type application/toml. TOML 1.1.0 followed on 2025-12-18 (see the
changelog, read
2026-11-12); its changes are listed at the end of this page.
Basics
- White space is tab (0x09) or space (0x20); a newline is LF (0x0A) or CR LF (0x0D 0x0A).
#starts a comment to the end of the line (not inside strings). The prose says control characters other than tab (U+0000 to U+0008, U+000A to U+001F, U+007F) are not permitted in comments; the 1.0.0 ABNF’snon-eol = %x09 / %x20-7F / non-asciidoes admit U+007F.- A key/value pair is
key = value; the key, the equals sign and the value must be on the same line (some values can span lines), and a newline or end of file must follow. A key with no value is invalid.
Keys
| Kind | Form |
|---|---|
| Bare | ASCII letters, digits, _ and -, at least one character: bare_key, 1234 (always a string). |
| Quoted | A basic or literal string: "ʎǝʞ", 'key2'. "" is allowed but discouraged. |
| Dotted | Keys joined by dots, which create nested tables: site."google.com" = true. White space around the dots is ignored; 3.14159 is two keys. |
Defining the same key twice is invalid (a bare key and the same key quoted are equivalent), as is giving a key a value and then using it as a table.
Strings
| Kind | Delimiters | Rules |
|---|---|---|
| Basic | "…" | Escapes allowed; one line. |
| Multi-line basic | """…""" | A new line straight after the opening quotes is dropped. A backslash at the end of a line removes the line break and the white space after it. |
| Literal | '…' | No escapes; one line. |
| Multi-line literal | '''…''' | No escapes; first new line dropped. One or two single quotes may appear inside, never three in a row. |
Escapes: \b, \t, \n, \f,
\r, \", \\, \uXXXX and
\UXXXXXXXX (the code must be a Unicode scalar value). All other escape
sequences are reserved, and TOML should produce an error if one is used. In basic
strings the quotation mark, backslash and control characters other than tab must be
escaped; multi-line basic strings also allow raw LF and CR.
Numbers and booleans
- Integers:
+99,-17,1_000(each underscore between digits),0xDEADBEEF,0o755,0b11010110. No leading zeros in decimal; hex, octal and binary are for non-negative values, take no leading+, and may have leading zeros after the prefix. The range −263 to 263−1 should be accepted losslessly; an integer that cannot be represented losslessly must be an error. - Floats should be IEEE 754 binary64:
3.1415,-0.01,5e+22,6.626e-34; a decimal point needs digits on both sides. Special values (always lower case)inf,+inf,-inf,nan,+nan,-nan. - Booleans:
trueandfalse, lower case.
Dates and times
| Type | Example |
|---|---|
| Offset date-time (RFC 3339) | 1979-05-27T07:32:00Z, 1979-05-27T00:32:00.999999-07:00; a space may replace the T. |
| Local date-time | 1979-05-27T07:32:00 |
| Local date | 1979-05-27 |
| Local time | 07:32:00, 00:32:00.999999 |
Millisecond precision is required for fractional seconds; further precision is implementation-specific, and digits beyond what an implementation supports must be truncated, not rounded.
Arrays and tables
- Arrays:
[ 1, 2, 3 ], values of any types mixed, new lines and comments allowed between values, a trailing comma allowed. - Tables: a header
[name](dotted or quoted keys allowed) followed by its pairs until the next header. A table may be defined only once; defining[a.b]first and[a]later is allowed. - Inline tables:
{ x = 1, y = 2 }, intended to appear on one line (no newlines between the braces unless valid within a value), no trailing comma. They are self-contained: keys and sub-tables cannot be added outside the braces. - Arrays of tables: each
[[name]]header adds a new table to the arrayname; following[name.sub]headers belong to its last element.
[[products]]
name = "Hammer"
sku = 738594937
[[products]] # empty table within the array
[[products]]
name = "Nail"
sku = 284758393
color = "gray"
That is the specification’s example. Appending with [[name]] to an
array defined statically (name = [ … ]) is an error, as is reusing a
name as both a table and an array of tables.
Changes in TOML 1.1.0
The changelog lists these changes for 1.1.0 (2025-12-18):
- Inline tables may contain newlines and a trailing comma.
- Basic strings gain
\xHHfor code points up to 255 and\efor the escape character. - Seconds are optional in date-time and time values
(
2010-02-03 14:15,14:15). - Clarifications: comments never affect the tables produced; Unicode and UTF-8 references; where and how dotted keys define tables; newline normalisation in multi-line literal strings; sub-millisecond precision is allowed; parsers are free to support any integer or float size.