TOML Diff
BetaCompare 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
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?
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.