Compare two texts

Original

drop a file or paste below

Changed

drop a file or paste below

Comparing line endings? Drop the files rather than pasting — a text box converts Windows line endings to Unix ones as the text goes in, so a pasted copy can never show that difference.

Comparison options

Paste two versions, or drop two files, and get a line-by-line comparison. The part other diff tools leave out is the interesting one: when two lines render identically on screen but still do not match, this page names the reason — a Windows line ending against a Unix one, a trailing space, a non-breaking space wearing an ordinary space's clothes, a zero-width character, or an accent stored in two different ways. Nothing is uploaded.

How to use it

  1. Paste the original on the left and the changed version on the right, or drop a file onto each side.
  2. Press Compare.
  3. Read the summary, then the Differences you cannot see box if there is one.
  4. Use the switches to ignore line endings, whitespace or case and narrow down what really changed.

The difference you came here to find is usually invisible

Most of the time a diff tool is doing something easy: two paragraphs differ, it colours them, you move on. The times it matters are the other ones — when two values look completely identical, refuse to match, and nothing on screen explains why.

That is the case this page is built for. When two lines are the same once you normalise them but are not the same as raw text, it does not just mark the line as changed. It works out which invisible thing is responsible and says so.

The five usual suspects

Line endings. A line break is one character on macOS and Linux, two on Windows. Open a file on the other platform, save it, and every single line now differs from its counterpart although nothing visible changed. This is the most common reason a diff turns entirely red when you were expecting three changes.

Trailing whitespace. Spaces at the end of a line have no appearance at all. They survive copy and paste, they get committed, and they make otherwise identical lines differ. This page draws them as visible dots so you can see how many there are.

Non-breaking spaces. A space that stops a line breaking at that point. It looks exactly like an ordinary space and is a different character. Text pasted out of word processors and web pages is full of them, and they are a common reason a name or a reference number fails an exact-match lookup.

Zero-width characters. Characters with no width whatsoever. They arrive from PDFs, from web pages and from editors that insert them to control line breaking. You cannot see them, you cannot select them reliably, and they break comparison.

Accents stored two ways. An accented letter can be one character, or a plain letter followed by a combining mark. Both render identically. macOS and Windows have historically preferred different forms, so text copied between them produces values that look the same and never compare equal.

Why the tool shows you the characters rather than cleaning them up

It would be easy to strip trailing spaces, normalise line endings and compare what is left. Some tools do exactly that, and it is the wrong default here: it would hide the thing you are trying to find. If your two configuration files differ only by line endings, that is the answer, not noise to be swept away before showing you an answer.

So the comparison is done on the text as given, with the differences named, and the switches are there for when you have understood the cause and want to see past it. The summary always says what was ignored, so a comparison that came back clean never came back clean for a reason you had forgotten about.

Files are read as bytes, deliberately

The convenient way for a browser to read a text file silently removes a byte order mark if it finds one, and can alter line endings on the way through. For most tools that is harmless. For this one it would destroy evidence — a byte order mark is a real difference between two files and a frequent cause of a mismatched first line.

So files here are read as raw bytes and decoded explicitly, with the byte order mark preserved and shown. We learned this the hard way on our CSV tools, where the convenient method quietly broke a claim the page was making about not touching your data.

What it does not do

It compares line by line, not word by word inside a line, so a changed line is shown as a removed line and an added one. It has no opinion about syntax, so it will not tell you that two pieces of JSON are equivalent with their keys in a different order. And it does not merge — it shows you what differs and leaves the decision to you.

Frequently asked questions

Two lines look exactly the same but the tool says they differ. Why?

Because something in them is invisible. The usual suspects are a trailing space at the end of one line, a Windows line ending against a Unix one, a non-breaking space where an ordinary space should be, a tab against a run of spaces, or a zero-width character that has no width at all. All of them change the bytes without changing what you see. Rather than just marking the line as changed, this page says which of those it found and where in the line.

What is the CRLF and LF thing about?

A line break is stored as one character on macOS and Linux and as two on Windows. Text created on one and edited on the other ends up with a mixture, and every line then differs from its counterpart even though nothing visible changed. It is the single most common reason a diff lights up entirely red when you expected two or three changes. Turn on “ignore line endings” to see the real changes underneath, and the summary will still tell you the file has mixed endings.

What is a zero-width character and how did it get into my text?

It is a character with no visible width, used for things like controlling where long words break. They arrive by being pasted from web pages, PDFs and word processors, and by some editors inserting them automatically. They count towards character limits, they break exact-match searching, and they can make two apparently identical values fail to compare equal. Because they cannot be seen, a diff that only shows you coloured lines leaves you no way to work out what is wrong.

Why do the same accented letters not match?

An accented letter can be stored in two ways: as a single character, or as a plain letter followed by a combining accent mark. They look identical and are not the same sequence of characters. Text from macOS often uses the second form where Windows uses the first, so copying between them produces values that display the same and fail every comparison. This page detects it and reports it as a normalisation difference rather than leaving you to guess.

Can it ignore whitespace and case?

Yes, and each is a separate switch so you can narrow things down. Ignoring line endings usually clears up the mixed-endings problem on its own. Ignoring all whitespace is useful when comparing reformatted code or re-wrapped prose. Ignoring case helps with data that has been through an uppercasing step. The summary always reports what was ignored, so a comparison that passed is never quietly passing for a reason you forgot about.

How large a text can it handle?

Comfortably into the thousands of lines. The comparison runs in your browser, so the practical limit is your own machine rather than an upload size cap, and there is no account or queue in the way. Very large files will make the page think for a moment, because a proper line comparison does real work rather than just checking whether the two texts are equal.

Does it change either text?

No. Both sides are read exactly as given, including the byte order mark if there is one and whatever line endings they arrived with. That matters here more than anywhere: a tool that tidies text up before comparing it would hide the very differences you came to find. Files are read as raw bytes and decoded deliberately rather than through the shortcut that silently strips a byte order mark.

Is anything uploaded?

No. Both texts stay inside your browser tab, which makes this usable for contracts, configuration files, keys and anything else you would not paste into someone else's server. Disconnect from the network and it keeps working.