About TOML Formatter
Paste messy or minified TOML and get clean, consistently formatted output. Normalises spacing around = signs, ensures blank lines between sections, and preserves comments. Works with all TOML features: tables, arrays of tables, inline tables, multi-line strings, and all value types.
Frequently Asked Questions
What is TOML?
TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write. It uses key = "value" pairs, [table] sections, and [[array of tables]] syntax. TOML is used by Cargo (Rust), pyproject.toml (Python), and Hugo configuration files.
What is TOML used for and why is it popular for configuration files?
TOML (Tom's Obvious Minimal Language) is used for configuration files in Rust projects (Cargo.toml), Python packaging (pyproject.toml), Hugo static sites, and many CLI tools. Its popularity comes from being easy to read and write, having a clear specification, supporting native datetime types, and being less whitespace-sensitive than YAML.
What are common TOML syntax errors?
Common errors: duplicate keys in the same table (not allowed); defining a key as both a scalar and a table; using integer values where strings are expected (TOML is typed — quotes required for strings); invalid datetime formats; and mixing array-of-tables ([[section]]) with inline tables incorrectly. The formatter reports the line and error type.
What is the difference between a TOML table and an inline table?
A regular TOML table is defined with a [section] header and spans multiple lines. An inline table is defined on one line: {name = "Alice", age = 30}. Inline tables must be complete — you cannot add more keys to an inline table later in the file. Regular tables are preferred for readability; inline tables are used for short, closely-related values.
How do I define a list of objects in TOML?
Use array-of-tables notation: [[servers]] followed by the keys for each server, then another [[servers]] for the next. Each [[servers]] header starts a new object in the array. This is equivalent to a JSON array of objects and is common for multi-environment configuration (dev, staging, prod).
Advertisement300 × 250
Advertisement300 × 250