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
Scan with WeChat to share this tool
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,twoagainstONE,TWOis 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.