YAML Diff: Compare Two YAML Files Online

Original YAML
Changed YAML

Paste two YAML documents and get a precise side-by-side diff. Built for Kubernetes manifests, GitHub Actions workflows, Helm values, and docker-compose files.

What is the YAML diff tool?

Paste two YAML documents here and the tool shows, character by character, where they differ. Your current manifest goes on the left and the edited one on the right. The text stays in your browser unless you click Share, which matters when you are diffing manifests that contain secret refs or internal hostnames.

The diff is character-level, the same engine our text diff tool uses. The editor shows your YAML as plain text with no syntax colouring, so the only colours on screen are the red and green of the diff. What it does check is the rule that breaks most hand-edited files: the YAML 1.2.2 specification forbids tabs as indentation, and the validation badge flags the first one it finds.

If you have ever stared at a 400-line Helm values.yaml diff in a pull request and tried to find the one indentation slip that broke the chart, this is where it stops being a hunt: the line with the extra space is the one highlighted. It is also useful when copy-pasting between Slack and your editor mangles tabs, which YAML refuses to accept.

How the YAML diff works

Lines are lined up first, then each edited line is compared character by character, so a value that went from 2 to 3 is highlighted on its own and the key next to it is not. A cleanup pass keeps those highlights on whole words rather than scattered letters. Removed text is red on the left, added text green on the right.

YAML has parsing rules that bite people who treat it like a forgiving format. Indentation is structural per the YAML 1.2.2 spec, so a single misplaced space changes the document tree. Tabs are forbidden as indentation, and the parser will reject them outright. Implicit typing turns the unquoted token NO into the boolean false in YAML 1.1, which is the famous Norway problem: country code lists silently lose Norway. YAML 1.2 narrowed the rules so only true, false, null and numeric forms convert without quotes, but plenty of tools still parse 1.1.

If you have already converted your YAML to JSON for a downstream consumer, our JSON diff tool handles structural concerns like key ordering and canonicalisation. JSON is a strict subset of YAML 1.2, so any valid JSON document is also valid YAML. That compatibility is documented in the spec, and it is why js-yaml and libyaml can both round-trip JSON without surprises.

How to compare YAML in three steps

You need no account, and nothing is uploaded unless you share.

  1. 1

    Paste or upload your YAML

    Start with the YAML you trust on the left and the changed copy on the right. Or click Upload on either side to load a .yaml or .yml file directly. Sample loads a small Kubernetes Deployment into both panes.

  2. 2

    Check the indentation matches your intent

    YAML uses spaces only for indentation, never tabs. If you pasted from a chat client or a terminal that converted spaces into tabs, YAML parsers will reject the file. The validation badge flags a tab used for indentation and gives its line and column, and Format strips trailing spaces, so both are easy to clean up before they cause a deploy to fail.

  3. 3

    Read the diff

    Deletions appear in red on the left, insertions in green on the right. Both panes scroll in lockstep so you can follow long manifests without losing your place, and the up and down arrows jump from one change to the next.

Common reasons to diff YAML

Comparing Kubernetes Deployment specs across staging and prod

Run kubectl get deployment web -o yaml in both clusters and diff the output. Often prod still has replicas: 2 and an old image tag because a sprint-end rollout never reached it, and a text diff is the fastest way to confirm that before you re-run kubectl apply. The Kubernetes object model is YAML through and through, so this is the everyday case.

Diffing GitHub Actions workflow YAML

When a workflow stops triggering after a branch rename or a job suddenly takes 8 minutes longer, diff .github/workflows/ci.yml against the previous green commit. The culprit is usually a changed on: filter, a removed cache: key in actions/setup-node, or a matrix entry that quietly went from node-version: "18" (string) to node-version: 18 (number) and tripped the type checker.

Reviewing docker-compose env changes before a deploy

Diff docker-compose.yml against the version in main to verify which environment: entries you changed. People paste a list of new env vars and forget that one of them was already set under a different service, so the override silently flips a flag elsewhere. The diff makes it obvious.

Tracking Helm chart values.yaml across releases

When upgrading a chart from 1.8.0 to 2.0.0, diff your values.yaml against the new defaults the maintainer published. Helm merges values key by key, so a renamed top-level key (image.tag moving under image.repository) silently falls back to the chart default. The diff surfaces the rename before helm upgrade rolls out a regression.

OpenAPI and Swagger YAML schema review

A 3,000-line openapi.yaml diff is unreadable when a code generator reorders paths alphabetically. Compare versions side by side and the actual change surfaces: a required field added to a request schema, or a response whose type quietly switched from string to integer. Easier than digging through a generated SDK to find why the build broke.

Ansible playbook diffs across environments

When a playbook works in dev and fails in prod, diff the inventory or the role defaults/main.yml between the two. A common cause is a hostvar that was never copied across, or a become: yes that was set on the role in dev but on a single task in prod. Side by side, that one line is hard to miss.

YAML quick reference

YAML behaviour that catches people out, based on the YAML 1.2.2 spec and on what real parsers do.

TopicWhat this tool does
Indentation Spaces only, and the count is structural. Two and four spaces are both common; pick one per file and stay with it. The YAML overview on Wikipedia has a good summary if you want the history.
Tabs Forbidden as indentation per the spec. Allowed inside scalar values. If your editor inserts a tab on Enter, configure it to use spaces for .yaml and .yml files.
Anchors and aliases &name defines an anchor; *name references it. Useful for repeating large blocks like container env vars or default service config without copy-paste.
Merge keys <<: *base merges the referenced mapping into the current one. A YAML 1.1 feature. Most parsers including libyaml still accept it; the YAML 1.2 spec dropped it.
Multi-document files Three dashes (---) separate documents in a single stream. Useful for piping multiple Kubernetes objects through one kubectl apply -f. ... ends a document.
Block scalars | preserves newlines (literal); > folds them into spaces. Modifiers - and + control trailing newlines. Use | for shell scripts, > for long human prose.
The Norway problem Unquoted NO, YES, ON, OFF become booleans in YAML 1.1. Quote them, or use a 1.2 parser. See the YAML type definitions for which strings convert.
Encoding UTF-8 is required by the YAML 1.2 spec. UTF-16 is permitted with a BOM. Tools in practice expect UTF-8 without a BOM, so save your files that way to avoid surprises.

YAML diff: frequently asked questions

Does YAML's whitespace-sensitivity help or hurt the diff?

YAML is whitespace-sensitive, so a regular text diff is already useful: any indentation change is a structural change, and the diff catches it. What this page adds is a tab check: the validation badge flags any tab used for indentation, with its line and column, and Format strips trailing spaces that would otherwise show up as invisible changes. The underlying diff algorithm is the same as our online text compare tool.

Why is YAML so picky about indentation and spaces?

Because indentation is the only thing telling the parser which keys belong to which mapping. The YAML 1.2.2 spec defines the indentation level of a node by the count of leading spaces, and forbids tabs as indentation. A single extra space promotes a key into a sub-mapping. That strictness is the price for a format that does not need braces or commas, and it is why you see indentation bugs more often in YAML than in JSON.

Why did my list of country codes lose Norway?

YAML 1.1 implicit typing turns the unquoted token NO into the boolean false. So a list of country codes that includes NO for Norway silently becomes a list with one entry replaced by false. The same applies to YES, ON, OFF, and similar. StrictYAML documents this in detail. The fix is to quote the value ("NO") or use a parser that follows YAML 1.2, which only converts true, false, and null implicitly.

How do anchors, aliases and merge keys work?

An anchor (&name) marks a node so you can reference it later with an alias (*name), avoiding repetition in long files. The merge key (<<: *name) was a YAML 1.1 extension that copies all keys from the referenced mapping into the current one, useful for sharing common config across services. Merge keys are not part of YAML 1.2, but most parsers including js-yaml still support them for compatibility. The diff treats anchors and aliases as plain text, so a renamed anchor shows up cleanly.

Can I paste JSON into the YAML diff tool?

Yes. JSON is a strict subset of YAML 1.2, so any valid JSON document is also a valid YAML document. You can mix the two if you really want to, dropping a JSON-style flow collection into a block-style file. For pure JSON work, our JSON diff tool has format and validate buttons that are JSON-aware, including pretty-print and sort-keys.

Why does the parser reject my file when I use tabs?

Because the YAML spec bans them for indentation. The 1.2.2 spec gives portability as the reason: a tab may never be used to indent. Tabs are allowed inside scalar values (a string can contain a tab), just not at the start of a line where indentation is being measured. The fix is a quick find-and-replace from tab to two or four spaces, depending on the convention your file already uses.

Does this expand YAML anchors when comparing two files?

No. The diff is text-level, so an anchor like &base on one side and the inlined-equivalent mapping on the other will diff as different text even though a YAML parser would resolve both to the same node. The same applies to a *base alias versus its expanded form. If that's the comparison you actually want, pre-resolve anchors before pasting: pipe through yq with yq 'explode(.)' to expand anchors, or run the file through yq -P for canonical pretty-print on both sides.

How does this handle multi-document YAML with multiple --- separators?

Each --- starts a new document in the stream, per the YAML 1.2.2 spec. The diff sees the whole stream as one blob, so reordering documents will look like a wholesale change even when the set of objects is identical. This bites with Helm output, Kustomize builds, and Kubernetes kubectl apply -f bundles. The pragmatic move is to split on ---, sort the document blocks, and diff each pair separately, or run yq ea '[.] | sort_by(.kind, .metadata.name)' across all docs to canonicalise order before pasting.

Why does this flag explicit type tags (!!str, !!int) as different from implicit values?

Because the diff is text-level and value: no is not the same string as value: !!str no, even if a parser would treat them identically in some cases. The semantics also depend on YAML version. YAML 1.1 implicit typing turns no into false and country code NO into the boolean false: the Norway Problem. YAML 1.2 narrowed implicit booleans to just true and false. If you're comparing files round-tripped through Ruby psych (1.1 by default) and PyYAML's yaml.safe_load (1.2 via current libyaml), normalise both sides to explicit tags first and the surprise diffs go away.

Does the YAML diff cost anything?

No. It is free, it needs no account, and there is no limit on how many manifests you compare. Ads on the page pay for the hosting. The tab check, Format, Upload and the diff all work without signing in, and Copy and Download give you the pane contents exactly as they are, so nothing gets slipped into your manifests on the way out.

What makes this different from other online YAML diff tools?

The comparison runs entirely in your browser, so your YAML is never uploaded unless you press Share. Plenty of online diff tools POST it to a server first, which is a real concern for manifests holding secret refs or internal hostnames. The highlighting is character-level rather than whole-line, so a single flipped boolean or a one-space indentation change shows up exactly, instead of marking the whole line as changed.

Can it compare two YAML files I upload?

Yes. Click Upload on either pane to load a .yaml or .yml file straight from disk, rather than pasting. You can upload one side and paste the other, or upload both. Files are read locally in the browser and never sent anywhere. Since indentation is significant in YAML, uploading keeps the original spacing intact instead of risking a paste that mangles tabs.

Can I compare more than two YAML files at once?

Not in a single view. It is built for two sides, original and changed, which matches how manifests move through a pipeline. If you have three or more versions, compare them in pairs: v1 against v2, then v2 against v3. For multi-document YAML with several --- separators inside one file, the diff reads the whole stream as one blob, so split and sort the documents first if order is noise.

Is it safe to paste sensitive YAML like Kubernetes secrets or config?

Safer than most, because the editor, the tab check and the diff all run locally: no upload, no logging of your input, no cloud round-trip. The exception is Share, which stores both panes on our servers to make the link work, so do not share a manifest that holds real credentials. If you want to check, the browser Network panel shows no request with your YAML in it while you compare. That said, base64 values in a Secret are not encrypted, so use the same care you would with any plaintext.

Privacy and how this works

Your YAML stays in your browser unless you choose Share. The editor, the tab check and the diff all run on your machine, and nothing you paste is logged. The format we follow is the YAML 1.2.2 specification. Anyone doubtful can watch the request list in DevTools during a compare and look for their own keys; they never appear.