TOML Formatter & Validator
Guide
TOML Formatter & Validator
TOML (Tom’s Obvious Minimal Language) has become the go-to config format for Rust projects (Cargo.toml), Python packaging (pyproject.toml), and plenty of other tools. It’s designed to be human-readable, but hand-edited config files inevitably drift — inconsistent spacing, jumbled key ordering, and subtle syntax errors that only surface at build time.
This tool parses your TOML client-side, validates it against the spec, and re-emits it with clean, consistent formatting. It also converts TOML to JSON for quick interop checks. Nothing leaves your browser.
How to Use
Paste your TOML content into the input area or try one of the built-in examples (Cargo.toml, pyproject.toml). Select your indentation preference, toggle alphabetical key sorting if desired, and the formatted output appears instantly. Use the JSON tab to see the parsed structure as JSON. Copy or download the result with one click.
Features
- Syntax Validation – Catches errors with line numbers and descriptive messages before they break your build
- Consistent Formatting – Normalizes indentation, spacing around equals signs, and blank lines between tables
- Key Sorting – Optionally alphabetize keys within each table for predictable ordering
- Configurable Indentation – Choose 2 or 4 spaces to match your project conventions
- TOML to JSON Conversion – See your config as JSON for quick debugging or API integration
- Built-in Examples – Load sample Cargo.toml or pyproject.toml configs to test formatting instantly
- Client-Side Processing – Your configuration files stay in your browser — nothing is sent to a server
When to Use This Tool
Run your TOML through the formatter before committing config changes, when merging configs from multiple contributors, or when migrating between TOML versions. The JSON conversion is particularly useful when you need to feed TOML-based configs into JSON-only tools or APIs.
FAQ
-
What is TOML and how does it differ from YAML and JSON?
TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write. Unlike YAML, TOML avoids significant whitespace and complex nesting that causes subtle bugs. Unlike JSON, TOML supports comments, has native date/time types, and is more human-friendly for config files. TOML trades some of YAML's flexibility for predictability — there's generally only one way to express something in TOML.
-
What is a TOML table and how do inline tables differ?
A TOML table is a collection of key-value pairs under a header like [package] or [dependencies]. Tables can be nested using dotted headers like [server.database]. Inline tables are a compact single-line syntax using curly braces: key = { name = 'value', version = '1.0' }. Regular tables are better for readability with many keys, while inline tables work well for small, closely related groups of values.
-
Why do Rust projects use Cargo.toml instead of JSON or YAML?
Rust chose TOML for Cargo because it strikes a balance between human readability and machine parseability. TOML's explicit typing (strings, integers, booleans, dates) reduces ambiguity that plagues YAML (where 'no' can be interpreted as a boolean). Its comment support is essential for documenting dependency choices. The format's simplicity also means fewer parsing edge cases and more predictable behavior across different tools and editors.
-
What are array of tables in TOML?
Array of tables use double brackets [[table_name]] to define multiple instances of the same table type. For example, [[bin]] in Cargo.toml defines multiple binary targets. Each [[bin]] block adds a new element to an array. This is TOML's way of representing arrays of objects without the visual noise of JSON arrays or YAML's dash-based lists.
-
How does pyproject.toml work for Python packaging?
pyproject.toml is Python's standardized project configuration file (defined in PEP 518 and PEP 621). It replaces the older setup.py and setup.cfg approach. The [build-system] table specifies build requirements, [project] contains metadata like name, version, and dependencies, and [tool.*] tables hold configuration for specific tools like pytest, black, or mypy. This consolidates multiple config files into one standard location.
Install Our Extensions
Add IO tools to your favorite browser for instant access and faster searching
恵 Scoreboard Has Arrived!
Scoreboard is a fun way to keep track of your games, all data is stored in your browser. More features are coming soon!
