YAML Diff and Compare

See what really changed between two YAML configurations. The structural comparison ignores key order, indentation and quoting style, and lists each changed path, such as spec.replicas.

Original
Changed

Nothing leaves your browser. Shortcut: Ctrl/⌘ + Enter runs the main action.

What is a YAML diff?

A YAML diff compares two YAML documents and shows how they differ. Configuration files for Kubernetes, Helm, Docker Compose, GitHub Actions, Ansible and OpenAPI are YAML, and the question when two versions disagree is usually "which setting changed?" rather than "which line changed?". This tool answers both: the structure comparison parses both files and lists changed paths, and the side-by-side view shows the lines with changed words highlighted.

How to compare two YAML files

  1. Paste or drop the original YAML on the left and the changed version on the right.
  2. Keep Compare structure to ignore key order, indentation, quoting and comments, or choose Compare text to diff the files as written.
  3. Use Hide identical lines to focus on the changes and Previous / Next to step through them.

Example: a Kubernetes change

# before                         # after
spec:                            spec:
  replicas: 3                      template:
  template:                          spec:
    spec:                              containers:
      containers:                        - name: web
        - name: web                        image: nginx:1.27
          image: nginx:1.25        replicas: 5

A line diff marks almost every line, because replicas moved to the end. The structural diff reports exactly two changes: spec.replicas 3 β†’ 5 and spec.template.spec.containers[0].image nginx:1.25 β†’ nginx:1.27.

What is ignored and what is not

Ignored in structure modeReported
Key order inside mappingsAdded, removed and changed keys
Indentation and flow vs block styleAdded, removed and changed list items
Quoting (a vs "a")Type changes ("5" vs 5)
Comments and anchorsValues that differ after resolving anchors

A string "5" and a number 5 are different values in YAML, and the diff says so. This catches a classic configuration bug where a quoted port or version is read as a string by one tool and a number by another.

Before comparing, check each file with the YAML validator if you are unsure it parses. To compare JSON files use the JSON diff.

YAML diff questions

Why use a YAML diff instead of git diff?

git diff compares lines, so re-indenting a block, reordering keys or switching quote styles shows up as large changes even though the configuration is the same. The structural YAML diff compares the parsed data and reports only real differences, with the path of each one.

Are anchors and merge keys taken into account?

Yes. Both files are fully resolved before comparison, so moving shared settings into an anchor and merging them with <<: *defaults is not reported as a change if the result is the same.

Can I compare multi-document YAML, such as Kubernetes manifests?

Yes. Each file's documents are treated as a list in order, and changes are reported with the document index first, for example [1].spec.replicas for the second document.

Do comments count as differences?

Not in structure mode, because comments are not part of the data. Use Compare text to see comment changes.

Can I compare a YAML file with a JSON file?

Yes. Each side is parsed with the right parser, so you can check that a generated JSON file matches its YAML source.