TOML formatter
Paste TOML and the spacing is normalized — keys, strings and values stay untouched.
Formatted TOML
How to use it
- Paste your TOML into the box — it is formatted as you type, there is no button to press.
- Pick 2 or 4 spaces for multi-line arrays, and turn on Align = if you want the equals signs lined up; the result updates immediately.
- If something is wrong, the message names the line, the column and the reason. Copy the result or download it as a .toml file.
Example
Input
[package]
name="ykit"
version = "0.1.0"
edition="2021"
authors = ["Ada Lovelace <ada@example.com>", "Grace Hopper <grace@example.com>"]
keywords=["tools", "toml"]
[dependencies]
serde={version="1.0",features=["derive"]}Formatted
[package]
name = "ykit"
version = "0.1.0"
edition = "2021"
authors = ["Ada Lovelace <ada@example.com>", "Grace Hopper <grace@example.com>"]
keywords = ["tools", "toml"]
[dependencies]
serde = { version = "1.0", features = ["derive"] }Default rules only: two spaces and no alignment. Key order, string contents and array order are untouched; the inline table only gets its spacing normalized and never a trailing comma.
Rules, limits and known issues
- Syntax and key/table conflicts only: repeated keys, tables defined twice, key/table clashes, strings and escapes, numbers, dates, arrays and inline tables. No schema, no business semantics, no automatic fixes.
- Only whitespace outside strings and comments is rewritten. Key order, table order, bare vs quoted keys, string delimiters and escapes, number/date/boolean spellings and comment text are copied character for character.
- Single-line arrays stay on one line; multi-line arrays keep one item per line with their comments and trailing comma. Inline tables are printed on one line, so arrays inside them are folded to one line; newlines inside a multiline string are content and stay as typed, which can make an inline table span lines.
- A newline or a comment inside an inline table is a syntax error (TOML itself forbids both). A trailing comment stays one space after the code, and spaces at the end of a comment are removed.
- Runs of blank lines collapse to one, leading and trailing blank lines are dropped, and no blank line is ever added between tables.
- An unclosed array, inline table or multiline string at the very end, a truncated table header, a bare `key =`, or a key path cut off right after a dot is a warning, not an error: you still get a result. Real mistakes (a missing comma, an unquoted value, a bad date) are errors with line and column. Only the first error is reported.
- Line and column numbers count Unicode code points, so an emoji is one column; CRLF counts as one newline. Only space and tab are TOML whitespace: U+3000 and U+00A0 outside a string are errors, while inside a string they are content.
- Bare keys are ASCII only — Chinese or Arabic keys must be quoted, which is TOML itself, not a preference of this tool. Numbers and dates are never rewritten or converted to another digit system.
- No minify, no key sorting, no value normalization, no file upload, no URL parameters, no history. Everything runs in your browser: nothing is uploaded or stored.
- Above 200,000 characters the result updates about 0.6 s after you stop typing; the text is never truncated. Output uses LF with no trailing newline, and formatting is idempotent with the same alignment and indent settings.
Related tools
What people usually need next, once the config is readable.