DevTools Pro · All tools · About

Text Diff Checker

About the Text Diff Checker

This text diff checker compares two versions of any text and shows exactly which lines were added, removed or changed, in a side-by-side or inline view. Paste the original and the new version and the comparison updates as you type, with highlights down to the individual word or character. You can ignore whitespace and letter case, and copy or download the result.

How does a diff checker work?

A diff tool looks for the longest run of content the two texts share, then reports everything else as insertions or deletions. This checker uses the Myers algorithm, the same approach behind git diff and GNU diff, which finds the shortest possible list of edits between the two versions.

The comparison is done line by line first. Matching lines at the start and end are skipped quickly, so long documents with a small change in the middle stay fast.

Line diff vs word diff

In Line Level mode a changed line is shown as two entries: the old line marked - in red and the new line marked + in green. This matches what you see in a code review or a patch file.

Word Level and Character Level modes pair each removed line with the added line that replaced it and show a single changed line instead. Inside it, only the words (or only the characters) that differ are highlighted, so a one-word or one-letter edit in a long paragraph is easy to spot. In the inline view deleted text is struck through in red and inserted text is highlighted in green; in the side-by-side view the left column highlights what was removed and the right column what was added.

Character Level is the most precise, for example it marks only the u when color becomes colour. For lines that together are longer than 4,000 characters it falls back to word level to stay fast.

Ignore whitespace and ignore case

Ignore whitespace treats runs of spaces and tabs as a single space and ignores spaces at the start and end of a line, so re-indented code or trailing spaces are not reported as changes. It does not ignore blank lines, and it does not treat ab and a b as equal.

Ignore case compares letters without regard to upper and lower case. Lines that match under these options are listed as unchanged and are shown as they appear in the Modified text. The counts, the line numbers and the identical-texts message all follow the options you have on.

Reading the results

Each row has two line-number columns: the left number is the line in the Original text and the right number is the line in the Modified text. Added lines only have a right number and removed lines only have a left one.

The badges above the results count added, removed, modified (word and character modes only) and unchanged lines. When the texts match, a message says so, and notes when they only match because of the ignore options.

Copy diff and Download save the result as plain text with - before removed lines, + before added lines and two spaces before unchanged lines. A modified line is written as one - line followed by one + line.

Windows line endings (\r\n) and old Mac line endings (\r) are normalized to \n before comparing, so a file saved on another operating system does not show every line as changed.

How to Use the Text Diff Checker

  1. Paste the earlier version into the Original box and the newer version into the Modified box, or click Example to load a sample. The comparison appears as you type.
  2. Choose Word, Character or Line Level from Mode, turn on Ignore whitespace or Ignore case if needed, and switch the result between Side by side and Inline.
  3. Click Copy diff or Download to save the result as text, or Clear to empty both boxes and start again.

Text Diff Checker Examples

Compare two config files line by line

Line Level mode with no options. Copy diff gives this text.

Input:

Original:
server {
    listen 80;
    root /var/www/html;
}

Modified:
server {
    listen 443 ssl;
    root /var/www/html;
    gzip on;
}

Output:

  server {
-     listen 80;
+     listen 443 ssl;
      root /var/www/html;
+     gzip on;
  }

Ignore whitespace and case

Line Level with Ignore whitespace and Ignore case on. Only the new last line is reported; matching lines appear as in the Modified text.

Input:

Original:
Hello World
  indented line
same

Modified:
hello world
indented line
same
extra

Output:

  hello world
  indented line
  same
+ extra

Spot a one-letter change

Character Level mode highlights only the added u in the changed line. Copy diff writes the changed line as a - and a + line.

Input:

Original: color: red;
Modified: colour: red;

Output:

- color: red;
+ colour: red;

Common Errors

Every line shows as changed after saving a file in another editor or on another OS.
Line endings are already normalized, so look for changed indentation or trailing spaces instead. Turn on Ignore whitespace to hide them.
Nothing in the result is highlighted at word or character level, only whole removed and added lines.
Highlights appear only inside a changed line that has a matching replacement. If a line was only removed or only added, it is listed as a whole removed or added line.
Ignore whitespace still reports ab versus a b as different.
This is expected. Ignore whitespace collapses runs of spaces and trims line ends but does not delete spaces between characters.
A difference is missing from the counts after turning on Ignore case.
Ignore case also hides a capitalization-only change. Turn it off to see exact differences.

Frequently Asked Questions

Is the text I paste sent to a server?
No. The diff is calculated by JavaScript in your browser tab, and neither the original nor the modified text is uploaded or stored.
What is the difference between Word, Character and Line Level?
Line Level lists a changed line as one removed and one added line. Word Level and Character Level merge them into a single changed line and highlight only the words, or only the characters, that differ.
Can I ignore case or whitespace?
Yes. Turn on Ignore case to treat upper and lower case as equal. Ignore whitespace treats runs of spaces and tabs as one space and ignores spaces at the start and end of a line. Neither option ignores blank lines.
Why are lines with no visible change marked as different?
Usually because of invisible characters: trailing spaces, tabs versus spaces, or non-breaking spaces. With Ignore whitespace off the checker compares text exactly. Turn it on to skip spaces and tabs; a non-breaking space is also treated as whitespace.
How large a text can I compare?
Documents with thousands of lines work fine. Very different texts are the slow case: past a few thousand edits the tool stops aligning and shows the remaining middle block as removed and re-added. There is no file upload, so paste the contents of each file.

Related tools