tomlkit.org
TOML utilities, in the browser
Say hi →

TOML Formatter

Canonical formatting for TOML. Paste your document and receive a normalized version with consistent spacing, string quoting, and table layout. Everything runs in your browser.

TOML Formatter

updated 25 April 2026

Drop a .toml file here, or

Before you start

You need one of the following:

The most important thing to know is that this tool strips comments. It works by parsing your text into a data structure and then re-emitting it. If you have documented your config with # comments, they will not appear in the formatted output.

There is no file size limit, but because everything runs in your browser's memory, extremely large files (50 MB+) might cause the tab to hang. For standard development configs, it is effectively instant. I never see your data — processing happens entirely on your machine.

How to use it

  1. Paste your TOML into the left pane, or drop a .toml file anywhere on the editor.
  2. Click Format to clean up the syntax and spacing.
  3. Check the status bar at the bottom to ensure the document was parsed successfully.
  4. Click Copy result to put the canonical version on your clipboard.

Example

Input:

[database]
server="192.168.1.1"
  ports=[ 8001,8002 ]
  connection_max=5000
  enabled = true

Output:

[database]
server = "192.168.1.1"
ports = [8001, 8002]
connection_max = 5000
enabled = true

The formatter normalizes spacing around the = operator and cleans up whitespace inside arrays, ensuring your file follows the standard TOML 1.0 aesthetic.

Tips & common pitfalls

Troubleshooting

The status bar shows an error and nothing happens.

This means your TOML has a syntax error. The parser cannot format a "broken" document. Check for unclosed brackets in arrays or missing double quotes around strings.

My # comments disappeared after formatting.

This is expected behavior. My parser reads the values into memory and writes them back out from scratch, which drops metadata like comments. I recommend keeping a backup if your comments are important.

Related tools

See also: if you need to do something adjacent on this site, try JSON to TOML to convert JSON to TOML, TOML to JSON to convert TOML to JSON, or TOML to YAML to convert TOML to YAML.

Frequently asked questions

Will formatting change the meaning of my config?

No. The tool parses the input into a logical tree and then re-emits it. The resulting document is semantically identical to your input — only the "white space" and visual layout change.

Does it handle TOML 1.0 features?

Yes. This uses a modern parser that supports the full TOML 1.0 specification, including dotted keys, varied date formats, and hex/octal/binary numbers.

Why are my keys in a different order?

While the tool tries to preserve the order found in your input, some complex nested structures might be emitted in a way that the parser finds "optimal." TOML itself doesn't care about key order within a table.

Is there a limit on file size?

There is no hard cap, but your browser is doing all the work. It handles Cargo.lock files with thousands of lines easily, but multi-megabyte files might be sluggish.

Does my data ever leave my computer?

Never. I built this to be 100% client-side. The code runs in your browser's JavaScript engine. You can even check your network tab to verify that no POST requests are sent when you click format.

Can I use this for pyproject.toml?

Yes, it's great for cleaning up pyproject.toml files, especially if they've been edited by multiple different tools or people. Just remember the caveat about comments!