How to Compare Two Text Files and Spot Changes

Updated 2026-06-21

To compare two text files, paste the original into the left box and the changed version into the right, then read the highlighted result: green marks additions, red marks deletions, and changed lines are paired so you can see exactly what moved. The Text Diff & Compare tool does this instantly in your browser — nothing is uploaded.

Step by step

  1. Open Text Diff & Compare and paste your original text on the left and the changed text on the right. You can also drag a file straight onto either box.
  2. Pick a view: Side by side shows the two versions in parallel columns with line numbers; Inline stacks additions and deletions in one stream; Unified produces the classic plus/minus patch format you see in code reviews.
  3. Choose a granularity — Lines, Words, or Chars. Lines is best for code and config; Words suits prose and copy edits; Chars catches a single transposed letter or punctuation mark.
  4. Read the four stats at the top: additions, deletions, unchanged units, and an overall similarity percentage so you know at a glance how much really changed.

A worked example

Say you tweaked a function. The original returns a message; the new version adds a greeting argument and trims the result. In side-by-side line view, the unchanged lines stay neutral, the modified lines turn amber, and within those lines the exact characters that differ are highlighted — the added template string in green on the right, the old concatenation in red on the left. You instantly see what changed, not just that something did. Hit Copy unified to grab a standard patch for a commit or a pull request.

Handle whitespace and casing

Real files are messy. Three toggles keep noise out of the diff:

A common pitfall is comparing files saved with different line endings or stray trailing spaces, which makes lines look different when the content is the same. Turn on Ignore whitespace and Trim lines to focus on substance. Use Swap to flip which side is the original if you pasted them in the wrong order.

Why compare in the browser

Because everything runs locally, your text never leaves your machine — no upload, no server, no account. That matters when you are diffing contracts, API keys, internal scripts, or unpublished copy. There is no file-size login wall and no waiting on a network round trip; results update as you type.

Whether you are reviewing a code change, proofreading two drafts, or hunting a one-character typo, paste both versions into Text Diff & Compare and see the difference in seconds.

Try the Text Diff & Compare →