Text diff checker: compare two texts by line, word or character

View
Compare by

Paste text into both boxes to see what changed.

About Text Diff Checker

This text diff checker compares two pieces of text and shows exactly what was added and what was removed. Paste the original on the left and the changed version on the right, and the differences appear as you type, either side by side or in one inline column like a pull request.

Choose the unit of comparison. By lines is best for code, config files and lists. By words highlights the words that changed inside a line, which suits prose and documentation. By characters picks out single letters, which helps with typos, version numbers and IDs. You can ignore whitespace and letter case, jump from one change to the next, and fold the long unchanged stretches.

The comparison uses Myers' difference algorithm, the one behind Git, so it finds the smallest set of changes. Added and removed text is marked with plus and minus signs as well as colour, and the result works in light and dark themes. Everything runs in your browser. Your text is never sent anywhere or saved.

How to compare two texts

  1. Paste the original text into the left box and the changed text into the right box.
  2. Pick side by side or inline, and compare by lines, words or characters. Tick Ignore whitespace or Ignore case if those differences do not matter.
  3. Use Previous and Next to move between changes, and Copy diff to take the result as a unified diff.

Frequently asked questions

How does the text diff checker work?

It finds the shortest set of additions and removals that turns the original text into the changed text, using Myers' difference algorithm, the same approach used by Git. Lines that appear in both texts in the same order are left alone, and everything else is marked as added or removed.

What is the difference between comparing by lines, words and characters?

By lines marks whole lines that changed, like a code review. By words also highlights the exact words that changed inside those lines, and by characters highlights single letters, which is useful for typos, numbers and IDs. The counts above the result use the same unit, so they show added and removed lines, words or characters.

What do ignore whitespace and ignore case do?

Ignore whitespace treats texts as equal when they only differ in spaces, tabs or indentation, so a re-indented block is not reported as changed. Ignore case treats upper and lower case letters as the same. Both only affect what counts as a difference. The text is shown exactly as you typed it.

How do I read the colours and the plus and minus signs?

A line with a minus sign is only in the original and is tinted red. A line with a plus sign is only in the changed text and is tinted green. The signs, plus underlines for added words and strike-throughs for removed words, carry the meaning too, so the result is readable without colour.

How do I copy the result as a unified diff?

Press Copy diff. You get the same format as git diff or diff -u: a header, then hunks that start with @@ and list removed lines with a minus and added lines with a plus, with three unchanged lines around each change. You can paste it into a pull request, a ticket or a patch tool.

Can it handle large texts?

Yes. Texts of thousands of lines are compared in a background thread, so the page stays responsive, and long runs of unchanged lines are folded by default to keep the result fast to scroll. Very large single changes compared by word or character fall back to showing that change by line.

Is my text sent to a server?

No. Both texts are compared in your browser and are never uploaded or stored. Only the option choices, such as the view and the unit, are kept in the page address.