TOML Formatter
Format and validate TOML (Tom's Obvious, Minimal Language). Neatly aligns key = value pairs, tables, and arrays, and reports syntax errors with line numbers.
Main TOML Data Types
| Type | Example | Description |
|---|---|---|
| String (basic) | "hello" | Enclosed in double quotes. Supports escape sequences such as \n and \t. |
| String (literal) | 'C:\path' | Enclosed in single quotes. No escaping is applied at all, making it convenient for paths containing backslashes. |
| Integer | 42 | Decimal by default; also supports 0x (hex), 0o (octal), 0b (binary), and underscore separators like 1_000. |
| Float | 3.14 | Exponential notation (1e10) and special values inf/nan are also valid. |
| Boolean | true | Either true or false. Capitalized forms like True are invalid. |
| Array | [1, 2, 3] | Comma-separated values inside square brackets. A trailing comma is allowed. |
| Table | [server] | Every key = value pair following a section header becomes a child of that table. |
| Array of tables | [[fruits-basket]] | Repeating the same table name expresses an array (e.g. multiple dependency definitions). |
| Date/Time | 1979-05-27T07:32:00Z | RFC 3339 format — the only compound value that can be written without quotes. |
Tips
- Only single-line inline arrays and inline tables are supported. If your array spans multiple lines, collapse it into one line before pasting.
- The formatter always normalizes exactly one space on each side of "=", and standardizes array/inline table separators to ", ". This smooths out inconsistent formatting between authors.
- Comments (everything after #) are preserved; the only change applied is inserting a single space right after "#" when missing, keeping the edit minimal.
- Consecutive blank lines are collapsed into a single blank line, making the boundaries between tables easier to scan.
- All processing happens entirely inside your browser — nothing you paste here is ever sent to a server.
Frequently Asked Questions
[[section]] header correctly, but it does not merge repeated same-name sections into a single array-like object (as a full TOML-to-JSON converter would). For complex array-of-tables structures, please review the line-by-line formatted output visually."""...""" and '''...''' are not currently supported, and that line will be reported as an error. Please convert long text into a single-line escaped string before formatting.
Side Note — Why TOML became the common language of config files
TOML was created in 2013 by GitHub co-founder Tom Preston-Werner, and its expanded name, "Tom's Obvious, Minimal Language", captures the design goal directly: a format that is easy for machines to parse like JSON, yet reads and writes naturally for humans without ambiguity.
The format's breakthrough moment came when Rust's package manager Cargo adopted Cargo.toml as its manifest format. Later, PEP 518 introduced pyproject.toml as Python's packaging standard, consolidating what had been a patchwork of setup.py, setup.cfg, and requirements.txt files.
The biggest difference from YAML is that TOML gives no meaning to indentation. In YAML, a small indentation slip can silently change the data structure or trigger a syntax error; TOML instead expresses hierarchy purely through [section] headers and key = value pairs, which makes copy-paste mistakes far less likely.
That said, TOML trades away some of YAML's expressive power — it has no anchors/aliases for reusing values and is more verbose for deeply nested structures, so many teams pick between TOML, YAML, and JSON depending on the shape of the data.