Diff Checker – Compare Text Online
Paste two versions of a text or open two files — the differences appear as you type, side by side, with the exact words that changed highlighted inside each line.
What Is a Text Diff?
A text diff (short for “difference”) is a comparison between two versions of text that shows precisely what was added, removed, or left unchanged. Instead of squinting at two documents and trying to spot the differences by eye, a diff tool lines the two versions up and marks every change so you can see them at a glance. The concept comes from software development, where the original Unix diff utility has been used since the 1970s to track edits between file revisions, but the same idea applies to any text: configuration files, contracts, articles, log output, or translations.
This tool compares in two passes. First it lines up whole lines with the Myers diff algorithm — the same algorithm Git uses by default. It finds the largest set of lines that appear in the same order in both versions, treats those as unchanged context, and reports everything else as added or removed. Then, for every changed line that has a counterpart on the other side, it runs the same algorithm again on the words (or characters) of that line, so you see exactly which words were edited instead of just “this line is different”.
How to Use This Diff Checker
Paste the first version into Original Text and the second version into Modified Text — or click Open file… or drag a file onto either box. The diff updates as you type. In the side by side view the original is on the left and the new version on the right, with removed text in red and added text in green; changed words are marked in a stronger shade. The unified view shows one column with - and + markers, like git diff, and is the default on phones.
Long stretches of unchanged lines are collapsed to three lines of context around each change; click a “⋯ unchanged lines” bar to open it. The counters above the result show additions, deletions, unchanged lines and how similar the two texts are. Swap flips the direction, Clear starts over, and Ctrl+Enter compares immediately (handy for very large inputs, where the live comparison pauses).
Ignore Whitespace and Case
Many differences are noise: a file re-indented with tabs instead of spaces, trailing spaces an editor removed, Windows line endings, or SELECT written as select. Tick Ignore whitespace to treat any run of spaces and tabs as one space and ignore leading and trailing whitespace, or Ignore case to treat upper- and lowercase letters as equal. The text you see is never changed — only the comparison is. Windows (CRLF) and Unix (LF) line endings are always treated as equal, and if only one of the texts ends with a final newline the tool tells you instead of showing an empty changed line.
Word, Character or Line Highlighting
Changed words works best for prose, documentation and most code: a renamed variable or an edited sentence is marked as a whole word. Changed characters finds single-character edits such as a typo, a changed digit in a version number, or a missing semicolon. Whole lines only turns inline highlighting off. When two paired lines have almost nothing in common, the tool shows them as a plain removal and addition instead of a confetti of tiny highlights.
Export as a Unified Diff (Patch)
Choose the Patch text view to see it on the page. Copy as unified diff and Download .diff produce the standard format used by diff -u, git diff and code review tools: a ---/+++ header, then hunks starting with @@ -12,7 +12,8 @@ (start line and line count in the old and new version) followed by context lines, - lines and + lines. You can paste it into a ticket or chat, or apply it with patch -p0 < changes.diff or git apply. When you opened files, their names are used in the header.
Real-World Use Cases
- Code review — paste an old and new version of a function or config file to see exactly which lines a colleague changed before approving a pull request.
- Proofreading and editing — compare a draft against an edited version of an article, email, or contract to confirm every revision an editor made.
- Configuration auditing — diff a working server or app config against a broken one to pinpoint the setting that was accidentally altered.
- Log comparison — line up two log outputs from different runs to find where behaviour diverged during debugging.
- Translation and localization checks — compare an original string file against a translated or updated one to verify which entries still need attention.
Tips for Comparing Text
- Comparing minified JSON or CSS? Format both sides first (for example with the JSON Formatter) so that each value sits on its own line — a diff of two one-line files is just one changed line.
- Comparing two lists where the order does not matter? Sort both with Sort Lines first, so only real additions and removals remain.
- Use Ignore whitespace when a file was re-indented or reformatted, so the real edits stand out.
- The line-number columns show the position in each version independently, which helps when lines shift up or down due to insertions.
- If two paragraphs are shown as completely different, check whether one of them is a single long line and the other is wrapped — the diff is line-based first.
Features
- Myers line diff — the minimal, readable set of changes, like Git, and fast even for files with tens of thousands of lines.
- Word and character highlighting — see exactly what changed inside a line.
- Side-by-side and unified views — with line numbers from both versions.
- Ignore whitespace and case — hide formatting noise; CRLF and LF are always equal.
- Collapsed context — unchanged stretches fold away, three lines of context stay.
- Files and drag & drop — compare text files up to 20 MB directly.
- Unified diff export — copy or download a patch for
git applyorpatch. - 100% client-side — your text and files never leave your browser.
Frequently Asked Questions
Does this tool compare word by word or line by line?
Both. Lines are matched first, which keeps the result readable and close to what Git shows. Inside every changed line that has a counterpart, the tool then compares word by word (or character by character, if you choose) and highlights only the parts that changed.
What do the green and red highlights mean?
Green rows marked with a + are lines that exist only in the modified text (additions), and red rows marked with a - are lines that exist only in the original text (deletions). Unmarked rows are unchanged lines shown for context.
Is my text sent to a server?
No. The entire comparison runs in your browser using JavaScript, so your text is never uploaded, stored, or transmitted anywhere. You can even use the tool offline once the page has loaded.
Can I compare source code or just plain text?
You can compare any text, including source code, JSON, configuration files, CSV data, or prose. The tool treats every line as plain text and does not require a specific language or format.
Why is a line shown as both removed and added when I only changed a few words?
A line counts as changed as soon as anything in it differs, so it appears once as removed (old version) and once as added (new version). The highlighted words inside the two lines show what actually changed. If the lines have very little in common, no inline highlighting is shown, because it would not help.
Can I compare two files?
Yes. Click Open file… above either box or drag a file onto it. Any text file works — source code, CSV, JSON, YAML, logs, Markdown — up to 20 MB per file. The file is read by your browser; it is not uploaded.
How do I ignore whitespace or indentation changes?
Tick Ignore whitespace. Runs of spaces and tabs are then treated as a single space and leading and trailing whitespace is ignored, so re-indented code or removed trailing spaces no longer show up as changes. Line ending differences (CRLF vs. LF) are always ignored.
Is there a size limit on how much text I can compare?
Files up to 20 MB can be opened. Inputs up to about half a million characters are compared live as you type; above that, press Compare or Ctrl+Enter. The Myers algorithm needs time proportional to the size of the text times the number of differences, so two large files that are mostly the same are compared in a fraction of a second. If two huge texts are almost completely different, the comparison stops after a few seconds and marks the remaining block as changed.
What is a unified diff?
It is the standard text format for changes, produced by diff -u and git diff. Each hunk starts with a line like @@ -3,7 +3,8 @@ — the change starts at line 3 and spans 7 lines in the old version and 8 in the new — followed by unchanged context lines (starting with a space), removed lines (-) and added lines (+). Tools such as patch and git apply can apply it to the original file.