TOML Formatter & Validator

Format, validate, and convert TOML — used in Rust (Cargo.toml), Python (pyproject.toml), and more

TOML Input

TOML Formatter & Validator

Format, validate, and convert TOML — used in Rust (Cargo.toml), Python (pyproject.toml), and more

Features

  • Parse TOML and emit clean, normalised output
  • Supports tables `[section]`, arrays-of-tables `[[section]]`, inline tables, nested arrays
  • TOML number formats: decimal, hex (`0x`), octal (`0o`), binary (`0b`), with underscore digit separators (`1_000_000`)
  • Dates / times: TOML date / time / datetime literals
  • Hand-rolled parser — most valid TOML works; very exotic edge cases may need a full library

How to use

  1. Paste your TOML content in the input panel.
  2. Click Format & Validate.
  3. Switch between TOML and JSON output tabs.
  4. Copy the result using the Copy button.

Tips & Best Practices

  • Underscore digit separators (e.g. `1_000_000`) are valid TOML and now parse correctly.
  • Inline tables like `point = { x = 1, y = 2 }` are supported; nest them at most 1-2 deep for readability.
  • Arrays-of-tables (`[[products]]`) are the canonical pattern for repeating sections like config arrays.
  • For very large / complex TOML, validate with `taplo` or `@iarna/toml` in your build pipeline.
  • Strings can be basic (`"..."`), literal (`'...'`), multi-line basic (`"""..."""`), or multi-line literal (`'''...'''`).

FAQ

What is TOML?

TOML (Tom's Obvious Minimal Language) is a configuration file format used by Rust (Cargo.toml), Python (pyproject.toml), Hugo, and many other tools.

Can it convert TOML to JSON?

Yes, click the JSON tab in the output panel to see the JSON equivalent of your TOML file.

Is my data private?

Yes, all processing happens in your browser. No configuration data is sent to any server.

How is TOML different from YAML or JSON?

TOML is designed to be unambiguous and human-readable, with explicit syntax for tables, arrays, and dates — unlike YAML, which has indentation pitfalls, or JSON, which lacks comments. This makes TOML especially well-suited to configuration files where humans edit by hand.

Does the formatter validate my TOML?

Yes, parsing errors are surfaced inline with the offending line and column. Invalid syntax (duplicate keys, malformed dates, unterminated strings) will produce an error message rather than silent failure.

Can I convert JSON to TOML as well?

Yes, the converter works both ways — paste JSON and switch the direction toggle to produce equivalent TOML. Note that TOML cannot directly represent JSON null values, so those are dropped or commented out during conversion.

Are TOML date and time types preserved?

Yes, TOML's native datetime types (offset, local, date-only, time-only) are parsed and preserved through formatting. When converting to JSON they are emitted as ISO 8601 strings since JSON has no native date type.