Quick Answer
A text diff tool compares two blocks of text and highlights exactly what changed: additions in green, deletions in red, and unchanged text left plain. To use one, paste your original into the first box and the revised version into the second, and the differences appear instantly. It's the fastest way to spot every edit between two versions.
A text diff tool compares two versions of text and instantly shows you what changed between them, with additions and deletions highlighted so nothing slips past you. You paste the original into one box and the revised version into another, and the tool marks every edit. That's it. It turns the tedious job of eyeballing two nearly identical documents into a two-second glance. This guide covers how to use one, how the clever algorithm behind it actually works, who relies on these tools, the comparison modes, and the mistakes worth dodging.
Follow along with our free Text Diff tool. Paste two versions, see the differences light up instantly. It runs entirely in your browser, so your text never leaves your device.
Open the Text Diff Tool →What Is a Text Diff Tool?
A text diff tool, sometimes called a diff checker or text comparison tool, finds the difference between two pieces of text. The word "diff" is short for difference, and the concept comes straight from the Unix diff command that programmers have used since the 1970s to compare files.
The output is the useful part. Instead of just telling you the two texts are different, a diff tool shows you exactly where and how. Added text is typically marked in green, removed text in red, and anything unchanged is left alone. Some tools show the two versions side by side, others stack the changes inline. Either way, you see the edits at a glance rather than reading both versions in full and hoping to catch the one word that moved.
How Do You Use a Text Diff Tool?
Using one takes three steps and no technical skill at all:
- Paste your original text. Drop the first version into the left or top box. This is your "before".
- Paste the changed text. Put the revised version into the second box. This is your "after".
- Read the highlights. The tool compares them and marks what was added, removed, or kept. Scan the colored sections to see every change.
From there you can usually switch the comparison mode (more on that below) or toggle whether to ignore whitespace, which is handy when only the spacing changed and you don't care. The best part is speed. A diff that would take minutes to find by hand shows up the instant you paste. Pair it with our remove duplicate lines tool or word counter when you're cleaning up text.
Paste two versions of anything, an email draft, a paragraph, a config file, into the free Text Diff tool and watch the changes appear. No signup, nothing sent to a server.
Open the Text Diff Tool →How Does a Diff Tool Actually Work?
Under the hood, a diff tool is solving a genuinely elegant computer science problem: what's the smallest set of edits that turns text A into text B? It doesn't just compare line one to line one. It finds the longest sequence of content the two texts share, then treats everything else as additions or deletions.
That framing goes back to the original Unix tool. In "An Algorithm for Differential File Comparison", Bell Laboratories Computing Science Technical Report #41, dated July 1976, J. W. Hunt of Stanford and M. D. McIlroy of Bell Labs wrote that "the central algorithm of diff solves the 'longest common subsequence problem' to find the lines that do not change between files." They reported something that still holds up fifty years later: on real data, time and space usage was observed to grow roughly as the sum of the two file lengths, even though the worst case grows as the product. Diff was fast in practice because real edits are small.
The method most tools use today comes from a 1986 paper by Eugene W. Myers, then at the University of Arizona, "An O(ND) Difference Algorithm and Its Variations", published in Algorithmica, volume 1, pages 251 to 266. Myers showed that finding a longest common subsequence and finding a shortest edit script are equivalent to finding a shortest path across an "edit graph," then built a greedy algorithm running in O(ND) time and space, where N is the combined length of the two texts and D is the size of the smallest edit script. He also gave a refinement needing only O(N) space and, using suffix trees, a variation running in O(N log N + D²) time. In his own words, the algorithm "performs well when differences are small (sequences are similar) and is consequently fast in typical applications," which is exactly the case when you're comparing two drafts of the same paragraph.
That paper is not a museum piece. Git's official git diff documentation still lists myers as "the basic greedy diff algorithm" and notes that "currently, this is the default." Nearly forty years on, the thing highlighting your pull request is Myers. For the wider role of diffing inside version control, Petr Baudis surveys the field in "Current Concepts in Version Control Systems".
How Do You Read a Diff Output?
Every diff view uses the same three signals, so learning them once covers all of them:
- Green, or a leading
+, means added. This content is in the second version and wasn't in the first. - Red, or a leading
-, means removed. It was in the original and is gone from the revision. - Plain text means unchanged. It's shown as context so you can see where each change sits.
The original diff was terser about it. Hunt and McIlroy's report describes only three operations, append, change and delete, abbreviated to a, c and d, with lines from the first file flagged < and lines from the second flagged >. A line reading 3,4c4,6 means lines 3 to 4 of the original became lines 4 to 6 of the revision. That shape survives in the unified format Git prints, where a hunk header like @@ -3,4 +4,6 @@ carries the same information in a different order.
Browser tools drop the notation and color the text instead, which is why non-programmers can pick them up in seconds. The logic underneath is identical. And if a change looks bigger than you expected, it's usually the mode or the whitespace setting rather than the text.
Who Uses Text Diff Tools and Why?
Far more people than you'd guess. The obvious crowd is developers, but writers, editors, students, and legal and admin staff all lean on diffs.
- Developers compare versions of code and config files to see exactly what a change touched before they ship it.
- Writers and editors check what a reviewer altered in a draft, or compare two versions of an article without a full track-changes setup.
- Students and researchers compare drafts of an essay, or check their work against a source to be sure it isn't too close.
- Legal and admin teams spot every change between two versions of a contract or policy, where a single altered word can matter enormously.
Diffing is woven deepest into software work, and the numbers there are large. The Stack Overflow 2024 Developer Survey gathered responses from 65,437 developers across 185 countries, and the daily workflow that population shares is built on Git, which shows you a diff every time you stage a change or open a pull request. That's why the red-and-green change view has become a shared visual language: millions of people read one every working day, so a standalone diff tool feels familiar the first time you open it. For more of the everyday tools that fit this workflow, see our guide to free online developer tools.
What Are the Different Comparison Modes?
Not every diff should be measured the same way. Most tools let you choose how finely to split the text before comparing, and picking the right mode makes the result far easier to read.
| Mode | Compares by | Best for |
|---|---|---|
| Line | Whole lines at a time | Code, config files, structured data |
| Word | Individual words | Prose, essays, editing drafts |
| Character | Single characters | Spotting a typo or a changed digit |
Line mode is the classic and what Git shows you by default. Word mode is the friendliest for regular writing, because it points at the exact words that changed instead of flagging a whole line. Character mode is the most precise but can look busy, so save it for when you're hunting a tiny change, like a single wrong number in a long string.
Git can do word-level comparison too. Its documentation describes --word-diff, which by default delimits words by whitespace and shows removals as [-removed-] and additions as {+added+}. Useful when a prose file has been rewrapped and line mode turns the whole paragraph red.
Which Diff Algorithm Should You Use?
In a browser tool you usually don't choose, and you don't need to. In Git you can, and it changes how readable a messy diff looks. The official documentation for --diff-algorithm lists four options:
| Algorithm | What the Git docs say | When it helps |
|---|---|---|
| myers | "The basic greedy diff algorithm. Currently, this is the default." | Almost everything. Leave it alone unless a diff reads badly. |
| minimal | "Spend extra time to make sure the smallest possible diff is produced." | Small files where you want the tightest possible result. |
| patience | "Use 'patience diff' algorithm when generating patches." | Refactors where blocks moved and the default output looks scrambled. |
| histogram | "This algorithm extends the patience algorithm to 'support low-occurrence common elements'." | Code full of repeated lines, like closing braces or blank lines. |
The practical takeaway for everyone else: if a diff looks noisier than the edit deserves, the algorithm is not usually the culprit. Whitespace is. Git's -w flag, documented as --ignore-all-space, will "ignore whitespace when comparing lines," and most browser tools have the same switch under a plainer name.
What Mistakes Should You Avoid?
Diff tools are simple, but a few habits trip people up:
- Using the wrong mode. Running a character diff on two long essays buries the real changes in noise. Match the mode to the content.
- Forgetting about whitespace. If a tool counts spaces and tabs, a file that only had its indentation reformatted can look completely rewritten. Turn on "ignore whitespace" when the spacing doesn't matter.
- Pasting sensitive text into a server-based tool. For a contract or private code, use a tool that works in your browser so nothing is uploaded.
- Assuming diff means merge. A diff shows changes; it doesn't combine them. If you need to blend two versions, you want a merge tool, not a plain diff.
- Comparing texts that are formatted differently. One version with curly quotes and another with straight quotes will show differences that aren't really edits. Normalize the formatting first.
Get those right and a diff tool becomes one of those quiet utilities you reach for constantly. Keep the Text Diff tool in a tab, and check our free tools for developers for the rest of the kit.
What Else Do People Ask?
What is a text diff tool?
A text diff tool compares two blocks of text and highlights exactly what changed between them: what was added, what was removed, and what stayed the same. You paste an original and a revised version, and the tool marks the differences line by line or word by word. It saves you from squinting at two documents side by side trying to spot a single edit. Our free Text Diff tool runs entirely in your browser.
How do you compare two texts online?
Open a text diff tool, paste your original text into the first box and the changed version into the second, then let it highlight the differences. Additions usually show in green and deletions in red. You do not need to install anything or write code. Adjust the comparison mode to word, line, or character level depending on how fine-grained you want the result to be.
Is it safe to paste text into an online diff tool?
It depends on the tool. The safest ones do all the comparison in your browser, so your text is never uploaded to a server. That matters for anything private, like a contract draft or unreleased code. Check that the tool says it works locally, and for truly sensitive material, prefer a browser-based tool or an offline one over anything that sends your text away to process it.
What is the difference between word, line, and character diff?
They control how finely the tool splits the text before comparing. Line diff marks whole lines as changed and suits code and structured files. Word diff highlights the specific words that changed and reads best for prose and editing. Character diff goes down to individual letters, which is handy for spotting a single typo or a changed digit but can look noisy on longer text.
Can a diff tool merge changes?
Some can, but a basic diff tool only shows the differences. Merging means combining two versions into one, choosing which change to keep where there is a conflict. Full version control systems like Git include merge tools, and some online diff checkers offer a merge view. For simply seeing what changed between two texts, a plain diff tool is all you need.