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
- Paste or drop the original YAML on the left and the changed version on the right.
- Keep Compare structure to ignore key order, indentation, quoting and comments, or choose Compare text to diff the files as written.
- 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 mode | Reported |
|---|---|
| Key order inside mappings | Added, removed and changed keys |
| Indentation and flow vs block style | Added, removed and changed list items |
Quoting (a vs "a") | Type changes ("5" vs 5) |
| Comments and anchors | Values 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.