What is text comparison?
Text comparison — also called "diff" — finds the exact differences between two versions of a text. Paste the original on one side and the changed version on the other, and every added, removed or changed line is highlighted. Writers use it to check edits, students use it to spot what changed between two drafts of an essay, and developers use it to compare code and config files. Without a diff tool, you read both texts line by line and hope you notice every change; with one, the changes jump out in seconds. Our Text Compare tool does this in your browser, line by line, up to 2,000 lines per text.
How a diff works
A diff tool splits both texts into lines, then matches them up. Lines that appear in both texts are shown as unchanged. Lines that appear only in the new text are shown as added, and lines that appear only in the old text are shown as removed. A line that was edited shows up as a removal plus an addition — the old version removed, the new version added. The tool works line by line, not word by word, so a single changed word marks its whole line as changed. That is why the result also gives line numbers: they tell you exactly where in the document each change sits.
How to compare two texts
Paste the original text into the "Original text" box and the changed text into the "Changed text" box — or click "Load sample" to try an example first. Click "Compare" and the result appears below, with added lines, removed lines and unchanged lines in different colours. The summary tells you how many lines were added, removed and changed. If you only care about meaning, tick "Ignore whitespace" and "Ignore case" before you compare; if exact spacing and capital letters matter — for example in code — leave them off.
Reading the result
Read the result top to bottom, in order. Unchanged lines are the context — they show you where the change sits. Added lines are new content that was not in the original. Removed lines are content that was deleted. A pair of a removed line and an added line in the same place is an edit: compare the two to see exactly what was reworded. If a whole block moved to a different place, it shows as removed in one spot and added in another — the tool cannot tell a move from a delete-plus-add, so check the text yourself when a large block appears twice.
Ignore whitespace and ignore case
"Ignore whitespace" treats extra spaces and tabs as the same, so a line that only moved a space does not show as changed. Use it when a document was reformatted and you only care about the words. "Ignore case" treats "Hello" and "hello" as the same line — useful when a text was retyped with different capitalisation. Turn both off when the exact text matters: in code, a space or a capital letter can change what the program does, and in a legal document, capitalisation can change the meaning.
Comparing code and config files
Developers compare code more than anyone. Before you deploy a website, compare the new config file with the one already live — a single changed line can explain a broken site. When a teammate sends you an updated script, compare it with your copy to see what they changed before you run it. When an API stops working, compare the old request with the new one. Always compare with whitespace and case sensitivity on for code, and read the line numbers — they refer to the part you pasted, so split long files into matching parts first.
Common mistakes
- Comparing texts in the wrong order. Original on the left, changed on the right — swapped, the additions and removals reverse.
- Pasting with different line breaks. A text copied from a PDF may have different line breaks from the original, making every line look changed.
- Ignoring the summary. The counts of added, removed and changed lines tell you at a glance how big the edit was.
- Comparing whole files at once. Over 2,000 lines, split the texts into matching parts and compare them one at a time.