Syntax
Basic Rules
key = valueKey-value pair (one per line)
#Comment (to end of line)
Case sensitiveKeys and values are case-sensitive
UTF-8Files must be valid UTF-8
No nullTOML has no null type
Minimal Example
title = "My App" debug = true port = 8080
Strings
String Types
"basic"Basic string (supports escapes)
'literal'Literal string (no escapes)
"""multi"""Multi-line basic string
'''multi'''Multi-line literal string
Examples
basic = "Hello\nWorld" literal = 'C:\Users\path' multi = """ Line one Line two"""
Escape Sequences
\n \t \rNewline, tab, carriage return
\\Backslash
\uXXXXUnicode (4-digit hex)
\UXXXXXXXXUnicode (8-digit hex)
Numbers & Booleans
Numeric Types
42Integer
1_000_000Integer with underscores
0xff / 0o77 / 0b11Hex, octal, binary
3.14Float
5e+22 / 1e-2Scientific notation
inf / nanSpecial float values
true / falseBoolean (lowercase only)
Examples
count = 42 price = 19.99 hex_color = 0xFF5733 enabled = true
Dates
Date & Time Types
2026-03-26T10:30:00ZOffset date-time (UTC)
2026-03-26T10:30:00-05:00Offset date-time (EST)
2026-03-26T10:30:00Local date-time (no timezone)
2026-03-26Local date
10:30:00Local time
Examples
created = 2026-03-26T10:30:00Z birthday = 1990-05-15 alarm = 07:00:00
Tables
Table Syntax
[server] host = "localhost" port = 8080 [server.ssl] enabled = true cert = "/path/to/cert.pem"
Array of Tables
[[users]] name = "Alice" role = "admin" [[users]] name = "Bob" role = "user"
Rules
[name]Standard table header
[a.b.c]Dotted key — nested table
[[name]]Array of tables
No redefineCannot define same table twice
Arrays
Array Syntax
colors = ["red", "green", "blue"] numbers = [1, 2, 3]
Multi-line Array
hosts = [ "alpha.example.com", "beta.example.com", ]

Trailing comma is allowed in TOML arrays

Rules
Same typeAll elements must be the same type
Trailing commaAllowed after last element
NewlinesArrays can span multiple lines
Inline Tables
Inline Table Syntax
point = { x = 1, y = 2 } user = { name = "Alice", admin = true }
Rules
Single lineMust appear on one line
No trailing commaTrailing comma not allowed
No newlinesCannot span multiple lines
No adding keysCannot add keys to inline table later
Inline vs Standard
# Inline — compact, one-liners db = { host = "localhost", port = 5432 } # Standard — readable, extendable [db] host = "localhost" port = 5432
Common Patterns
pyproject.toml
[project] name = "myapp" version = "1.0.0" dependencies = ["flask>=3.0"]
Cargo.toml
[package] name = "myapp" version = "0.1.0" edition = "2021"
Tips
taploTOML toolkit — formatter and linter
No nullOmit the key instead of setting null
No anchorsUnlike YAML, no reference/alias system
StrictNo duplicate keys, no mixed-type arrays