TOML Formatter

Format and beautify your TOML configuration files

Input TOML

Formatted TOML

Paste your TOML on the left and the result shows up here.

Or drop a file on this box, , or .

What is TOML Formatter?

A pyproject.toml that three people have edited by hand tends to drift: key="value" on one line, key = "value" on the next, tables jammed together with no blank line between them. This page reads the file with a TOML parser and writes it back out in one house style, with spaces around every =, blank lines separating tables that hold keys, and arrays printed as [ 8001, 8002 ]. If the format itself is new to you, the Wikipedia article on TOML has its history and the projects that use it.

The rules it writes against are the ones in the TOML v1.0.0 specification, which is what Cargo reads for Cargo.toml and what Poetry reads for pyproject.toml. Because the output is rebuilt from parsed data rather than edited in place, a few things change beyond spacing: the sample's dob datetime picks up an explicit .000 milliseconds part, and inline tables become full sections. Edge cases in the grammar are discussed in the toml-lang repository.

The parsing and printing are done by a JavaScript TOML library loaded with this page, so your config is never sent anywhere. Integers too big for a JavaScript number, like a 19-digit ID, are kept as exact values and printed back digit for digit.

What Makes This Tool Different

Consistent Formatting

Formats TOML with consistent spacing and indentation. Makes your TOML files cleaner and easier to read.

Keeps Your Values

Keys, strings, numbers, dates and 64-bit integers come out with the same values. Comments are not kept, and inline tables are expanded into [section] form, because the file is rebuilt from its parsed data.

Real-Time Preview

See formatted TOML as you type or paste. No waiting, no delays – immediate results.

File Upload Support

Upload TOML files directly. No need to copy-paste – just select your .toml file.

Download Formatted

One click to download your formatted TOML file. Drop it into your project and use it immediately.

Standards Compliant

Follows TOML v1.0.0 specification. Formatted TOML is valid and works with any TOML parser.

How It Works

1

Paste or Upload TOML

Paste TOML on the left or press Upload to open a .toml file. Sample loads a deliberately cramped config with no spaces around = and no gaps between [owner], [database] and [servers], so you can see the difference straight away. If the input does not parse, the parser message shows in a red box at the top right and the output stays empty until you fix it.

2

View Formatted Output

Your TOML is automatically formatted on the right. The formatted output appears with consistent spacing and structure.

3

Copy or Download

Hit "Copy" for the clipboard or "Download" for a .toml file, and drop the tidied result straight back into your project.

When You'd Actually Use This

Clean Up Files

Format messy TOML files with inconsistent spacing. Make them clean and readable. Perfect for cleaning up legacy configuration files.

Team Consistency

Format TOML files to match your team's style guide. Consistent formatting makes code reviews easier and reduces merge conflicts.

Version Control

Format TOML before committing to version control. Consistent formatting makes diffs cleaner and easier to review.

Configuration Files

Format TOML configuration files for better readability. Clean, consistent formatting makes configuration easier to maintain.

Common Questions

Is my TOML data stored?

No. The file is parsed and re-printed inside this tab and is not uploaded or saved anywhere. Closing the tab is the end of it.

What does formatting change?

Spacing around =, blank lines between tables, and layout: inline tables like serde = { version = "1.0" } are rewritten as a [dependencies.serde] section, and arrays are written on one line. Times are written with milliseconds (07:32:00 becomes 07:32:00.000), which is the same value.

Does it preserve my content?

Your values, yes. Your comments, no: the formatter parses the TOML and writes it back out, and comments aren't part of the parsed data, so # pinned for MSRV notes disappear. If your Cargo.toml or pyproject.toml relies on comments, copy only the section you want reformatted, or keep the original next to it.

What TOML features are supported?

We support standard TOML syntax including tables, arrays, strings, numbers, booleans, dates, and more. Follows TOML v1.0.0 specification.

Does it work with large TOML files?

It reformats on every keystroke, so the only limit is how fast your machine parses the file. A typical Cargo.toml or pyproject.toml of a few hundred lines keeps up while you type. A generated lock-style file in the megabytes will make typing feel sluggish; paste it in one go rather than editing it here.

Is the formatted TOML valid?

Yes! The formatted TOML follows TOML v1.0.0 specification and is valid TOML. It works with any TOML parser.

Other TOML Tools You Might Need

A tidy file is often the step before something else: checking it against the spec, or handing the same settings to a tool that wants JSON, YAML, XML or CSV.