Online Text and Code Compare

Put two texts side by side and see the difference instantly. Compare by line, word or character, ignore whitespace and letter case, and take away a ready unified diff. What you type never leaves your browser and is never sent to a server.

Original text

0 lines

Changed text

0 lines
Detail
View
0 Lines added
0 Lines removed
0 Lines changed
0 Lines unchanged
- Line similarity
Removed from the left text Added to the right text

How do you compare two texts?

  1. Put the texts side by side

    Paste the two texts you want to compare into the left and the right box. You can also drop files straight onto them; nothing is uploaded to a server.

  2. Choose the level of detail

    Line, word or character. Word is the right choice for most text; drop to character level to catch a single digit in an identifier, a hash or a long number.

  3. Turn the noise off

    Ignore indentation and whitespace changes, or differences in letter case, when they are not what you are looking for. In long files you can hide the unchanged lines completely.

  4. Take the result away

    Read the difference side by side or inline. Copy the unified diff with one click, or download it as a .diff file.

Line, word or character: which one should you pick?

The comparison always starts by matching lines: which one stayed, which one left, which one arrived. The detail control does not change that. It decides what gets marked inside a pair of lines that counts as changed.

Detail What it does When to use it
Line Marks a changed line as a whole. Log files and very long lines. The fastest option, for when you want the whole line to catch your eye.
Word Colours only the words that changed inside the line. Contracts, articles, translations, code. The default choice: it shows a single changed word in a sentence at a glance.
Character Takes the difference all the way down to single characters. Identifiers, hashes, IBANs, long numbers. One changed digit is hard to spot at word level and easy to spot at character level.

What is a diff, and what do the marks in it mean?

A diff is the shortest list of changes that turns one text into the other. This tool uses Myers' algorithm, which is mathematically guaranteed to return the shortest result, so you are never shown a change that did not happen. The same algorithm sits under git, svn and the command line diff tool.

The output you can copy and download is written in unified diff format, the shared format of the software world. Hand it to a bug report, to a pull request description, or straight to the patch command.

Symbol What it means
- The line was in the original text and is gone from the changed one.
+ The line was added to the changed text and was not in the original.
space The line is the same in both texts and is printed only as context.
@@ Marks the start of a new region of changes and the line range it covers in each of the two texts.

Key features

Side-by-side and inline views

The two-column view shows what was replaced with what; the inline view shows you the patch output itself.

It highlights the difference inside a line

Changed line pairs are compared a second time, so only the words or characters that really changed light up and the rest stays calm.

Turn the noise off

Ignore whitespace and indentation changes, or differences in letter case. In long files, hide the unchanged lines entirely.

Drag and drop a file

You can drop a file into either box: .txt, .json, .csv, .log, .sql or any source file. Nothing is uploaded; the file is only read.

A ready unified diff

Copy the result with one click or download it as a .diff file. The output is standard, so the patch command and GitHub both read it.

Your text never reaches a server

The comparison runs in your browser. Paste a contract, a log or private source code and none of it is sent anywhere or stored.

FAQ

Paste the two texts into the left and right boxes, or drag a file onto either box. The result updates as you type: red lines are what the left text loses, green lines are what the right text gains.

No. The comparison runs entirely in your browser: neither the text you paste nor the file you drop is uploaded or stored anywhere. Nothing is left behind once you close the tab, so contracts, logs and private source code are safe to paste.

Yes. The tool works line by line and preserves indentation exactly, so it handles source code, JSON, YAML, SQL and configuration files directly. Tick “Ignore whitespace” to drop the noise a reformatting pass leaves behind.

Not directly: this tool reads plain text. Copy the contents of the Word or PDF document into the boxes and the comparison works fine. The files you can drop in are text files such as .txt, .md, .json, .csv and .log.

A unified diff is the standard text format for describing a change; git and the command line diff tool produce the same shape. You can attach the downloaded .diff file to a bug report, paste it into a pull request, or feed it to patch to apply the same change to another file.

It trims the start and end of each line and treats any run of spaces and tabs inside a line as a single space, so lines that only changed indentation, or had tabs turned into spaces, count as identical. Line ending differences (CRLF versus LF) are always ignored and need no separate option.

It is the number of lines that stayed the same, counted on both sides, divided by the total number of lines in the two texts. Partial similarity at the word or character level is not counted: the unit is the line.

There is no fixed limit; the comparison uses Myers' algorithm, so a few thousand lines are comfortable in the browser. The table draws at most 3000 rows at a time, but the diff file you download always carries the whole difference.

Easily get your dream job!

Sign Up
Sign up Easily
Show your programming skills
Evaluate the offers