Text Compare – Side-by-Side Diff · DiffScope
Compare two texts or files side by side and highlight every difference.
Updated:
Text A
Text B
Differences
—What the text comparison tool does
A "diff" is a line-by-line comparison between two versions of a text, showing exactly what was added, removed or left unchanged — the same idea behind "track changes" in a word processor, but for any kind of text or code. DiffScope compares two texts or files side by side and highlights every difference between them, so you can spot exactly what changed without reading both versions line by line yourself.
How to use the text comparison tool
- Paste the original text into the Text A panel, or click File to upload a file.
- Paste the changed text into the Text B panel, or upload a file there too.
- Scroll to the Differences panel to see both texts side by side, with additions and removals highlighted.
- Use Clear on either panel to start over with new text.
How text comparison works
DiffScope splits both texts into lines and finds the longest common subsequence (LCS) between them — the same mathematical principle behind Unix diff and git diff. Lines that are in both texts and in the same order are marked as equal; the rest is marked as removed (only in A) or added (only in B):
Text A Text B
function f() { function f() {
return 1; return 2; ← changed (removed + added)
} }
console.log(1); ← added
All the computation runs in your browser with native JavaScript — no external libraries, no server calls.
Examples
1. What changed in a config file. Paste the old version on the left and the new one on the right. Unchanged lines stay aligned side by side; removed lines are highlighted on the left and added lines on the right, with blank rows keeping both sides in step:
Original Modified
1 host = localhost (removed)
1 host = db.internal (added)
2 port = 5432 2 port = 5432
3 user = app 3 user = app
4 pool = 10 (removed)
4 pool = 20 (added)
5 ssl = true (added)
Summary: +3 added · -2 removed
A changed line counts as one removal plus one addition, which is why two edits and one new line give +3 · -2.
2. Compare two versions of a contract clause or a README. For prose, put one sentence or one paragraph per line before comparing. Since the diff works line by line, a paragraph that is one long line shows as entirely changed even if a single word moved.
3. Compare files without pasting. Use the upload buttons above each panel to load two text files (logs, CSV exports, SQL dumps). They are read locally by the browser and never uploaded.
Common problems when comparing text
- Every line marked as different. The usual cause is invisible whitespace: trailing spaces or tabs versus spaces. Line endings are not the problem here — Windows (CRLF) and Unix (LF) endings are normalized before comparing — but a space at the end of a line still counts. Clean both sides with the Text Cleaner or the Indent Fixer first.
- Reordered lines look like big changes. A line-based diff reports a moved line as removed in one place and added in another. If order doesn't matter (lists of IDs, dependency lists), sort both sides with the Line Sorter before comparing.
- Comparing JSON as text. Two JSON documents with the same data but different key order or indentation look completely different as text. Use the JSON Diff, which compares the structure instead.
- Very large inputs. The comparison builds a table proportional to the number of lines on each side, so two files of several thousand lines each can exceed the browser-side limit; the tool tells you instead of freezing. Compare the relevant section, or use
diffon the command line.
Text compare vs. diff and git diff
For files on disk, diff -u old.txt new.txt prints a unified diff on any Unix system, and git diff --no-index old.txt new.txt gives the same with colors even outside a repository; add --word-diff to see changes within a line (see the git diff documentation). On Windows, fc old.txt new.txt is built in. This page is quicker when the two texts are on your clipboard — two versions of an email, an API response before and after a deploy, a config copied from two servers — and when you want them side by side rather than as +/- lines.
Frequently asked questions
What algorithm does it use to compare the texts?
A line diff based on the longest common subsequence (LCS), the same principle used by tools like Unix diff or git diff, adapted to show the result side by side.
Does it compare word by word or line by line?
Line by line: each line is marked as equal, added or removed. If a line changes by even one character, it's marked as removed in text A and added in text B.
Can I compare files instead of pasting text?
Yes, each panel has a button to load a local text file; it's read with the browser's File API and never uploaded to a server.
Is there a size limit?
The LCS algorithm is O(n×m), so very long documents (several thousand lines each) can get slow; the tool warns you if the pair of texts exceeds a safe limit.