TOML Formatter and Validator
Validate and reformat TOML. Pure client-side.
What this tool does
Validates TOML (Tom's Obvious Minimal Language) and reformats it with consistent
spacing around equals signs and one blank line between tables. The tool catches
common syntax errors: unclosed strings, mismatched table markers, invalid keys,
bare values without quotes. It supports the major TOML constructs: scalars
(string, integer, float, boolean), tables, arrays of tables ([[name]]),
inline tables, and arrays. Date and time literals pass through. Everything happens
in your browser.
How to use it
Paste TOML into the input. Press Format to clean up spacing or
Validate only to check syntax without changing the output. Errors
are reported with line numbers. Example: a config file with inconsistent spaces
around = and ad-hoc blank lines becomes one space on each side and a
single blank line between tables.
Common use cases
- Cleaning up a
Cargo.tomlorpyproject.tomlhand-edit before committing. - Validating a config file before deploying it.
- Comparing the structure of two TOML files by formatting them identically first.
- Catching a missing closing bracket on a table header.
- Normalizing TOML produced by a tool that emits inconsistent spacing.
Common pitfalls
- Multi-line strings. Triple-quoted strings (
"""and''') preserve their internal whitespace exactly. The formatter does not modify them. - Comments inside arrays. TOML allows comments on lines inside a multi-line array. The formatter preserves them but does not align them.
- Inline tables. Inline tables (
{ a = 1, b = 2 }) cannot span multiple lines per the TOML spec. If you have one that wraps, it is invalid TOML; convert it to a regular table.
Frequently asked questions
- How is TOML different from YAML and JSON?
- All three are text-based config formats. TOML aims to be obvious and minimal: explicit keys with =, tables in [brackets], and unambiguous types. JSON is universally supported but verbose for hand-edited config and disallows comments. YAML is concise but indentation-sensitive and famously tricky around boolean / string ambiguity (the "Norway problem" where the country code NO becomes false). TOML fits between them: easier to write than JSON, less surprising than YAML.
- Why use TOML over JSON for config?
- TOML allows comments (JSON does not), uses minimal punctuation, and is unambiguous about types (strings need quotes; numbers do not). Cargo.toml, pyproject.toml, and many modern Rust and Python tools use it specifically because hand-written config benefits from these properties.
- What is the difference between [[arrays of tables]] and inline arrays?
- [[name]] starts a new table appended to an array of tables. You can repeat [[name]] to add more entries, and each entry has its own block of key=value lines. Inline arrays use brackets and commas: items = [1, 2, 3]. Use [[arrays of tables]] when each entry has multiple fields; use inline arrays for simple lists of scalars.
- Does TOML support null or undefined?
- No. TOML has no null. The convention is to omit a key entirely if it has no value. If you need to round-trip a JSON-like structure that includes nulls, TOML may not be the right format; JSON or YAML preserves nulls directly.
- Why does my multi-line string look unchanged after formatting?
- Triple-quoted strings (""" or ''') preserve their internal whitespace per the TOML spec. The formatter intentionally does not re-indent or trim them, since any change would alter the string value. If you want different whitespace, edit the string contents directly.
- Can TOML files have comments inside arrays or tables?
- Yes. Comments start with # and run to the end of the line. They can appear on their own line or at the end of any line. The formatter preserves comments but does not column-align them.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.