Skip to content
UniKit

YAML diff

Compare two YAML documents and list added, removed, changed and moved entries by path (a.b[0].c), with a side-by-side view and statistics. Invalid YAML reports the exact line and column.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Summary

Fill in both sides to see the differences

What this tool does

  • Review a Kubernetes, Docker Compose or CI config change before shipping and confirm only the intended fields moved.
  • Compare staging and production YAML side by side to see which keys exist on one side only and which values changed.
  • Turn a config diff into a readable path/value list when reviewing someone else's pull request — nested changes are much harder to miss than in a line diff.
  • Check whether an array was reordered by accident: insertions and deletions are reported separately from genuine element moves.

Example

Input

server:
  host: localhost
  port: 8080
tags:
  - a
  - b

--- 右侧(改动后)---

server:
  host: 0.0.0.0
  port: 8080
tags:
  - b
  - a

Output

~ server.host  "localhost" → "0.0.0.0"
> tags[1] → tags[0]  "b"
> tags[0] → tags[1]  "a"

The two documents in the example go into the left and right input boxes. server.port is identical on both sides so it never appears in the diff; paths use the a.b[0].c form and swapped array elements are marked as moves with both the old and the new path.

Frequently asked questions

How is this different from a plain text diff?

A text diff compares characters and lines, so reordering keys or changing indentation shows up as a difference. This tool parses both sides into YAML values first and compares the structures, so a reordered key never shows up and every reported row is a real field change.

How do you decide that an array element "moved"?

The two arrays are aligned with a longest-common-subsequence pass over element signatures. If one side is a subsequence of the other, the index shifts are just insertions or deletions and are not reported as moves. Only elements that need to be re-paired count as moved, so inserting an item never marks the whole tail as moved.

What happens if the YAML is malformed?

Parsing throws invalid-yaml and the matching input box shows the line, column and reason reported by js-yaml instead of a generic error. Either side can be invalid without clearing the other one.

Are anchors and dates supported?

Parsing uses the js-yaml Core schema with the merge-key and timestamp tags enabled, so anchors, aliases, merge keys (<<) and dates all work. Each input box holds one document; multi-document files are rejected the same way js-yaml rejects them.

Is my input uploaded anywhere?

No. Parsing and comparison run entirely in your browser with JavaScript, the page makes no network requests, and it keeps working with the network disconnected.

Keywords:yaml diffyaml 对比yaml 差异yml diffcompare yamlyaml 比较配置对比diff结构化对比side by side

Related tools