How to compare two texts and find the differences

To compare two texts, paste the original and the changed version into a diff tool, which highlights every added, removed and changed part. For Word files you can also use Review > Compare, and in Google Docs Tools > Compare documents. Compare by lines for code and lists, by words for contracts and essays, and turn on ignore spaces when the texts come from different programs.

5 min read

The fast way

Paste the original text on the left (Original text) and the new version on the right (Changed text). The tool below compares them immediately: removed parts are shown in red, added parts in green, and inside changed lines the exact words that differ are highlighted. A summary shows how many lines, words or characters were added and removed, plus a similarity percentage.

This works for any plain text: contracts, offers, essays, translations, product descriptions, configuration files and code. If the documents are in Word or PDF, copy the text out of them first, or use the built in comparison features described below.

Try it here: Text Compare

Open the full tool page

Lines, words or characters

A comparison splits both texts into pieces and finds the smallest set of changes between them. The size of the pieces decides what the result looks like, so choose it to match the kind of text.

Compare byBest forWhat you see
LinesCode, lists, CSV, configuration files, documents with fixed line breaksWhole lines added or removed, with changed words marked inside edited lines
WordsContracts, essays, articles, emails, text copied from PDFInserted and deleted words in running text, regardless of line breaks
CharactersCodes, IDs, numbers, short values, spelling checksEvery single character that differs, such as 1O instead of 10

Comparing contracts and legal documents

With contracts, the risk is a small change hidden in a long text: a date, an amount, a notice period, a not added or removed. Never rely only on the other side's tracked changes or summary of edits; compare the version you agreed on with the version you are about to sign.

Use Words mode. Contracts copied from PDF or email often have line breaks in different places, and a line comparison would mark almost every line as changed. Turn on Ignore extra spaces so double spaces and different indentation do not count. Then read every highlighted change, paying special attention to numbers, dates, names, and words like may, must, shall, not, and, or.

  • Check that the similarity is what you expect. A contract with three small edits should be close to 100 percent.
  • Swap the texts with Swap if you pasted them the wrong way round; additions and removals switch places.
  • Keep the text you compared, so you can show later which version you checked.

Comparing Word and Google Docs files

Microsoft Word has a built in comparison: open Word, go to Review > Compare > Compare, choose the original document and the revised document, and click OK. Word creates a new document that shows the differences as tracked changes, which you can accept or reject one by one. It also compares formatting, which a plain text comparison ignores.

In Google Docs, open one version and choose Tools > Compare documents, pick the other file from your Drive and click Compare. The result opens as a new document with the differences as suggestions. LibreOffice Writer offers the same through Edit > Track Changes > Compare Document.

These built in tools need both files in the same program and are best for formatted documents. For text from emails, web pages, PDFs or chat messages, or when you only care about the words, pasting both versions into a text comparison is faster.

Comparing essays and drafts

Writers, students and editors compare drafts to see what an editor changed, to check that feedback was applied, or to find which paragraph was rewritten. Use Words mode and the Side by side view: the old draft stays on the left and the new one on the right, with changed words highlighted inside each paragraph.

For a quick overview, look at the summary first. A handful of changed words means copy editing; hundreds of added and removed words mean a real rewrite. The Unified view is handy for reading the changes in order from top to bottom, like a list of edits.

Comparing code and data files

Developers usually compare code with version control: git diff shows changes since the last commit, its word diff option shows changes word by word, and the -w option ignores whitespace. Outside a repository, the diff command on macOS and Linux compares two files, and in VS Code you can select two files in the Explorer, right click and choose Compare Selected.

For a quick check of a snippet, a configuration file from two servers, a JSON response or an exported CSV, pasting both into the tool on this page is often quicker. Use Lines mode, and Ignore extra spaces if indentation differs between the two. Line breaks from Windows, Mac and Linux are treated the same, so a file edited on another system does not show every line as changed.

Ignoring case and whitespace

Text copied from different programs often differs in invisible ways: tabs instead of spaces, two spaces after a full stop, spaces at the end of lines. Ignore extra spaces treats any run of spaces as one and ignores spaces at the line ends, so only real changes remain.

Ignore case treats Contract and contract as the same. Turn it on when capitalization does not matter, for example when comparing a list of email addresses, and leave it off for legal text and code, where a capital letter can change the meaning.

Common problems and fixes

  • Every line shows as changed: the line breaks differ, typical for text copied from PDF. Switch to Words mode.
  • Many tiny changes everywhere: indentation or spaces differ. Turn on Ignore extra spaces.
  • The result says the texts are too large: split them into parts, for example chapter by chapter, and compare each part.
  • Red and green are the wrong way round: press Swap so the original is on the left.
  • Formatting changes are missing: a text comparison only sees the words. Use Word's Compare to check bold, fonts and layout.

Step by step

  1. Paste both textsPaste the original into Original text and the new version into Changed text.
  2. Choose how to compareUnder Compare by, choose Lines for code and lists, Words for prose, or Characters for short values.
  3. Set the optionsTick Ignore extra spaces for text from different programs, and Ignore case if capitalization does not matter.
  4. Pick a viewChoose Side by side to see both versions, or Unified to read the changes in one column.
  5. Review the changesRead every red and green part and check the summary and similarity percentage.

Frequently asked questions

How do I compare two Word documents?

In Word, go to Review > Compare > Compare, select the original and the revised document and click OK. Word shows the differences as tracked changes in a new document.

Can Google Docs compare two documents?

Yes. Open one document, choose Tools > Compare documents, select the other file and click Compare. The differences appear as suggestions in a new document.

How do I compare two PDF files?

Copy the text from both PDFs and paste it into a text comparison, using Words mode because PDF line breaks rarely match. Some paid PDF editors also have a compare feature.

Should I compare by lines or by words?

Lines for code, lists and data files, words for contracts, essays and any text where line breaks may differ. Characters only for short values like codes.

What does the similarity percentage mean?

It shows how much of the text is unchanged. Two versions with a few small edits are close to 100 percent; a rewritten text is much lower.

Are my texts uploaded?

No. The comparison runs in your browser and nothing is sent to a server, so it is safe for contracts and internal documents.