TOML Cheatsheet - TOML Configuration Reference
All essential TOML commands organized by use case, with 38+ entries you can copy and run directly. Find the right command fast when you need it.
Back to Config FormatsBasic Types 11
# this is a commentComment (# to end of line)
key = "value"String
key = 'value'Literal string (no escapes)
int = 42Integer
hex = 0xFFHex integer
oct = 0o17Octal integer
bin = 0b101Binary integer
num = 1_000_000Underscore separators (readability)
float = 3.14Float
flt = infSpecial float (inf / -inf / nan)
bool = trueBoolean
Date & Time 5
date = 2026-07-19Local date
time = 14:30:00Local time
datetime = 2026-07-19T14:30:00Local datetime (no timezone)
datetime = 2026-07-19T14:30:00ZUTC datetime
datetime = 2026-07-19T14:30:00+08:00Offset datetime
Strings 4
str = "Hello\nWorld"Basic string (escapes supported)
str = """Hello\nWorld"""Multiline basic string
str = 'C:\\path\\to\'Literal string (no escapes)
str = '''C:\\path\\to\'''Multiline literal string
Arrays & Tables 6
array = [1, 2, 3]Array
array = [\n 1,\n 2,\n 3,\n]Array may span lines (trailing comma optional)
[table]Table (section)
[table.subtable]Subtable (dotted table name)
physical.color = "orange"Dotted keys (equivalent to subtable)
inline = { key1 = "value1", key2 = 2 }Inline table
Array of Tables 4
[[products]]Array of tables (first element)
name = "Apple"Array-of-tables field
[[products]]Array of tables (second element)
name = "Banana"Array-of-tables field
Cargo.toml Example 8
[package]Package info
name = "myapp"Package name
version = "0.1.0"Version
edition = "2021"Rust edition
[dependencies]Dependencies
serde = "1.0"Dependency version
serde = { version = "1.0", features = ["derive"] }Dependency with features
[dev-dependencies]Dev dependencies
Tips
- TOML prioritizes readability and fits config files better than JSON.
- Strings come in basic (double-quoted, escapes) and literal (single-quoted, no escapes).
- Tables [table] and arrays of tables [[array]] are TOML's core structures.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us