Diff Checker

Compare two pieces of text and see the differences highlighted line by line. Free, browser-based text diff tool. No data sent to servers.

  • Runs in your browser
  • Tool input is not uploaded to ZeroTool servers
  • Free · No Sign-Up
Click Compare or press Ctrl+Enter (⌘+Enter on Mac) to compare whole lines. Typing does not compare automatically. A Web Worker runs the comparison; Cancel or editing either input stops it and clears the old result. Swap exchanges the two inputs and clears the result. Click Compare again to reverse the comparison direction. Clear empties both inputs, the result and the status, and cancels pending work. Ctrl+L (⌘+L on Mac) does the same while focus is inside this tool.
Unified shows both line numbers in one column. Side-by-Side pairs removed and added lines in order within each changed block; extra lines have an empty partner. Switching views returns to the first page without comparing again.
Enter the original text. CR LF, LF and lone CR all end a line. Spaces, letter case and a final newline count as differences; there are no ignore options. The status line counts changed pairs that differ only in whitespace, invisible characters or Unicode normalization.
Enter the changed text. One input may be empty; empty text participates as one empty line. Editing either input cancels the comparison and clears the result.
Result Red − lines were removed; green + lines were added. Counts cover the whole text. Previous and Next show 100 rows per page. After comparing, Hide inputs frees result space without discarding text; Show inputs brings it back.
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

About This Tool

This diff checker compares line by line. It computes the longest common subsequence (LCS) of the two line lists: the lines kept in both texts are as many as possible, and everything else is a removal or an addition. git diff and GNU diff solve the same problem with Myers' algorithm (git-diff --diff-algorithm), which is faster when the two texts are similar. When several equally short diffs exist, the tools may choose different ones, so the order of - and + lines can differ from Git's output while describing the same change. It suits code, configuration files, log output, or any text where line-level changes matter.

Reading the Output

The Unified view lists every line of both texts in one column. The first two number columns are the line numbers in the original and the modified text. A - marks a line that exists only in the original, a + marks a line that exists only in the modified text, and unmarked lines are the same in both. For example, comparing

timeout = 30
retries = 3

with

timeout = 60
retries = 3

shows - timeout = 30, then + timeout = 60, then the unchanged retries = 3, with +1 / -1 on the status line. The Side-by-Side view puts removed and added lines next to each other: in each block of changed lines, the first removed line sits next to the first added line, the second next to the second, and so on.

Example: a Configuration Change

Original:

server:
  port: 8080
  host: 0.0.0.0
logging:
  level: info

Modified:

server:
  port: 9090
  host: 0.0.0.0
logging:
  level: debug
  file: app.log

The tool reports +3 / -2 (three lines added, two removed) and shows, in the Unified view:

  server:
-   port: 8080
+   port: 9090
    host: 0.0.0.0
  logging:
-   level: info
+   level: debug
+   file: app.log

Each changed line appears as a removal followed by an addition. The new file: app.log line has no partner, so in the Side-by-Side view its left cell is empty.

Example: Line Endings and Trailing Newlines

CR LF (Windows), LF and a lone CR all end a line, so the same text saved with different line endings compares as identical. A browser text box already turns pasted CR LF into LF (the HTML standard's "normalize newlines" step), and the tool splits text the same way. Other invisible differences still count: a trailing space, a tab instead of spaces, or a non-breaking space (U+00A0) instead of a normal one makes the line differ.

A final newline also counts. a, b compared with a, b plus a trailing line break gives +1 / -0: the extra line is an empty one at the end.

Lines That Look the Same

Because nothing is ignored, a changed line can look exactly like its partner. The status line then says how many changed pairs differ only in whitespace or invisible characters, and how many differ only in Unicode normalization: the same letter stored as one code point (NFC) or as a base letter plus a combining mark (NFD). For example, comparing café (with a trailing space) and naïve with café and naïve written with a combining diaeresis (U+0308):

+2 / -2 Changed line pairs that differ only in whitespace or invisible characters (trailing spaces, tabs, U+00A0, U+3000, zero-width): 1. Pairs that differ only in Unicode normalization (NFC / NFD): 1.

Both pairs are still shown as one removal and one addition; the note only tells you why. A pair where one letter really changed, or where a straight quote became a curly one, is not counted.

Limits

  • Whole lines only. A one-character change marks the whole line as removed and added; there is no word- or character-level highlighting.
  • No ignore options. Whitespace and letter-case differences count as changes. one, two against ONE, TWO is two removals and two additions. The status-line notes above only count pairs; they do not hide them.
  • Side-by-Side pairs lines by position. Within a block of changes, removed and added lines are paired in order, whether or not they are related. If a block removes three lines and adds one, the added line sits next to the first removed line and the other two have empty partners.
  • No context folding. Unchanged lines are always shown in full, and the output has no @@ hunk headers, so it is not a patch you can apply.
  • Large inputs take time, but not on the page. The comparison runs in a Web Worker, so the page keeps responding and Cancel stops it at once. The algorithm keeps only a few rows of scores at a time instead of a table of every original line against every modified line. In a Node.js 22 test with two 10,000-line files where every tenth line changed, it took about 0.7 seconds with a peak memory footprint of about 31 MB; the earlier full-table version took about 2.9 seconds and 946 MB. In a browser the worker may take longer, depending on how the browser schedules background threads. Only one page of 100 rows is drawn at a time.

For large files, patches, or whitespace-insensitive comparison, use the command line: diff -u a.txt b.txt prints a unified patch, diff -w ignores whitespace, git diff --no-index a.txt b.txt works on files outside a repository, and git diff --word-diff highlights changed words.

FAQ

Is my text sent to any server?

No. The comparison runs in a Web Worker in your browser; neither text is sent to a server or written to browser storage. Analytics records only the tool name and the action when you click Compare, not the text.

What diffing algorithm does this use?

A line-level Longest Common Subsequence (LCS): it keeps as many lines as possible in both texts and marks the rest as removed or added. git diff and GNU diff find the same kind of shortest diff with Myers' algorithm, which is faster when the texts are similar. When several equally short diffs exist, the order of - and + lines can differ from Git.

Can I compare code files?

Yes. Paste any plain text — source code, config files, prose — and this tool will show added and removed lines. It does not know the language, so a moved function shows as removed lines and added lines.

Are whitespace-only differences shown?

Yes. There are no ignore options, so a trailing space, a tab instead of spaces or a non-breaking space makes the line differ. The status line counts the changed line pairs that differ only in whitespace or invisible characters, and the pairs that differ only in Unicode normalization (NFC / NFD), so lines that look identical are explained.

Can it handle large files?

Yes. The comparison runs in a Web Worker, so the page keeps responding and Cancel stops it at any time. The work grows with the number of original lines times the number of modified lines, so two texts of tens of thousands of lines take time. Results are drawn 100 rows per page.

Why does a line with an apostrophe show as changed after I pasted from Word?

Word can replace straight quotes with curly ones as you type (the AutoFormat As You Type option "Straight quotes" with “smart quotes”), so don't (U+0027) becomes don’t (U+2019). The two are different characters, so the line is marked removed and added. The status line does not count these pairs, because the characters look different; compare the quotes in the changed lines.