Skip to content
Engyna

Text & writing

How to Compare Two Texts and Find the Differences

Spot every change between two versions of a document, contract or code snippet. Line, word and character diffs explained, with free tools that run in your browser.

Updated · 3 min read

Someone sends back "the final version" of a contract, and you need to know exactly what they changed. Or two config files behave differently and you can't see why. Reading both side by side and hoping to spot the difference is slow and unreliable. A diff does it precisely.

What a diff does

A diff algorithm finds the longest stretches both texts have in common and reports the rest as insertions or deletions. A change is shown as "removed old text, added new text".

Line, word or character?

The same change looks different depending on the granularity:

  • By line: any line that differs is marked as changed. Best for code, configuration files and lists, where lines are meaningful units.
  • By word: highlights the exact words that changed within a sentence. Best for prose, legal text and articles.
  • By character: highlights individual letters and digits. Best for catching typos, changed numbers in a table or a single altered ID.

A good tool combines these: it pairs changed lines and highlights the changed words inside them.

Compare two texts in your browser

  1. Open the text compare tool.
  2. Paste the original on the left and the new version on the right, or drop two files.
  3. Pick side by side or inline view, and compare by line, word or character.
  4. If the text was re-wrapped or re-indented, turn on ignore whitespace; if capitalization doesn't matter, ignore case.
  5. Jump from change to change with the navigation buttons.
  6. Copy or download the result as a standard .diff file.

Both texts stay on your device, which matters for contracts and anything confidential.

Reading the result

  • Green marks added text, red removed text.
  • The similarity score gives a rough sense of how much changed overall.
  • Unchanged sections can be collapsed so you only see the differences.

Alternatives for specific cases

  • Word documents: in Microsoft Word, Review → Compare → Compare… creates a document with tracked changes, including formatting changes.
  • Code in git: git diff shows changes since the last commit; git diff --word-diff works well for prose in repositories.
  • Command line: diff a.txt b.txt on macOS and Linux, fc a.txt b.txt on Windows.

Tips for clean comparisons

  • Convert both versions to plain text first. Copy-pasting from PDFs can introduce line breaks in the middle of sentences; compare by word in that case.
  • Normalize obvious noise, like different quote styles, with find and replace before comparing.
  • For long documents, check the overall size of the change with the word counter: a large difference in word count tells you to look for whole added or removed passages.

Typical use cases

  • Contracts and terms. Compare the version you sent with the one you got back, word by word, before signing.
  • Academic writing. See what a co-author changed in a chapter when they didn't use tracked changes.
  • Configuration files. Find the one setting that differs between a working and a broken server.
  • Translations. Check that a revised source text only changed in the places the translator was told about.
  • Data exports. Compare two CSV exports line by line to find added or removed records. Sort both first so the order doesn't create false differences.

Privacy

Many online diff checkers send both texts to their server. For confidential documents, use a tool that compares locally in the browser, like the one above, or a desktop tool.