JSON COMPARE

Compare Files Online

Compare two files without picking a format first. JSON, XML, YAML, and CSV are detected automatically, auto-formatted for a clean comparison, and diffed structurally — by property, tag and attribute, or row and column, depending on what you give it.

Detected format: Text
Load sample:

Original document

0 lines

Document to compare against

0 lines

More about comparing files

Supported formats, how it works, and frequently asked questions.

+

One tool, four structured formats

Each format is compared according to its own structure, not flattened into generic text.

JSON

Compared by property path, the same way JSON Compare works — key order never causes a false difference, and nested objects and arrays are walked recursively.

XML

Parsed into its tag and attribute structure, so a changed attribute or a renamed element is reported precisely instead of as one giant block of altered markup.

YAML

Read the same way a YAML parser would — through indentation, lists, and mappings — so config files can be compared by the settings they actually define.

CSV

Read as rows and columns using the header row as field names, so a single changed cell is reported by row and column instead of the whole line being marked different.

Built to skip the format-picking step

Auto-detects the file type

Paste or drop two files and the comparison figures out whether you're working with JSON, XML, YAML, or CSV — from the file extension when you upload, or from the content itself when you paste.

Auto-formats before comparing

Whatever indentation, quoting, or line breaks the original files used, both sides are parsed and re-printed consistently before anything is compared — so formatting differences never masquerade as real changes.

Structural, not just textual

Once the format is known, the comparison understands its shape: JSON and YAML by property, XML by tag and attribute, CSV by row and column — not a flat wall of red and green text.

Falls back gracefully

If a file doesn't parse cleanly in the detected format, the comparison drops back to a line-by-line text diff automatically, so a syntax error never blocks you from seeing what changed.

How the comparison works

1

Add both files

Paste content directly, drag a file onto either panel, or click Upload file. Nothing leaves your browser at this stage.

2

Let it detect the format

The file type is detected automatically and shown above the panels. Each side is validated against that format, so you'll see immediately if one file doesn't match.

3

Read the result

Both files are auto-formatted and compared structurally where possible, with every addition, removal, and change traced back to exactly where it happened.

Other comparison tools

Already know exactly what you're comparing? JSON Compare and Text Compare skip detection entirely and go straight to the panels.

Learn more about comparing files

Comparing files without picking a tool first+

Most online diff tools ask you to choose a mode before you've even pasted anything in — JSON diff, XML diff, YAML diff, each behind its own page. This comparison starts the other way around: give it two files, and it works out what they are.

Detection uses the file extension when you upload, and the content itself when you paste — a JSON object starts with { or [, XML starts with a tag, CSV has a consistent number of comma-separated fields across its lines, and YAML is recognized by its key-and-indentation structure. Whichever guess it makes is shown above the panels, so it's never a silent assumption.

Auto-formatting before every comparison+

Two files can represent identical data while looking nothing alike on disk — different indentation, single versus double quotes, a trailing newline, keys in a different order. Comparing that as raw text produces noise, not insight.

Once a file's format is known, both sides are parsed into their actual structure and then re-printed in a single, consistent style before anything is compared. That's true whether it's a minified JSON API response, a hand-edited YAML config, or an XML export from a legacy system — the comparison is based on the data, not on how it happened to be formatted that day.

What structural comparison means for XML and YAML+

XML and YAML both describe structured data, just with different syntax from JSON. Parsing an XML document turns each tag into an element with its own attributes and children, so a comparison can point at exactly the attribute or nested tag that changed rather than flagging a whole block of markup as different.

YAML is parsed the same way a YAML-aware application would read it — mappings, lists, and nested indentation become the same structure a JSON document would use internally — which is what makes it possible to compare a Kubernetes manifest or a CI config file by the settings it defines, not by its exact spacing.

Row and column aware CSV comparison+

A CSV file is really a table, and comparing it as plain text throws that structure away — a single changed value makes an entire line look different. Using the header row as field names turns each row back into a record, so a changed cell is reported by its row and column instead.

Rows are still matched by position, the same way JSON Compare treats arrays: inserting a row in the middle of an export will show every row after it as shifted. For most CSV exports — sorted, appended-to, or generated fresh each time — that position-based comparison is exactly what you want to see.

When a file doesn't parse: the text fallback+

Auto-detection is a best guess, and real files aren't always well-formed. If the format detected from one file doesn't actually validate against the other — a stray comma breaking JSON, a missing closing tag in XML — a structural comparison would either fail or produce something misleading.

Instead, the comparison quietly falls back to a line-by-line text diff, the same one Text Compare uses, complete with word-level highlighting on changed lines. You still get a usable result immediately, and the error location is shown so you know what to fix if you wanted the structural view instead.

Privacy: where your files actually go+

Every parser — JSON, XML, YAML, and CSV — runs entirely inside your browser using JavaScript on your own device. Files are read, detected, formatted, and compared locally; nothing is uploaded to a server, logged, or stored anywhere.

That matters most for the files people compare here: exported user data, infrastructure configs, API responses — content that often shouldn't leave your machine just to find out what changed. See the privacy page for the full explanation of what does and doesn't happen to your data.

Frequently asked questions

How does the file type get detected?+

If you upload a file, its extension is used first — .json, .xml, .yaml/.yml, or .csv. If you paste content instead, the tool looks at the content itself: JSON starts with { or [, XML starts with a tag, CSV has a consistent number of delimited fields across several lines, and YAML is recognized by its key/list structure. Whichever file you add first decides the format for the comparison.

What happens if my two files are different formats?+

The detected format is validated against both files before anything is compared. If the second file doesn't parse as the format detected from the first, the comparison falls back to a plain line-by-line text diff rather than guessing — so you still get a result, just without the structural, path-aware breakdown.

Can it compare a CSV export by row and column, not just line by line?+

Yes. CSV is parsed using its header row as field names, so a single changed value is reported as that row and column, and rows are compared by position — inserting a row in the middle will show every row after it as shifted, which is the same behavior JSON Compare uses for arrays.

Does it compare XML attributes as well as elements?+

Yes. Both tag content and attributes are parsed, so changing an attribute like port="8080" to port="8443" is reported as a specific change rather than being buried inside a larger block of altered markup. XML comments and the XML declaration aren't compared, since they don't affect the data.

Will reformatted or re-indented YAML show as changed?+

No. Both files are parsed into their actual data first and then re-printed with consistent indentation before comparing, so a YAML file that was only reformatted — not actually edited — will show as identical.

Why would I use this instead of JSON Compare or Text Compare directly?+

Use this page when you don't want to pick a tool first, or when you're comparing XML, YAML, or CSV specifically — JSON Compare and Text Compare are still there for when you already know exactly what you're comparing.