02 / YAML / yaml-diff
YAML Diff
Compare two YAML documents structurally.
How to use
- 01Paste the original document into YAML A and the changed version into YAML B.
- 02Press Compare.
- 03Read the Differences panel. Each entry is labeled added, removed or changed and shows the path to the value, such as $.version or $.tags[1].
- 04For changed values, compare the old value (marked −) with the new one (marked +).
- 05If either side has a syntax error, an Invalid YAML note shows the message and position. Fix it and compare again. Use Clear to empty both inputs.
What is this tool?
This YAML diff compares two documents by their parsed data rather than line by line. Reordered keys, different indentation, quoting style and comments don't create noise. You see only real changes to keys and values, each with a JSONPath-style path. The comparison runs locally in your browser, so production configs and secrets are never uploaded.
Structural diff vs text diff for YAML
A text diff compares lines, so re-indenting a file, sorting its keys or switching from [a, b] to a dash list makes nearly every line look changed. A structural diff parses both sides and walks the data. For example, version: 1 and version: 2 are reported as one changed value at $.version. If B adds a second tag and an owner key, those show up as added at $.tags[1] and $.owner. Moving a key from the bottom of a mapping to the top produces no difference at all.
When both documents are structurally identical, the panel says so explicitly. That's a quick way to confirm that a reformatted or regenerated file has the same meaning as the original. Removed keys show their old value and added keys show their new value, so you can read the panel without switching back to the inputs.
How lists and types are compared
Lists are compared position by position, not by matching similar items. Inserting an item at the start of a list therefore shows every later item as changed, plus one added at the end. When order doesn't matter to the consuming tool, sort both lists the same way before comparing to cut down the noise.
The diff compares parsed values, so types matter. replicas: 3 and replicas: "3" are reported as a change from a number to a string, a real difference that can break a Kubernetes manifest. Anchors and aliases are expanded before comparing, so a value reached through an alias is compared like any other. Each side must contain a single YAML document. Compare multi-document files one document at a time.
Common use cases
- Reviewing what actually changed between staging and production values.yaml files
- Confirming that a reformatted or regenerated manifest has the same meaning as the original
- Spotting a number that became a string, such as port: 80 versus port: "80", after a hand edit
- Comparing a rendered Helm template against the manifest currently deployed
- Checking CI workflow changes in a pull request without whitespace and key-order noise
FAQ
How do I compare two YAML files?
Paste one into YAML A and the other into YAML B, then press Compare. Every difference is listed with its path and labeled added, removed or changed.
Does key order or indentation affect the comparison?
No. Both documents are parsed first, so reordered keys, indentation, quoting style and comments aren't reported as differences.
Why does inserting one list item show many changes?
Lists are compared by index, so every item after the insertion point shifts position and is reported as changed. Sort lists consistently before comparing if order doesn't matter.
Can I diff multi-document YAML?
Not in one pass. Each input must be a single document, so split files with --- separators and compare each document separately.
Are my YAML files uploaded?
No. Parsing and comparison run entirely in your browser.