How to compare two texts and read a diff
By Priyabrata Saha · Published 4 November 2026
Short answer
Paste the original on one side and the changed version on the other. A diff tool aligns matching lines and marks the rest as added, removed or changed. Normalise formatting first, and only ignore case or whitespace when those differences genuinely do not matter.
Why reading side by side fails
People are poor at spotting small differences in long text. A changed digit, a missing “not” or a line that moved from one paragraph to another is easy to read straight past. A diff does the comparison mechanically, so nothing is skipped because it looked familiar.
How a diff lines up two texts
Text Compare uses the Myers algorithm, the same approach behind git diff. It finds the smallest set of line insertions and deletions that turns the original into the new version. Lines that survive unchanged anchor the alignment, so one inserted line does not make everything after it look different.
When a removed line and an added line sit in the same place, the tool shows them as a single changed row and highlights the words that differ. That is usually what you want to see: “timeout = 30” became “timeout = 60”, rather than an unrelated deletion and addition.
Reading a unified diff
The unified format is what git, code review tools and patch files use. It starts with two header lines naming the original and changed texts, then lists every line with a one-character prefix.
- A leading space means the line is the same in both versions.
- A minus sign means the line exists only in the original.
- A plus sign means the line exists only in the new version.
- A changed line appears as a minus line followed by a plus line.
A worked example
Compare a config file that read “timeout = 30, retries = 3, mode = fast” with a new version where the timeout is 60 and a fourth line, “log = on”, has been added. The diff shows −timeout = 30 and +timeout = 60 next to each other, the two unchanged lines with a leading space, and +log = on at the end. Four lines of output tell you everything that happened.
Avoiding false differences
Most noise in a diff comes from formatting rather than content. Reformat both sides the same way before comparing. For JSON, run each side through JSON Formatter with the same indentation; for prose pasted from PDFs or emails, Remove Extra Spaces evens out stray spaces and blank lines.
Text Compare can also ignore case, whitespace or blank lines. Use these options deliberately. They are right for comparing two drafts of an article and wrong for auditing code, YAML or a contract, where a change in indentation or capitalisation can change the meaning.
A line-based diff does not understand structure. Two JSON files with the same data in a different key order will show differences. Sort keys on both sides first if order does not matter to you.
Keeping the result
Download the comparison as a .diff file to attach to a ticket or email, or copy it into a code review. The on-screen table shows up to 800 rows; the download always contains the full diff. Both texts stay in your browser throughout, which matters when you are comparing contracts, internal documents or production configuration.