How to Compare Two Texts and Find the Differences Online
Quick answer: Here is how to compare two texts. Paste each one into a text compare tool and read the highlighted changes. For formatted files, use Compare in Word or Compare documents in Google Docs. Pick the level that fits: lines for lists and code, words for prose, characters for short strings.
Comparing by eye versus using a tool
Reading two versions side by side works for a couple of sentences. It fails on long lists, repeated paragraphs and anything with invisible differences. Two texts can look identical and still differ by a trailing space, a tab, a non-breaking space or a zero-width space. A comparison tool draws those characters as symbols, so you can see them.
Knowing how to compare two texts mostly comes down to choosing the right level of detail and deciding which differences matter. The unified diff format marks changes with a few symbols, listed on the card below.

Line, word or character: which level to pick
A diff can work at three levels. The right one depends on what your text is.
| Level | Best for | What gets marked |
|---|---|---|
| Lines | Lists, code and documents | Whole lines removed or added, plus the changed words inside each changed line |
| Words | Prose, such as two drafts of an email | Individual words |
| Characters | Short strings such as codes, names and IDs | Individual characters, including hidden ones |
Start with lines for anything structured. Switch to characters when two strings look the same but are reported as different. The cause is likely a hidden character such as a trailing space.
Ignore case and whitespace when they are noise
If you remember one thing about how to compare two texts, make it this: decide what counts as a difference before you start. A capital letter, an extra space or a different line ending can flood a comparison with marks that are not real changes. Ignore options remove that noise:
- Ignore case treats upper and lower case as equal, so “Hello” and “hello” match.
- Ignore whitespace counts any run of spaces or tabs as one space. In Words and Characters modes, line breaks count as whitespace too.
- Trim lines ignores spaces and tabs at the start and end of each line.
- Blank lines ignores changes that only add or remove empty lines.
The last two apply in Lines mode. Different systems mark line endings differently (CRLF, LF and CR), and the text compare tool treats all three as the same. If two texts match only because of the options you ticked, the tool tells you so.
How to compare two texts with the text compare tool
- Paste the original into one box and the changed version into the other, or open a plain text file for either side.
- Choose Lines, Words or Characters. Changes show as you type.
- Tick any ignore options that apply.
- Pick a view: Side by side, Split, Inline or Changes only.
- Use Previous and Next to step through the changes. A counter such as “Change 3 of 12” shows where you are.
- In Lines mode, press Copy unified diff or Download .diff to keep the result.
Removed text is shown with a minus sign or strikethrough, and added text with a plus sign or underline, so the marks do not rely on color alone. The tool also reports how similar the texts are: twice the unchanged part divided by the total in both texts. A result of 100% means no differences, so any change keeps the figure at 99% or below.
Some limits are worth knowing. Each side holds up to 100,000 characters. The tool handles plain text only, not bold, colors or Word, PDF and Excel files. It does not detect moved text, so a paragraph you moved shows as removed in one place and added in another. Everything runs in your browser and nothing is uploaded. If your text came from a formatted page, the remove text formatting tool gives you clean plain text first, and keeping each draft as its own note in the online notepad makes them easy to copy across.
Compare two Word documents
Word has its own comparison feature that works on formatted files and shows the differences as revision marks. Microsoft’s guide to the legal blackline option gives these steps for Word on Windows:
- Open the two documents.
- On the Review tab, in the Compare group, select Compare.
- Choose the option to compare two versions of a document (legal blackline).
- Under Original document, pick the original. Under Revised document, pick the other version.
- Under Show changes, choose character level or word level.
- Select OK. If either file already has tracked changes, Word asks whether to accept them first.
Word opens a new third document that shows the differences, and your two source files are not changed. On Word 2019 for Mac, the path is Review, then Compare, then Compare Documents, and the revised copy is merged into a new copy based on the original.
Compare two Google Docs
Google Docs has a similar feature. According to Google’s help page on comparing documents, you follow these steps:
- Open the primary document.
- Go to Tools, then Compare documents.
- Optionally set a name for the suggested edits and tick Include comments.
- Select the document to compare against. A Word file works too if it is stored in Google Drive.
- Click Compare, then Open.
The result is a third Google Doc that shows the differences as suggested edits. Google notes that changes to column layout and table column width are not compared.
How a diff works and how to read a unified diff
The Unix tool diff was written at Bell Labs in the early 1970s. According to Wikipedia’s article on diff, its operation is based on the longest common subsequence problem: find what the two texts share, and everything else is an addition or a removal. The text compare tool uses the Myers algorithm, which finds the fewest additions and removals that turn one text into the other.
The unified format is a common way to write a diff as plain text. It begins with two header lines, then a marker for each hunk, then the changed lines:
--- old.txt +++ new.txt @@ -1,3 +1,3 @@ Dear team, -The meeting is on Monday. +The meeting is on Tuesday. Thanks
The line starting with — names the original file and the one starting with +++ names the new file. The @@ line says which lines the hunk covers in each file. A leading space marks an unchanged line, a minus marks a line removed from the original, and a plus marks a line added in the new file. A modified line appears as one deletion followed by one addition, as in the example.
That covers how to compare two texts with a tool, in Word and in Google Docs. To see a diff like this without installing anything, open the text compare tool. It compares two pieces of plain text in your browser, highlights what changed at line, word or character level, and can copy the result as a unified diff.
Frequently asked questions
How do I compare two texts online?
Paste the original into one box and the new version into the other. A text compare tool marks every addition and removal as you type. In this tool the text stays in your browser and is not uploaded.
Why do two texts that look identical show differences?
They usually contain invisible characters, such as trailing spaces, tabs, non-breaking spaces or zero-width spaces. Switch to Characters mode to reveal them, or tick the ignore whitespace option if they do not matter.
Can I compare Word or PDF files in a text compare tool?
Not directly. Copy the text from each file into the two boxes, or open a plain text file. For tracked formatting changes, use Review, then Compare in Word.
How does a diff tool decide what changed?
It finds the longest sequence of content both texts share and marks the rest as removed or added. Because it only sees additions and removals, a moved paragraph shows up as one of each.