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.

Config Formats·38 commands·Last updated 2026-07-21
Back to Config Formats

Basic Types 11

# this is a comment
Comment (# to end of line)
key = "value"
String
key = 'value'
Literal string (no escapes)
int = 42
Integer
hex = 0xFF
Hex integer
oct = 0o17
Octal integer
bin = 0b101
Binary integer
num = 1_000_000
Underscore separators (readability)
float = 3.14
Float
flt = inf
Special float (inf / -inf / nan)
bool = true
Boolean

Date & Time 5

date = 2026-07-19
Local date
time = 14:30:00
Local time
datetime = 2026-07-19T14:30:00
Local datetime (no timezone)
datetime = 2026-07-19T14:30:00Z
UTC datetime
datetime = 2026-07-19T14:30:00+08:00
Offset 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