How to compare two texts and find the differences
Paste the original into one box of a diff tool and the new version into the other: it lines the two up and marks every added, removed and changed line, with the changed words highlighted. For Word files, Google Docs or code files, the app you already use has a built-in compare command.
Published
To compare two texts, paste the original version into the left box of Text compare and the new version into the right box. The tool matches the lines the two texts share. It then marks every line that was removed (red, struck through), added (green) or edited (shown side by side, with only the changed words highlighted). The rest of this guide covers how to read the result, how to prepare text so the diff shows only real changes, and how to do the same job in Word, Google Docs, VS Code, Notepad++, Excel and the command line.
Compare two texts online in four steps
- Open Text compare and paste the first version into Original text.
- Paste the second version into Changed text. The summary under the options updates at once, for example 1 line added, 1 removed, 3 unchanged.
- If capital letters or spacing do not matter, tick Ignore case or Ignore spaces at line ends and repeated spaces.
- To list only what changed, untick Show unchanged lines. Switch View to One column if the two columns are too narrow on your screen.
Both texts are compared in your browser and never uploaded. That matters when you compare contracts, unpublished drafts or customer lists.
How to read a diff
A diff works line by line first. It finds the largest set of lines the two texts share in the same order. Everything else is either a removal from the original or an addition in the new version. Inside a line that was edited, it runs the same matching again on the words, so you see exactly which words changed.
The summary counts lines, not words. An edited line counts as one line removed (the old version) and one line added (the new version), even if only one character changed. Here is a three-sentence lease clause where only the late fee changed, with one sentence per line:
| Original | Changed | Shown as |
|---|---|---|
| The tenant pays rent on the first day of each month. | The tenant pays rent on the first day of each month. | Unchanged |
| Late payments incur a fee of $50. | Late payments incur a fee of $75. | Changed: 50 → 75 |
| The lease runs for 12 months. | The lease runs for 12 months. | Unchanged |
Summary: 1 line added, 1 removed, 2 unchanged.
If the same three sentences are pasted as one paragraph on a single line, the tool still highlights only 50 → 75. The summary, however, reads 1 line added, 1 removed, 0 unchanged, because the whole paragraph is one line. Word highlights work on long lines, but line numbers and the summary are more useful when each sentence or item is on its own line.
Prepare the texts so only real changes show
Most noisy diffs come from differences you do not care about. Fix them before you compare, or use the options.
| Noise | What you see | Fix |
|---|---|---|
| Different capitalization | Hello world vs hello World reported as changed |
Tick Ignore case |
| Extra spaces, tabs or indentation | Hello world vs Hello world reported as changed |
Tick Ignore spaces at line ends and repeated spaces, or clean both with Remove extra spaces |
| Blank lines added or removed | Empty lines reported as removed | Run both through Remove empty lines |
| Same items in a different order | Moved lines reported as removed and added | Sort both with Sort lines |
| Repeated items | Duplicates reported as extra lines | Run both through Remove duplicate lines |
| Invisible characters | Lines that look identical but are marked as changed | Clean both with Remove invisible characters |
Line endings are not a problem in Text compare: Windows, old Mac and Unix line breaks are treated as the same, and a missing final line break is not reported.
Comparing two lists
Order matters to a diff, and for lists it often should not. Take two exports of a mailing list:
Original Changed
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
Compared as they are, the result is confusing. [email protected] is shown as added at the top. At the bottom, [email protected] → [email protected] is shown as one edited line, because a removed line and an added line next to each other are paired. Summary: 2 lines added, 2 removed, 2 unchanged.
Sort both lists alphabetically with Sort lines first and the answer is clear: [email protected] removed, [email protected] added, and three addresses unchanged. Summary: 1 line added, 1 removed, 3 unchanged. If the exports differ in capitalization, tick Ignore case as well.
Compare documents in Word and Google Docs
Pasting text loses formatting, so for formatted documents the editor’s own compare command is usually better.
Microsoft Word. Open one of the two versions. On the Review tab, select Compare > Compare Documents. Choose the earlier file under Original document and the other under Revised document, then select OK. Microsoft says Word merges the changes into a new copy based on the original, shows the differences as revision marks and leaves the original untouched.
Google Docs. Open the main document and click Tools > Compare documents. Select the document to compare against, click Compare, then Open. The result is a new document with the differences shown as suggested edits. You can set the name the edits are attributed to and tick Include comments. The other file can be a Word (.docx) file in your Google Drive. Google notes that changes to column layout and table column width are not compared.
Compare text files in VS Code, Notepad++ and the command line
Visual Studio Code. Run code --diff file1.txt file2.txt (or code -d) in a terminal to open the two files in VS Code’s difference editor.
Notepad++. Notepad++ has no compare command built in. Open Plugins > Plugins Admin, tick the ComparePlus plugin and select Install. Notepad++ restarts. ComparePlus then compares two open files and shows the differences side by side. Its README says it is available from Plugins Admin in Notepad++ versions above 8.4.5.
Windows command line. fc file1.txt file2.txt compares two files line by line. /c ignores case, /w compresses spaces and tabs and ignores white space at the start and end of lines, and /n shows line numbers. In PowerShell, type fc.exe, because fc there is an alias for Format-Custom. Microsoft’s documentation notes that fc stops with “Resynch failed. Files are too different.” when it cannot find matching lines within its 100-line buffer, so very different files are better compared elsewhere.
macOS and Linux. diff file1.txt file2.txt prints the differing lines. Useful options from the GNU manual: -u for the unified format with three lines of context, -y for side by side, -i to ignore case, -w to ignore white space and -q to report only whether the files differ.
| Where your text is | Quickest way to compare |
|---|---|
| Copied text, emails, web pages | Text compare |
| Two Word files | Word: Review > Compare > Compare Documents |
| Google Docs or a Doc and a .docx | Google Docs: Tools > Compare documents |
| Code or config files | code --diff, diff -u or fc |
| Two columns in a spreadsheet | =EXACT(A2,B2) in a helper column |
Compare two columns in Excel
To check row by row whether two columns hold the same text, put =EXACT(A2,B2) in a helper column and fill it down. Microsoft documents EXACT as case-sensitive and says it ignores formatting differences: it returns TRUE only when the two strings are exactly the same. To see what differs inside a long cell, copy the two cells into Text compare. To find which values appear in one column but not the other, regardless of row, copy each column into Text compare after sorting both, as in the list example above.
Questions
What is the quickest way to compare two texts?
Paste one version into each box of Text compare. The result appears as you type, with removed text in red, added text in green and the changed words highlighted inside each edited line. Nothing is uploaded.
How do I compare two Word documents?
Open one of them, then on the Review tab choose Compare > Compare Documents, pick the original and the revised file and select OK. Word builds a new document that shows the differences as revision marks and leaves the original untouched.
Can I compare a Google Doc with a Word file?
Yes. In Google Docs choose Tools > Compare documents and pick a .docx file stored in your Google Drive. Google says no conversion is needed first.
Why does a diff show a line I only moved as removed and added?
Line-based diff tools keep lines in order, so a line that moved cannot be matched in both places. If order does not matter, as in a list, sort both versions first.
How do I check whether two columns in Excel match?
In a third column, enter =EXACT(A2,B2) and fill it down. Microsoft documents EXACT as case-sensitive and says it ignores formatting differences. It returns TRUE when the two cells hold exactly the same text.
Sources
- Microsoft Support, Compare and merge two versions of a document, https://support.microsoft.com/en-us/word/compare-and-merge-two-versions-of-a-document (checked 2026-10-21)
- Google Docs Editors Help, Compare documents in Google Docs, https://support.google.com/docs/answer/18512262?hl=en (checked 2026-10-21)
- Visual Studio Code, Command Line Interface (CLI), https://code.visualstudio.com/docs/configure/command-line (checked 2026-10-21)
- Notepad++ User Manual, Plugins, https://npp-user-manual.org/docs/plugins/ (checked 2026-10-21)
- ComparePlus plugin for Notepad++, README, https://github.com/pnedev/comparePlus (checked 2026-10-21)
- Microsoft Learn, fc (Windows commands), https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/fc (checked 2026-10-21)
- GNU Diffutils manual, Options to diff, https://www.gnu.org/software/diffutils/manual/html_node/diff-Options.html (checked 2026-10-21)
- Microsoft Support, EXACT function, https://support.microsoft.com/en-us/office/exact-function-d3087698-fc15-4a15-9631-12575cf29926 (checked 2026-10-21)