TXT · Text & Data tools

TOML Formatter & Validator

Output format
Indent
Input
Output
0input bytes0input lines1output bytes2output lines

TOML formatting and JSON conversion

This TOML formatter cleans up configuration files and ensures the syntax is strictly valid. You can format the input as standardized TOML, or convert it to JSON to check how the parser interprets data types and deeply nested tables.

Because TOML is widely used in modern language tooling (like Rust’s Cargo or Python’s Poetry) but less natively supported in raw browser environments, converting TOML examples into JSON is helpful when your web API or JavaScript code requires JSON objects.

Indentation and minification

When converting TOML to JSON, you can format the output with spaces or tabs. You can also minify the output entirely, which collapses the JSON into a single compact line—useful for passing data via environment variables or minimizing payload sizes.

(Note: Custom indentation and minification apply to JSON output only, as standard TOML relies on its own formatting rules without deep block indentation.)

Key sorting and validation

Enable key sorting to alphabetize the keys inside every table and nested object. This creates a stable, predictable order that minimizes noisy diffs when committing large configuration files to version control.

The tool parses your input live using smol-toml. If the document contains syntax errors—such as an unclosed string, an invalid date format, or a duplicate table definition—an error badge appears instantly. The parser will indicate the exact line and column where the error occurred, letting you quickly isolate and fix the typo.

Frequently Asked Questions

Paste or drop TOML into the left editor. If it parses, you will see a formatted preview on the right. If not, the tool isolates the syntax issue and points you to the exact line and column.

Yes. Choose JSON as the output format to convert your TOML document into a standard JSON string. You can format the output with tabs or spaces, or Minify it completely.

Yes. Use the Import File button to open a local .toml or text file, or just drag and drop the file directly onto the page.

If you enable Sort keys, the tool alphabetizes every table and object in your file recursively. This normalizes the layout and makes diffs predictable when saving the file into version control.

Explore Our Tools

Browse all tools