Skip to content
Aarrange

Diff Checker

Paste two texts, or two JSON or YAML files. See every difference, hidden characters too. Nothing leaves your browser.

–
Added
–
Removed
–
Same
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try , or .
On this page

About Diff Checker

Updated

What is a diff checker?

A diff checker (or difference checker) compares two versions of a text and shows what changed: which lines were removed, which were added, and which words changed inside a line. Use it to check a config before a deploy or to see what changed in a contract. It also compares two API responses and finds why two lines that look the same differ.

How to compare text

  1. Paste the old text in the Original tab and the new text in the Changed tab. To open a file, click File or drop the file on the editor. It goes to the tab that is open.
  2. The Changes view shows both texts side by side as you type. The icon in the Result header switches to one column (unified). Runs of lines that are the same fold to three lines of context; click a fold to open it.
  3. Summary gives the counts and how much of the text is the same. Notes name hidden characters and data changes next to their lines. Patch gives a unified diff to copy or download.
  4. Swap (Alt S) changes the places of the two texts.

JSON diff: compare the data, not the lines

A plain text diff marks every line of a JSON file that was minified or had its keys moved, even when the data is the same. Set Compare as to JSON or YAML, or leave it on Auto, and the tool parses both sides, sorts the keys and compares the data. Each change shows by its path. A syntax error stops the compare. The tool marks it in its tab and tells you how to fix it. To check one file on its own, use the JSON Validator or the YAML Formatter.

Options

Open Options to ignore case, whitespace changes, blank lines or line ends. An option that is on shows in the Result header, so you never forget why two different texts count as the same. The tool remembers your choices.

Common surprises

A line that looks the same

A no-break space (U+00A0) often comes from Word, a web page or a PDF. It looks like a space, but a program sees another character, so a config key or a password does not match. The Changes view draws it as NBSP and the Notes name the column.

Original
Price: 10 EUR
Changed
Price:[NBSP]10 EUR   (a no-break space after the colon)

Every line changed

When every line shows as changed, the two files often use other line ends: Windows writes CRLF and macOS and Linux write LF. This tool does not mark each line for that. It says once, in the Notes and the Summary, which line ends each side uses. To make them the same, change the setting in your editor or in git (core.autocrlf).

JSON that only moved

Two JSON files with the same data in another order are the same data. Compared as JSON, the result says so.

JSON
{ "id": 42, "name": "Ada", "active": true }
JSON
{ "active": true, "id": 42, "name": "Ada" }

How a text diff works

A diff looks for the longest list of lines that both texts share in the same order, with gaps allowed. It marks the rest as removed or added. Most tools, this one too, use the algorithm that Eugene Myers published in 1986, which is fast when the texts are close. Inside a changed line, the tool compares words, and characters when the line only looks the same, so the mark falls on the exact place.

The Patch view writes the changes in the unified diff format that git and code review tools read. Lines that start with - were removed, lines with + were added, and each part starts with a line such as @@ -3,7 +3,8 @@.

Patch
--- original.txt
+++ changed.txt
@@ -1,3 +1,3 @@
 Refund policy
 
-You can return any item within 14 days of delivery.
+You can return any item within 30 days of delivery.

Other diff resources

Diff Checker FAQ

How do I compare two texts or text files online?

Paste the first text in the Original tab and the second one in the Changed tab, or open a file in each. The Result pane shows both texts side by side as you type. Removed lines have a red tint and added lines a blue one. The tool also marks the changed words inside a line. Press Compare (Alt C) to go to the changes.

How do I check if two texts are the same?

Paste both. When they match, the result says "The texts are the same" and Same shows 100%. When they only look the same, the Notes say why: a no-break space, a tab, an accent written two ways, or other line ends. The Summary also lists the hidden characters by line and column.

How do I compare two JSON files, and does key order matter?

Set Compare as to JSON, or leave it on Auto: when both sides are valid JSON, the tool compares the data, not the lines. Key order does not count, because RFC 8259 calls a JSON object an unordered collection. Spaces and line breaks between values do not count either. Each change shows by its path, for example $.dependencies.next: "16.1.0" to "16.4.3".

The order of items in a list does count. A new item in a list shows as one added item, not as a change to every item after it.

Why does a line show as changed when it looks the same?

Some characters cannot be seen. A no-break space (U+00A0) looks like a space. A zero-width space (U+200B) looks like nothing. And é can be one character, or an e plus an accent. Text copied from Word, a web page or a PDF often has them. The Changes view draws a hidden space as a small named mark, such as NBSP. The Notes say which character it is and in which column.

Is my text uploaded?

No. The compare runs in your browser, also for big files, which go to a background worker on your own computer. Some other compare sites send both texts to their server for each compare. Here nothing is sent, so you can compare configs, logs and contracts that must stay private.

What is a patch or unified diff?

A patch is a text that lists the changes between two files. Lines that start with - were removed, lines with + were added, and lines with a space are context. A line such as @@ -12,7 +12,8 @@ says where each part starts. Git, GitHub and code review tools use this format. The Patch view makes one that you can copy or download as a .diff file.

How do I compare files in git, VS Code or Notepad++?

Git: git diff --no-index old.txt new.txt compares any two files, also outside a repository. VS Code: select two files in the Explorer, right-click and choose Compare Selected. Notepad++: install the Compare plugin from Plugins Admin.

Use this tool when no editor is at hand or the text is not in a file. It also names hidden characters and compares JSON by its data.

Can I compare large files?

Yes. Two 5 MB logs of about 73,000 lines each compare in about a second on a normal laptop. Big texts run in a background worker, so the page does not freeze. Long runs of lines that are the same fold away, and the view shows the first 3,000 rows. The Patch view always has every change.