Skip to content

Developers

TOML Diff

TOML Diff

Beta

Compare two TOML files by parsed value and list added, removed and changed key paths, such as dependencies.serde. Key order, whitespace and comments do not count. Runs in your browser.

  • Free, no sign-up
  • Updated
  • Reviewed by Olgun Ozoktas
Before (A)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
After (B)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Both files are parsed and compared value by value. Key order, whitespace, comments and the choice between [table], dotted keys and inline tables never count as a change. Arrays are compared position by position.

Add two TOML files, then press Compare

Paste or drop the older file on the left and the newer one on the right, for example two versions of Cargo.toml or pyproject.toml. Load sample shows a Cargo.toml change.

Report

Runs in your browser; the files are not uploaded. Analytics and ads may load on the page.

Why Use TOML Diff?

A change to Cargo.toml, pyproject.toml or any other TOML config often looks bigger in a line diff than it is. A formatter reorders keys, a table moves, an inline table becomes a [section], and the real change, one version bump or one new dependency, is buried in the noise. TOML Diff parses both files and compares the values they hold, so it lists only the key paths that were added, removed or changed. Paste the before and after of a Dependabot pull request or a config change and read the answer as a short list of paths.

TOML Diff compares two TOML documents by the values they hold rather than by their text. Both sides are parsed into value trees and walked key by key. Every leaf value is reported at its TOML path, such as dependencies.serde, tool.ruff.line-length or servers[0].ip: a path found only in the After file is added, a path found only in the Before file is removed, and a path found in both with a different value is changed, shown as old value, arrow, new value. The number of unchanged values is counted too, and they are listed when Show unchanged paths is on.

Because the comparison works on parsed values, formatting never counts. Keys can be in any order, whitespace and comments can differ, and the same data can be written as a [table] header, as dotted keys or as an inline table. Arrays are compared position by position. Values are shown in the report as JSON, so a string keeps its quotes and a table that was added or removed whole shows all of its keys.

If either file is not valid TOML, the comparison stops with the parser's message and names the side that failed, with the line and column. TOML Diff does not merge files, does not fetch anything from crates.io, PyPI or any other registry, and does not upload the files. To convert TOML, use the JSON TOML Converter or the YAML TOML Converter.

How it compares

A line diff such as git diff or Diff Checker reports every moved key and every reformatted table, so a reordered Cargo.toml can look like a rewrite. TOML Diff reports only the values that changed, at their key paths. For JSON documents the same approach is in JSON Diff, and for .env files in Env Diff.

Tips for Comparing TOML

  • Paths use TOML notation: bare keys joined with dots, such as tool.ruff.line-length, and array positions in brackets, such as servers[0].ip. A key that needs quotes in TOML is quoted in the path.
  • Arrays are compared by position, so inserting an item at the start of an array shows every later item as changed.
  • A table that exists on only one side is listed once, at its own path, with its whole content as the value.
  • Values are compared with their type, so the string "1" and the integer 1 are different values.
  • Invalid TOML stops the comparison with the parser's message, the side that failed, and the line and column.

Frequently Asked Questions

How do I compare two TOML files?

Paste or drop the older file into Before (A) and the newer file into After (B), then press Compare. The page lists every key path that was added, removed or changed, with a count for each, and a single No differences message when the two files hold the same values.

Does key order or formatting count as a change?

No. Both files are parsed first, so key order, whitespace, comments and the choice between a [table] header, dotted keys and an inline table make no difference. Only a different value, or a key that exists on one side only, is reported.

How are arrays compared?

By position. Item 0 is compared with item 0, item 1 with item 1, and so on. Extra items at the end are reported as added or removed. Inserting or removing an item near the start of an array therefore shows the later items as changed, because they moved position.

What does a path like dependencies.serde.features[1] mean?

It is the TOML key path to the value: the features array inside the serde table inside the dependencies table, at position 1 (counting from 0). Keys that are not bare TOML keys, for example ones containing a dot or a space, are shown in double quotes.

Can I use it for Cargo.toml and pyproject.toml?

Yes. Any valid TOML file works, including Cargo.toml, pyproject.toml, Hugo and Netlify configs. Cargo.lock is TOML too, but it lists packages in an array, so a new package near the top shows many array positions as changed.

What happens if one file is not valid TOML?

The comparison stops and the message names the side that failed, with the line and column the parser reported and its reason, for example a duplicate key or an unclosed string. Fix that line and the result updates.

Does it merge the two files?

No. TOML Diff only compares. It lists the differences and leaves both files as they are.

Are my TOML files uploaded?

No. Both files are parsed and compared in your browser, and the text is not sent in any request. Analytics and ads may load on the page as on the rest of the site. The page does not look anything up on crates.io, PyPI or any other package registry.

Why does a whole table show as one added path?

When a table exists on one side only, it is reported once at its own path, with all of its keys as the value, instead of one line per key inside it. A table that exists on both sides is compared key by key.

Rate This Tool

0/1000

Get Weekly Tools

Suggest a Tool