TOML Validator & Formatter

Validate TOML online. Check syntax, format, and convert to JSON with detailed error messages

Use this free TOML validator to check your TOML syntax instantly. Validate TOML online with detailed error messages showing the exact line and column where problems occur. Format, beautify, and convert TOML to JSON. Perfect for Cargo.toml, pyproject.toml, Hugo config, and application configuration files. 100% client-side. Your data never leaves your browser.

TOML
Formatted output will appear here

TOML Quick Reference

Data Types

string"hello" or 'hello'
integer42, 0xFF, 0o77, 0b1010
float3.14, inf, nan
booleantrue, false
datetime1979-05-27T07:32:00Z
array[1, 2, 3]
table[section]

Common Mistakes

key:valueUse = → key = value
[table.a]
[table]
Parent after child table
val = "un\closedUnclosed string literal
name = bare valStrings need quotes
[table]
[table]
Duplicate table headers

TOML Syntax Guide

What is TOML?

TOML (Tom's Obvious Minimal Language) is a minimal configuration file format that is easy to read due to its clear semantics. It is designed to map unambiguously to a hash table and should be easy to parse into data structures in a wide variety of languages.

TOML is widely used in projects like Rust (Cargo.toml), Python (pyproject.toml), Hugo, Deno, Starship prompt, Pipenv (Pipfile), and many application configuration files where clarity and simplicity are valued over flexibility.

TOML Structure

TOML is built on a few core concepts:

  • Key/Value Pairs: The basic building block. Keys are on the left of the equals sign, values on the right: key = "value"
  • Tables: Collections of key/value pairs defined by headers in square brackets: [table]. Dotted keys like [server.database] create nested tables.
  • Arrays: Ordered collections in square brackets: [1, "two", 3.0]. Arrays of tables use double brackets: [[products]]
  • Strings: Four types — basic ("..."), literal ('...'), multi-line basic ("""..."""), and multi-line literal ('''...''').

Unlike YAML, TOML does not rely on indentation for structure. Everything is explicit, making it less error-prone for configuration files.

TOML vs YAML vs JSON

TOML, YAML, and JSON are all popular data serialization formats, each with different strengths:

  • TOML vs YAML: TOML uses explicit = for assignment and [table] headers. YAML uses indentation. TOML is less error-prone because there's no indentation sensitivity. Both support comments.
  • TOML vs JSON: TOML supports comments (with #), has native date/time types, and is more human-readable for config files. JSON is more widely supported and better for data interchange.
  • When to use TOML: Configuration files where human readability and unambiguous parsing are priorities. Especially popular in Rust and Python ecosystems.
  • When to use YAML: Complex nested data, Kubernetes manifests, CI/CD pipelines. More flexible but more error-prone.
  • When to use JSON: API responses, data interchange between services, and when comments are not needed.

TOML Validation Rules

  • Keys must be on the left of =: key = "value" is valid. Bare keys can contain letters, digits, dashes, and underscores.
  • Values must have a type: Strings need quotes. Numbers, booleans (true/false), dates, arrays, and inline tables all have specific syntax.
  • No duplicate keys: Within the same table, keys must be unique. Redefining a key is an error.
  • No duplicate tables: Each [table] header can only appear once (except [[array_of_tables]]).
  • Strings must be closed: Opening quotes must have matching closing quotes. Multi-line strings use triple quotes.
  • Comments use #: Everything after # on a line is a comment. Comments must be on their own line or after a value.

Using This TOML Validator

This tool helps you validate TOML online quickly and accurately:

  • Validate: Checks if your TOML is syntactically correct and shows detailed error information if not.
  • Format: Validates and then pretty-prints your TOML with consistent formatting.
  • TOML → JSON: Converts your TOML to equivalent JSON format, useful for APIs and debugging.
  • Copy: Copies the current output content to your clipboard.
  • Clear: Clears the input area to start fresh.

When an error is found, you'll see the exact line and column number, plus a description of what went wrong. This makes debugging malformed TOML much easier than reading raw parser errors.

TOML Validator FAQ

What is TOML?

TOML (Tom's Obvious Minimal Language) is a minimal configuration file format designed to be easy to read. It maps unambiguously to a hash table and is used in Rust (Cargo.toml), Python (pyproject.toml), Hugo, Deno, and many other projects.

How do I validate TOML online?

Paste your TOML data into the input area above and click the Validate button. The tool will instantly check your TOML syntax and show either a success message or a detailed error with the exact line and column number where the problem occurred.

What makes TOML invalid?

Common TOML errors include: missing equals sign between key and value, unclosed string literals, duplicate table headers, duplicate keys within the same table, invalid date/time formats, and bare values that should be quoted strings.

Is my data safe when using this TOML validator?

Yes, completely safe. This TOML validator runs entirely in your browser using JavaScript. Your data is never sent to any server. All processing happens locally on your device.

Can I convert TOML to JSON?

Yes! Click the TOML → JSON button to convert your TOML data to JSON format instantly. This is useful when you need to use TOML configuration data in JSON-only systems or when debugging complex structures.

What is the difference between TOML and YAML?

TOML uses explicit key = value pairs and [table] headers, while YAML uses indentation for structure. TOML is designed to be unambiguous and simpler, while YAML is more flexible but more error-prone due to indentation sensitivity. Both support comments.

What is the difference between TOML and JSON?

TOML supports comments (with #), has native date/time types, and is more human-readable for configuration. JSON is stricter, more widely supported by APIs, but doesn't allow comments. TOML is designed for config files; JSON is designed for data interchange.

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

Yes, this tool validates the TOML syntax of any TOML file including Cargo.toml (Rust), pyproject.toml (Python), Hugo config.toml, and all other TOML configuration files. It checks TOML syntax correctness according to the TOML v1.0 specification.