{ }JSONKit.tools

YAML Diff — Compare Two YAML Files

Compare two YAML documents by what they mean, not how they are written. Quoting, indentation, key order and anchors stop mattering — only real differences show.

Left YAML

Right YAML

Diff

–

About this tool

Two YAML files can look completely different and hold identical data: keys reordered, scalars quoted one way or another, a block list rewritten in flow style. That is why a line diff of a manifest or a CI config is so often useless. This page parses both sides and compares the resulting structure, so what you see is the difference in the data. Comments and anchor names disappear in the process, because neither survives parsing.

How to use it

  1. 1Paste the two YAML documents into the left and right panels.
  2. 2Read the result as Split, Tree or List, and use the arrows to jump between changes.
  3. 3Turn on Changes only to fold away everything that stayed the same.

Frequently asked questions

›Why compare YAML structurally rather than line by line?

Because YAML has many ways to write the same data. Quoted or bare scalars, block or flow style, a key moved to a different position, indentation changed — a text diff paints all of it as a change. Parsing first means only real differences are reported.

›Are comments compared?

No. Comments are not data and do not survive parsing, so editing one produces no diff. If you need to review comments, use a text diff alongside this.

›What about anchors and aliases?

They are expanded before comparison, so a value written once and referenced twice compares as the value it resolves to. Changing an anchor name alone therefore shows nothing.

›Can I compare a YAML file against a JSON one?

Convert the JSON side with the JSON to YAML page and paste both here — or the reverse, and compare on the JSON Diff page. Both are the same comparison underneath.

›Is this useful for Kubernetes manifests?

That is the common case. Comparing a rendered manifest against the one in the cluster is exactly where key order and quoting noise makes a text diff useless.