Text & Code Diff Checker

Compare two versions of a text or code file and see every added, removed and changed line. The texts never leave your browser.

0 lines ยท 0 characters

0 lines ยท 0 characters

Text files up to 5 MB are read on your device and never uploaded.

View

Browsers turn line breaks typed or pasted into a box into LF, so line endings are compared as they are only in loaded files.

Paste two texts to compare them. They never leave your browser.

A diff lists what changed between two versions of a text: the lines that were removed, the lines that were added and the lines that stayed the same.

This tool compares the texts line by line. Removed and added lines at the same spot are paired as changed lines, and inside each pair the words that differ are highlighted.

What the options change

Ignore whitespace treats lines as equal when they differ only in trailing spaces, or in any spaces and tabs. Ignore case does the same for capital letters, and Ignore blank lines leaves empty lines out. Ignoring line endings is on by default: Windows ends lines with CRLF and Unix with LF, and the summary tells you when they differ.

Show only changes folds long unchanged stretches, keeping the context lines you choose around each change; click a fold to open it.

Reading a unified diff

The unified format is what git diff and diff -u print, and what you export here. Comparing this original with the changed version below it:

host: example.com
port: 8080
timeout: 30
retries: 3
host: example.com
port: 8443
timeout: 30
retries: 3
log: debug

gives this diff:

--- original
+++ changed
@@ -1,4 +1,5 @@
 host: example.com
-port: 8080
+port: 8443
 timeout: 30
 retries: 3
+log: debug

A space starts an unchanged line, - a removed one and + an added one. The header @@ -1,4 +1,5 @@ says the hunk starts at line 1 of the original and covers 4 of its lines, and starts at line 1 of the changed text and covers 5. When a last line has no line break, the diff adds the line \ No newline at end of file.

The export records every difference, even ones the options hide, so patch recreates the changed text exactly. It uses your context setting, 3 lines by default.

Limits

Each side can be up to 5 MB. Texts under 200,000 characters in total are compared as you type; larger ones when you press Compare, in a background worker you can cancel. The first 2,000 rows are drawn at once, and lines over 5,000 characters get no word highlighting.

Beyond 2,000 differences the result is simplified, with a notice: lines that occur once in each text are matched, and the rest is shown as removed and added blocks.

How to use

  1. Paste the original on the left and the changed text on the right, or load a file on each side.
  2. Read the summary, switch views, and step through with Next change.
  3. Set the options, then copy the unified diff or download it as a .diff file.

Features

Common uses

Frequently asked questions

How do I compare two texts online?

Paste one version into Original and the other into Changed. The result updates as you type.

What does unified diff mean?

The standard text format for differences that git diff prints: hunks that start with @@, with removed lines marked - and added lines marked +.

How do I ignore whitespace or case?

Choose Trailing only or All under Ignore whitespace, or tick Ignore case. Lines that differ only in those ways then count as unchanged.

Is my text uploaded?

No. The comparison runs in your browser and the texts and files never leave it or get saved. Like the rest of the site, the page records a visit when it loads, but not what you compare.

What is the difference between a diff and a patch?

A diff describes how two texts differ; a patch is a diff saved to be applied, which the patch program uses to turn the original into the changed version. The file you download here works as a patch.

Why are line endings flagged?

Windows ends lines with CRLF and Unix with LF, so two files can look the same and differ on every line. The tool ignores this by default and says when the endings differ.

Can it compare JSON or code?

Yes, any text. It compares lines, not syntax, so format JSON first, with sorted keys, to keep formatting and key order out of the result.

How large a file can it handle?

Up to 5 MB per side, compared in the background. See Limits above for the details.

Need to test a whole website, not just a snippet?

RoboQA tests real pages and user journeys in a browser: logins, forms, clicks and full flows. See what RoboQA can test or compare plans.

More free tools

See all free tools