How to compare two YAML files
Put the two versions in Original (A) and Modified (B), either by pasting them or by selecting Upload under the matching box. YAML Diff parses both inputs and reports Added, Removed, and Changed rows with a document number and path. Indentation, quote style, and mapping-key order do not affect value comparison. Sequence positions remain significant, and aliases plus merge keys are resolved before values are compared.
- Paste the first file into Original (A) and the second into Modified (B), or select Upload under the matching box. The file picker accepts .yaml, .yml, and .txt files.
- Enable Compare comments or Compare anchor names when those details should appear in the result.
- Check the Added, Removed, and Changed counts, then inspect Differences for the document number, path, node type, and value.
- Select the Added, Removed, Changed, Mapping, Sequence, Scalar, Comment, or Anchor filters. Choose Export JSON or Export CSV to save the rows that remain.
How YAML file comparison treats formatting
YAML Diff reads each input into a structure before comparing it. A change in spaces, quote marks, or mapping-key order does not create a Differences row.
Original (A)
name: "app"
replicas: 2
env:
- dev
Modified (B)
env:
- dev
- prod
name: app
replicas: 3
Differences
changed | scalar | 1 | $.replicas | 2 to 3
added | scalar | 1 | $.env[1] | prod
Changing the name key order and quote style does not create rows. Sequence items are compared by index, so moving an item can produce Changed rows at the affected positions. Scalar types are checked too, which means a number and a quoted string with the same characters can differ.
How to diff YAML files with anchors and comments
YAML Diff resolves aliases and merge keys before it compares values. A value referenced with *default or introduced through << is compared as the value it resolves to. Enable Compare anchor names to report a different anchor name on a corresponding node.
Comments stay out of the value comparison until you enable Compare comments. The result can then include Comment rows when comments attached to corresponding nodes differ.
A stream separated by --- is compared document by document. The Document column starts at 1. If a document exists on only one side, YAML Diff reports its root as Added or Removed.
How to read and export YAML Diff results
Each row has a Kind, Node type, Document, Path, and Value. Paths begin at $; mapping keys appear as $.spec.replicas, while sequence positions appear as $.env[1]. Changed rows show the old value followed by the new value.
Use the change and node-type checkboxes to narrow the table. Show all differences checks every filter again. Export JSON and Export CSV include the filtered rows with old and new values. Clear inputs empties both boxes, turns off the comparison options, and restores the filters.
If the parser cannot read an input, YAML Diff hides the comparison and shows an error with the side, document, and line when available. The comparison runs in the page, and the YAML text is not sent to a server.
Where YAML Diff comes up
- For a deployment change, place the earlier configuration in Original (A) and the edited configuration in Modified (B), then review paths such as
$.replicas. - For two environment files, filter for Added and Removed Scalar rows before exporting the selected differences.
- For a multi-document manifest, use the Document column to separate changes in each YAML document.
Choose the right config comparison page
Use YAML Diff when both inputs are YAML and you need parsed paths, structural changes, or document-by-document results. The Config File Compare Tools category lists other config-file comparison pages for a different input format or comparison task.
Frequently asked questions
Can I compare two YAML files with different indentation?
Yes. YAML Diff parses both files before comparing them, so indentation, quote style, and mapping-key order do not create differences.
Does YAML Diff ignore list order?
No. Sequence items are compared by position, so moving an item can produce Changed rows at the affected indexes.
How do I compare YAML files with anchors or merge keys?
Paste or upload both files. YAML Diff resolves aliases and merge keys before comparing values. Enable Compare anchor names to include anchor-name changes.
Can I diff YAML files with multiple documents?
Yes. Documents separated by --- are compared by position, and each difference has a document number. A document on only one side is Added or Removed.
Are YAML files uploaded when I compare them?
No. Parsing and comparison run in the page, and the YAML text is not sent to a server.