Input TOML

Formatted TOML

What Is the TOML Formatter?

You're editing a Cargo.toml, a pyproject.toml, or maybe a GitHub Actions config — and the indentation is all over the place. TOML (Tom's Obvious Minimal Language) is a human-friendly config format used by Rust, Python, and many modern tools. The formatter reads your TOML per the TOML 1.0 spec and outputs it with consistent indentation, spacing, and structure — making it easy to review in a pull request or hand to a teammate.

This tool runs entirely in your browser. Nothing is sent to a server. Paste TOML or upload a file; get formatted output. For validation, use TOML Validator. For conversion to JSON, use TOML to JSON. For JSON to TOML, use JSON to TOML.

TOML Formatting Examples

Format TOML for consistent spacing. Telecom-themed example:

Example: Subscriber config

Input

Formatted output:

Output

Click the Sample button above to load more examples into the editor.

How to Use This Tool

1

Paste or Upload

Paste TOML into the left panel or upload a .toml file. Use Sample to load example config. Use Clear to reset.

2

Check the Output

The right panel shows formatted TOML with proper indentation. Invalid TOML will show an error.

3

Copy or Download

Use Copy or Download to get the result. For conversion, use TOML to JSON, TOML to YAML, or TOML to XML.

When the TOML Formatter Helps

When editing Cargo.toml (Rust), pyproject.toml (Poetry), or other config files, formatting makes structure clear. Great for debugging, code review, and readability. For validation before committing, use TOML Validator.

Frequently Asked Questions

Is my TOML data sent to a server?

No — formatting runs entirely in your browser using JavaScript. Nothing is sent to any server. You can verify this by opening your browser's Network tab while using the tool.

Does it support TOML 1.0?

Yes. The tool supports the full TOML 1.0 specification including tables, arrays of tables, inline tables, and multiline strings.

What's the difference between a TOML formatter and a TOML validator?

The formatter reformats valid TOML into consistent indentation and spacing. The validator checks syntax and reports specific errors. For best results, format first, then validate before committing.

Can I format Cargo.toml or pyproject.toml files?

Yes. This formatter works with any valid TOML file — paste the content or upload the file directly. Great for Cargo.toml (Rust), pyproject.toml (Python/Poetry), and any other TOML-based config.

Are comments preserved?

Yes. Comments are preserved during formatting. The structure is reindented for clarity without losing any inline or block comments.

Related Tools

For TOML, see toml.io and TOML spec. For related formats, see JSON spec and YAML. For tools using TOML, see Cargo, Poetry, and TOML GitHub.