Text diff

Compare two texts line by line and see what was added, removed or changed, as a unified or side-by-side view.

Everything happens on your device. What you type never leaves it.

View

This tool needs JavaScript to run

About this tool

This tool compares two pieces of text and shows what changed between them. Paste the original text on one side and the changed text on the other, and the differences appear at once: lines that were added are marked with a plus, lines that were removed with a minus, and the words that changed inside a line are underlined.

You can read the result in a unified view, where the two texts are merged into one list of changes, or side by side, where each removed line sits opposite the line that replaced it. Choose "Ignore whitespace" to treat lines that differ only in spaces or tabs as the same, and "Ignore case" to treat capital and small letters as the same. The result is also given as unified diff text, the format used by patch files, ready to copy.

Everything happens on your device. Neither text is uploaded. Small texts are compared on the page as you type; large ones, up to a million characters or more, are compared in a background worker running WebAssembly, so the page stays responsive.

Examples

One line changed

Input

Original: the quick brown fox
Changed: the quick red fox

Output

-the quick brown fox
+the quick red fox

A line added at the end

Input

Original: a
b
Changed: a
b
c

Output

 a
 b
+c

Same text, different case

Input

Original: Hello World
Changed: hello world
(Ignore case on)

Output

The texts are the same.

Common questions

Is my text uploaded anywhere?

No. Both texts are compared in your browser. Nothing is sent to ajx.io or to anyone else, and the tool keeps working if you go offline.

How large can the texts be?

Texts of a million characters each compare in a few seconds. The comparison runs in a background worker, so the page does not freeze while it works.

How do I read the marks?

A plus and the word "added" mark a line that is only in the changed text. A minus and the word "removed" mark a line that is only in the original. Colour is extra: the signs and words carry the meaning.

What does the unified diff text contain?

It has the two file headers, then a section for each group of changes starting with a line such as "@@ -2,7 +2,7 @@", which gives the line numbers in each text, and three unchanged lines of context around every change.

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

It probably differs in spaces, tabs or letter case. Turn on "Ignore whitespace" or "Ignore case" to treat those as equal.