Loading TOML Formatter...

How to Format TOML - Step by Step Guide

Step 1

Input Your TOML Configuration

Get your TOML configuration into the formatter! Whether you're working with Cargo.toml files, Python pyproject.toml, or any other config file:

•
Paste directly: Copy your TOML configuration and paste it into the input editor
•
Upload a file: Click "Upload" to select a .toml file from your computer
•
Try the sample: Click "Sample" to load example TOML configuration

Example: Unformatted TOML Input

Here's what messy, unformatted TOML looks like:

[package]
name   =   "my-app"
version="1.0.0"
edition=   "2021"
[dependencies]
serde=   "1.0"
tokio = { version = "1.0", features = ["full"] }
Step 2

Automatic Formatting & Validation

As soon as you paste, the file is checked against the TOML v1.0.0 specification and, if it is valid, the layout is cleaned up:

•
Checks the syntax: Invalid TOML stops here with the line and column of the problem instead of a formatted result
•
Evens out the spacing: One space on each side of every equals sign, and a blank line between tables
•
Leaves your values alone: Numbers, dates and strings come out byte-for-byte — it works on the text, never re-serializing

Example: Beautifully Formatted Output

The same TOML, now properly formatted and readable:

[package]
name = "my-app"
version = "1.0.0"
edition = "2021"

[dependencies]
serde = "1.0"
tokio = { version = "1.0", features = ["full"] }
Step 3

Choose Format Options

Customize your output based on your needs! The formatter gives you control over how your TOML appears:

•
Pretty format: Default beautified TOML with proper spacing and organization
•
Minify: Remove comments and extra whitespace for compact files
•
Copy or download: Use the Copy button to copy to clipboard or Download to save as a .toml file

Frequently Asked Questions About TOML Formatting

What is TOML and why format it?

TOML (Tom's Obvious, Minimal Language) is a configuration file format that's easy for humans to read and write. It's widely used in Rust (Cargo.toml), Python (pyproject.toml), and many other projects. Formatting TOML ensures consistent syntax, proper spacing, and makes configuration files easier to maintain and share with team members.

How does the formatter check my TOML?

Before it formats anything, the file goes through a real TOML 1.0 parser. It catches the usual mistakes — a text value without quotes, a number with a leading zero, null (TOML has no null), a key or table defined twice, an unterminated string — and shows the line and column so you can jump to it. When the file is valid, the layout is tidied and your data is left untouched.

Can I use this for Cargo.toml and pyproject.toml files?

Yes. It handles any valid TOML file: Cargo.toml for Rust, pyproject.toml for Python, and whatever config files your own tools use.

What's the difference between formatting and minifying TOML?

Formatting keeps the file readable: it standardizes the spacing around equals signs and puts a blank line between tables. Minify goes the other way and strips comments and blank lines for a smaller file. Either way the values stay exactly as you wrote them, so numbers, dates and strings in your TOML never change.

Is my TOML configuration safe to paste here?

Everything runs in your browser. Your TOML is never uploaded and nothing is kept — reload the page and the editor starts empty. That makes it fine for configs with credentials or API keys, though it is still good practice to strip secrets before sharing a file publicly.

Can I convert between TOML and other formats?

Yes! We offer several conversion tools: TOML to JSON for converting to JSON format, JSON to TOML for converting from JSON, YAML to TOML and TOML to YAML for YAML conversions, and TOML Validator for validation with detailed statistics.