Text Tools
Fancy Text
Calculators
Everyday helpers

Quick calculators

Percentages, money, grades, math, age, sleep and time tools.

Browse all calculators
% Percentage Calculator Percent of, change and difference ½ Fraction Calculator Add, subtract and simplify fractions A+ Grade Calculator Weighted grade and final exam score 4.0 GPA Calculator Semester and cumulative GPA Av Average Calculator Mean, median, mode and range σ Standard Deviation Calculator Spread of a data set, step by step 1:2 Ratio Calculator Simplify and scale ratios ≈ Rounding Calculator Round to any place or figure 1.0 Significant Figures Calculator Count and round significant figures ft² Square Footage Calculator Area of rooms and shapes Tp Tip Calculator Work out the tip and split the bill Ex Expense Calculator Track and total your spending Ag Age Calculator Exact age in years, months and days Zz Sleep Calculator Find a good time to sleep or wake t± Online Time Calculator Add and subtract hours and minutes Di Discount Calculator Sale price, percent off, stacked deals St Sales Tax Calculator Add, remove or find tax, VAT mode Si Simple Interest Calculator Interest, principal, rate or time Ci Compound Interest Calculator Growth, deposits, schedule and APY Pm Payment Calculator Loan payment, total interest Ir Interest Rate Calculator Rate from amounts or payments Fv Future Value Calculator Deposits, growth, compounding Pv Present Value Calculator Discount a lump sum or payments Fn Finance Calculator Solve N, rate, PV, PMT or FV Ro ROI Calculator Net gain, ROI and break-even Cm Commission Calculator Flat, tiered or base plus commission Sa Salary Calculator Hourly, weekly, annual pay E+ Scientific Notation Calculator Convert and calculate in E notation
Health
Dev Tools
More
Menu
Text Tools
Fancy Text
Calculators
Everyday helpers

Quick calculators

Percentages, money, grades, math, age, sleep and time tools.

Browse all calculators
% Percentage Calculator Percent of, change and difference ½ Fraction Calculator Add, subtract and simplify fractions A+ Grade Calculator Weighted grade and final exam score 4.0 GPA Calculator Semester and cumulative GPA Av Average Calculator Mean, median, mode and range σ Standard Deviation Calculator Spread of a data set, step by step 1:2 Ratio Calculator Simplify and scale ratios ≈ Rounding Calculator Round to any place or figure 1.0 Significant Figures Calculator Count and round significant figures ft² Square Footage Calculator Area of rooms and shapes Tp Tip Calculator Work out the tip and split the bill Ex Expense Calculator Track and total your spending Ag Age Calculator Exact age in years, months and days Zz Sleep Calculator Find a good time to sleep or wake t± Online Time Calculator Add and subtract hours and minutes Di Discount Calculator Sale price, percent off, stacked deals St Sales Tax Calculator Add, remove or find tax, VAT mode Si Simple Interest Calculator Interest, principal, rate or time Ci Compound Interest Calculator Growth, deposits, schedule and APY Pm Payment Calculator Loan payment, total interest Ir Interest Rate Calculator Rate from amounts or payments Fv Future Value Calculator Deposits, growth, compounding Pv Present Value Calculator Discount a lump sum or payments Fn Finance Calculator Solve N, rate, PV, PMT or FV Ro ROI Calculator Net gain, ROI and break-even Cm Commission Calculator Flat, tiered or base plus commission Sa Salary Calculator Hourly, weekly, annual pay E+ Scientific Notation Calculator Convert and calculate in E notation
Health
Dev Tools
More
Blog Get the Chrome extension
Blog Get the Chrome extension
Guide

How to Compare Two Texts and Find the Differences Online

By Case Converter Tool · Updated · 7 min read

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.

Reference card of unified diff symbols: header lines, hunk marker, minus for removed, plus for added

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

  1. Paste the original into one box and the changed version into the other, or open a plain text file for either side.
  2. Choose Lines, Words or Characters. Changes show as you type.
  3. Tick any ignore options that apply.
  4. Pick a view: Side by side, Split, Inline or Changes only.
  5. Use Previous and Next to step through the changes. A counter such as “Change 3 of 12” shows where you are.
  6. 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:

  1. Open the two documents.
  2. On the Review tab, in the Compare group, select Compare.
  3. Choose the option to compare two versions of a document (legal blackline).
  4. Under Original document, pick the original. Under Revised document, pick the other version.
  5. Under Show changes, choose character level or word level.
  6. 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:

  1. Open the primary document.
  2. Go to Tools, then Compare documents.
  3. Optionally set a name for the suggested edits and tick Include comments.
  4. Select the document to compare against. A Word file works too if it is stored in Google Drive.
  5. 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.