T tomlkit·org
Inspect Formatter Validator Convert TOMLJSON JSONTOML TOMLYAML YAMLTOML INITOML TOMLINI .envTOML TOML.env TOMLTS Transform Sort keys Flatten Minify Compare Diff Merge

TOML Diff

updated 24 May 2026

Compare two TOML documents semantically — by tree, not by text. Whitespace, comments, and key order are ignored, so you see only the changes that actually affect the parsed config.

semantic · key-order-independent · whitespace-blind

Why a semantic diff

Running git diff on a TOML file is famously noisy. A re-formatter, a different editor, or a colleague's tab-vs-space preference rewrites the file and produces a diff full of changes that don't actually change the config. A semantic diff parses both documents into trees and compares values, so reordered keys, normalized quoting, and added blank lines all look identical.

Use this when reviewing a change to Cargo.toml, pyproject.toml, a Hugo config, or any TOML that has been auto-formatted somewhere along the way. The diff you see here is the diff that actually matters at runtime.

How to use it

  1. Paste the original TOML into the left pane (A).
  2. Paste the modified version into the middle pane (B).
  3. Click Compare (or wait — both panes auto-run as you type).
  4. The right pane lists changes: + added keys, - removed keys, ~ changed values.

Output format

Each line is one of:

  • + path.to.key = value — key exists in B but not A.
  • - path.to.key = value — key exists in A but not B.
  • ~ path.to.key followed by indented - old / + new — value changed.

Keys are sorted alphabetically to make multiple runs deterministic. A summary header tallies the counts.

Limits

  • Comments are not diffed. They're not part of the parsed value tree.
  • Array order matters. Two arrays with the same elements in different order are reported as changed. This is intentional — TOML arrays are ordered.
  • Both files must be valid TOML. Use the validator if a parse fails.

FAQ

Does it preserve which file each line came from?

Yes. The + always means "in B but not A"; - always means "in A but not B". The order in the controls bar (A on the left, B in the middle) matches.

Why is my "no-change" diff showing changes?

Most likely an array re-order or a numeric type shift (1 vs 1.0). The tool reports anything that would change the parsed tree, including type differences.

Can it diff three files?

Not directly. Run two pairwise diffs.