How to use the TOML formatter
- Paste your file into the Input box. A Cargo-style sample is ready to try.
- The Formatted TOML appears straight away; there are no options to set.
- If a yellow note says comments were removed, keep your original file for the comments.
- Copy the result or download it as
formatted.toml.
What it does and when to use it
Use it as a quick validity check before you commit a Cargo.toml, pyproject.toml, Hugo or Netlify config, and to give a hand-edited file one even layout: key = value with single spaces, arrays written as [ "a", "b" ], and one blank line before each table header.
The output also shows how a program reads your file: if a value lands in an unexpected table, your headers are wrong.
To use the data elsewhere, convert it with TOML to JSON, or go the other way with JSON to TOML. For older key=value files with [sections] and ; comments, the INI formatter keeps your comments.
How it works
The tool loads the smol-toml library in your browser and calls parse on your text. That step fails on any TOML error, such as a repeated key, a missing quote or an invalid date. If it succeeds, stringify writes the data back out:
- simple keys first, then each sub-table under its own
[a.b]header, - arrays of tables as
[[name]]blocks, - strings in double quotes, dates in full ISO form.
Your text is not uploaded; parsing and printing happen on your device.
Worked examples
These are the tool’s own outputs.
The sample manifest. Its serde={version="1.0",features=["derive"]} line under [dependencies] comes out as:
[dependencies.serde]
version = "1.0"
features = [ "derive" ]
A file with comments. # build settings above title="Site" and port=8080 # dev port give title = "Site" and port = 8080 under [server], plus the note “Comments were removed by the TOML parser; keep your original if they matter.”
A duplicate key. a = 1 followed by a = 2 fails with “Invalid TOML document: trying to redefine an already defined table or value”, and a caret marks line 2.
A date. when=1979-05-27T07:32:00Z is printed as when = 1979-05-27T07:32:00.000Z.
Limits and tips
- Comments are always lost. This is the main trade-off of a parse-and-print formatter.
- Layout choices are fixed. You cannot choose inline tables, a different indent or a key order.
- Floats stay floats.
x = 1.0comes back asx = 1.0and integers stay integers, but exponent forms are written out in full, so1e3becomes1000.0. - Large integers are kept exactly.
big = 9007199254740993is printed unchanged.
Frequently asked questions
Why did my comments disappear?
Why did my inline table become a [section]?
Can it find errors in my TOML?
Does it keep the order of my keys?
Which TOML version does it follow?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.