Reference
TOML Cheat Sheet
A scannable TOML v1.0 syntax reference: keys, strings, numbers, dates, tables, and arrays. Copy an example or open it in the formatter.
Keys
Bare keys, quoted keys, and dotted keys. Dotted keys create nested tables without a [header].
name = "demo" "quoted key" = true physical.color = "orange" physical.shape = "round"
Strings
Basic strings support escapes. Literal strings keep backslashes. Triple quotes allow multiline text.
basic = "Hello\nWorld" literal = 'C:\Users\demo' multi = """ First line Second line """
Numbers
Integers (including hex/oct/bin), floats, underscores for readability, plus inf and nan.
int1 = 99 int2 = 1_000_000 hex = 0xDEADBEEF float1 = 3.1415 inf = inf not_a_number = nan
Booleans
Only lowercase true and false.
enabled = true debug = false
Dates & times
Offset datetime, local datetime, local date, and local time are first-class types.
odt = 1979-05-27T07:32:00Z ldt = 1979-05-27T07:32:00 ld = 1979-05-27 lt = 07:32:00
Arrays
Arrays are [ … ]. Values of different types in one array are allowed by the language but often discouraged in configs.
ports = [ 8001, 8001, 8002 ] mixed_ok = [ 1, 2, 3 ] nested = [ [ 1, 2 ], [3, 4, 5] ]
Tables
[table] headers define nested maps. Subtables use dotted names like [server.tls].
[server] host = "127.0.0.1" port = 8080 [server.tls] enabled = true
Array of tables
[[name]] appends a table to an array. Repeat the header for each element.
[[products]] name = "Hammer" sku = 1 [[products]] name = "Nail" sku = 2
Inline tables
Compact tables written as { key = value, … } on one line. Good for small nested objects.
point = { x = 1, y = 2 }
name = { first = "Tom", last = "Preston-Werner" }
FAQ
- Is this the full TOML specification?
- No. It is a quick reference for everyday syntax. See the TOML v1.0 guide for more context.
- Can I validate these examples?
- Yes. Use Copy or Try in formatter — parsing stays in your browser.
Comments
Comments start with #. A parse→stringify format pass drops them — the formatter warns about that.