TOML Formatter

Parse and re-write TOML in a normalized layout with smol-toml. Errors show line and column. Note: comments are removed and some values are normalized.

TOML is parsed and written back out: comments are removed and values are written in a normalized form (for example, times get milliseconds).

Output

Runs entirely in your browser. Your data is never uploaded.

Related Tools

View All

What is TOML Formatter?

The TOML Formatter parses a TOML document and writes it back in a normalized layout: key = value with single spaces, tables separated by blank lines and arrays of tables written as [[name]]. It also acts as a TOML syntax checker. Because it re-serializes the parsed data, comments are removed and some values are rewritten in canonical form.

How to use TOML Formatter

  1. Paste TOML into the input box or click Load sample.
  2. Click Format (the output also updates while you type).
  3. If there is a syntax error, fix it at the reported line and column.
  4. Copy or download the result, and re-add any comments you need.

Example

Input
title="x"
[owner]
name="T"
Output
title = "x"

[owner]
name = "T"

When to use TOML Formatter

Use it to check TOML syntax or to normalize generated files. Do not use it on hand-maintained files whose comments you need (Cargo.toml, pyproject.toml) unless you re-add them, because comments cannot survive a parse/serialize round trip.

How TOML Formatter works

The document is parsed with smol-toml (TOML 1.0) into data and serialized again with stringify. Simple key/value pairs come first, followed by tables and arrays of tables. Strings are re-quoted, arrays are printed as [ 1, 2 ], and date-times are written in a normalized RFC 3339 form (for example 07:32:00-08:00 becomes 07:32:00.000-08:00).

Common Use Cases

  • Checking a Cargo.toml or pyproject.toml for syntax errors
  • Normalizing TOML produced by scripts
  • Converting inline tables into readable sections
  • Spotting duplicate keys or invalid values

Security Note

Everything runs locally in your browser; the code you paste is not uploaded.

FAQs

Why did my comments disappear?

The tool parses TOML into data and writes it back; comments are not part of the data, so they are lost.

Why did my date get .000?

Date-times are serialized in a canonical form with milliseconds.

Which TOML version is supported?

TOML 1.0.

Explore more categories