HCODX/YAML Diff
100% browser-based · js-yaml parser · Sorted keys

YAML Diff

Compare two YAML files in your browser. Both sides are parsed with js-yaml, re-emitted with sorted keys (optional), and line-diffed.

Before
After
Diff options
Open in JSON diff
Diff result
Left size
0 B
Right size
0 B
Changes
0
Status
Ready
Example

Structural compare for YAML

With normalize on, indentation and key order vanish from the output — leaving only the actual value changes.

Before
name: hcodx
version: 1
tags:
  - dev
  - tools
Diff
  name: hcodx
+ owner: alice
  tags:
    - dev
    - tools
+   - cli
- version: 1
+ version: 2
Use cases

What you'll use this for

YAML drives most modern infra — diffing two versions cleanly is essential.

Kubernetes manifest review

Diff two Deployment, Service, or ConfigMap manifests before applying.

GitHub Actions changes

Compare two versions of a workflow file to debug CI changes.

Config diff

Spot environment drift across prod/staging/dev YAML configs.

Helm chart compare

Review values.yaml changes between chart releases.

Step by step

How to diff YAML structurally

1

Paste before

Drop the original YAML into the left editor. Tabs are not YAML — use spaces.

2

Paste after

Drop the modified YAML into the right editor.

3

Keep normalize on

Both sides parse via js-yaml, sort keys, and re-emit with 2-space indent.

4

Copy or download

Save as yaml.diff or paste into your code review.

FAQ

Frequently asked questions

Both sides are parsed with js-yaml into JavaScript values, keys are sorted alphabetically at every level, and the result is re-emitted with 2-space indentation. The line diff then operates on the canonical form, ignoring whitespace and key-order noise.

The diff parses the first document only by default (yaml.load). Split multi-document YAML on --- and diff each one separately for clearer results.

Yes. Completely free, no signup, no limits. Both documents stay in your browser.

The parser surfaces the error inline in the diff output. Either fix it, or turn off normalize to fall back to a raw text diff. The YAML Validator shows line/column info for parse errors.

Click the swap arrows in the After header — it flips the two sides and re-runs the diff so additions and deletions switch roles.

About

About structural YAML diffing

A line diff over raw YAML gets noisy fast — reformatting, comment shuffles, or key reorders all show as changes even when the data is identical. Structural diff normalizes both sides through a real YAML parser first, then diffs the canonical form.

How normalization works

  • Both inputs are parsed with jsyaml.load.
  • Object keys are recursively sorted alphabetically.
  • Both sides are re-emitted with jsyaml.dump(value, { indent: 2, noRefs: true }).
  • The two normalized strings feed the line-based LCS diff.

Limits

  • Comments are dropped — js-yaml's dump doesn't round-trip them.
  • Anchors and aliases are resolved (noRefs: true) so they don't fool the diff.
  • Tags and explicit YAML types may be normalized to their JS equivalents.
Related

Related tools