TOML Formatter & Validator

Last updated:

Paste TOML (Cargo.toml, pyproject.toml, and similar), normalize its formatting or convert it to JSON — all in your browser, nothing uploaded. No multi-line strings, hex/octal/binary integers, or inf/nan — see "How it works" for the full scope.

How it works

  • Format re-serializes your TOML with consistent spacing around =, one key per line, and arrays collapsed onto a single line where they fit — useful for cleaning up a file with inconsistent style.
  • To JSON converts the parsed document straight to pretty-printed JSON — checking what a Cargo.toml, pyproject.toml, or Hugo config actually resolves to.
  • Handles key/value pairs (bare, quoted, and dotted keys), single-line basic and literal strings, decimal integers and floats (underscores allowed as digit separators), booleans, arrays that span multiple physical lines, inline tables, [table] headers with dotted paths, [[array.of.tables]] headers, and comments.
  • Duplicate keys and duplicate table headers are reported as errors — unlike the other scope limits below, this isn’t a missing feature, it’s the Validator doing its job: TOML forbids redefining a key or table, and this tool catches it.

What’s deliberately not supported (and reported as a clear error rather than silently guessed): multi-line strings ("""...""" or '''...'''), hex/octal/binary integers (0x/0o/0b), inf/nan float literals, and an inline table spanning more than one physical line (not valid TOML anyway). Date/time values are kept as their original text — a string in the JSON output, not converted to a native date type. On Format, an inline table or an array of inline tables re-serializes as one or more full [section] blocks, since that stylistic distinction isn’t preserved once parsed into plain data — and a float with no fractional part after parsing (like 72.0) re-serializes as 72, since JavaScript doesn’t distinguish the two.

Runs entirely in your browser — nothing you paste here is uploaded, logged, or stored. No autosave, by design, since config TOML sometimes contains API tokens or internal paths.

🔧 Also try: JSON Formatter → 📝 Also try: YAML Formatter →