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
  • Your data never leaves your browser
  • 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.
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. 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.

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.
  • 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. All diff computation runs in your browser. Your text never leaves your machine.

What diffing algorithm does this use?

This tool uses a line-level Longest Common Subsequence (LCS) algorithm — the same principle used by Unix diff.

Can I compare code files?

Yes. Paste any plain text — source code, config files, prose — and this tool will show added and removed lines.

Are whitespace-only differences shown?

Yes. By default all differences are shown, including lines that differ only in whitespace.