utilobox

How to compare two texts and see exactly what changed

You have a first draft and a revised one, two lists that should match, or a pasted copy that looks slightly different from the source. This guide shows how to compare two texts in the browser, which comparison mode to pick, and how to read the result without being misled.

Last updated:

Compare two texts: the idea in one minute

A comparison takes an original text and a changed text, finds the longest stretches they share, and marks everything else as removed or added. You do not have to hunt for the difference by reading both versions; you read one view in which the unchanged parts stay quiet and the changes stand out. Text compare (diff) does this for pasted text. It reads what is in the two boxes and nothing else, so it fits drafts, lists, notes, snippets and plain-text exports.

It compares characters of text, not meaning. A sentence reworded to say the same thing is a difference, and two texts that look identical on screen but differ by a hidden space are different too. That second case is often the very reason people compare two texts, and the tool is good at it, provided you choose the right mode.

Step by step

To compare two texts, paste the older or reference text into ‘Original text’ and the newer text into ‘Changed text’. The comparison appears below as you type, after a short pause. If you want to see how the tool works before using your own text, press ‘Try an example’, which fills both boxes with a short sample.

Under ‘Compare by’, choose ‘Lines’, ‘Words’ or ‘Characters’. Under ‘View’, choose ‘Side by side’ or ‘Inline’. Side by side shows the two versions in two columns with line numbers and suits a wide screen. Inline merges both into one column, which is easier on a phone. ‘Swap texts’ exchanges the two boxes when you pasted them in the wrong order, and ‘Clear both’ starts over.

The result is colored: removed parts are red and added parts are green, and the legend uses the words ‘Removed’ and ‘Added’. Above it the status line summarizes the totals, for example how many items were removed and added, counted in lines, words or characters.

Lines, words or characters: which mode fits

Use ‘Lines’ when the text is organized in lines: lists, code, settings, poems, address lists, one-sentence-per-line drafts. A changed line shows as a removed line followed by an added line, and inside such a pair the exact words that differ are marked more strongly, so a single changed word does not hide in a long line.

Use ‘Words’ for running prose such as an essay or a letter where a paragraph is one long line. Line mode would mark the whole paragraph as changed, while word mode shows only the words that moved. Use ‘Characters’ for very small differences: a swapped pair of letters, a missing digit in a reference number, a different kind of apostrophe. It is slower to read on long text, but it is the mode that finds a single wrong character.

If you are not sure, start with ‘Lines’ and switch to ‘Words’ when you see big red and green blocks that look almost the same. Changing the mode is instant and does not lose your text.

Ignore case and spaces to remove noise

Two options hide differences that you may not care about. ‘Ignore upper/lower case’ treats a capital and its lowercase twin as equal, which is right when a text was only re-capitalized. ‘Ignore spaces’ ignores differences in spacing: in line mode, runs of spaces and tabs count as one space and spaces at the ends of a line are dropped, and in word and character mode, any whitespace counts as equal to any other.

These switches are the quickest way to answer the question “did anything change except formatting?”. Compare once with both switched on. If the result says the texts are identical, the only differences were case or spacing. Then switch them off to see where those differences are, if you need to.

Remember that ignoring spaces can hide real problems too, such as a missing space between two words in a form field. When the exact characters matter, as in a code, a password policy text or a reference number, leave both options off.

Reading the counts and the similarity figure

Below the boxes, the tool shows ‘Removed’, ‘Added’ and ‘Unchanged’, followed by ‘Similarity’. The units are lines, words or characters depending on the mode, and in word and character mode spaces are not counted. Similarity is twice the unchanged amount divided by the combined size of both texts, so two identical texts give 100 percent and two texts with nothing in common give 0.

If you compare two texts of different lengths, treat the percentage as a rough sense of how much was rewritten, not as a score of quality. Changing one word in a three-word line lowers the line-mode figure a lot, while the same change in the word mode barely moves it. Compare figures only between runs in the same mode.

Long runs of unchanged lines are folded to keep the page short, and a button such as ‘Show 40 unchanged lines’ opens them. Three lines of context are kept around each change, so you can see where in the document the change sits.

Copying the result

‘Copy result’ gives a plain-text version of the comparison. In line mode every line starts with a minus sign for removed, a plus sign for added, or two spaces for unchanged. In word and character mode the changes are written inline, with removed text between [- and -] and added text between {+ and +}. You can paste this into a note or message to show a colleague what changed without sending both full versions.

The colors do not copy, which is why the markers exist. If someone must understand the change without the tool, the marker version is the safest to send.

When the result looks wrong

When you compare two texts and everything is marked as changed, check the line endings and the first character. Text copied from different places sometimes has a leading space, a tab or an invisible character on every line, and ‘Ignore spaces’ will remove the first two. If two lines look the same but are marked, switch to ‘Characters’ for just that line and look for a different quote mark, a dash of another length, or a space that is not an ordinary space.

When two texts are very different, the tool does not build a long, confusing comparison. It shows a message that the texts are too different for a detailed comparison and presents the changed part as a single replacement. That is the signal that you are comparing the wrong pair, or that the text was rewritten rather than edited.

The comparison runs in your browser and neither text is uploaded. The options you choose are remembered on the device, but the two texts themselves are not saved, so keep your own copy of anything you need later.

Questions and answers

How do I compare two texts online?

Paste one text into ‘Original text’ and the other into ‘Changed text’. The differences appear below at once, with removed parts in red and added parts in green.

What is the difference between Lines, Words and Characters?

Lines marks whole lines that differ, Words marks the words that were added or removed in running text, and Characters finds tiny edits such as one swapped letter.

Can I ignore capital letters and extra spaces?

Yes. Tick ‘Ignore upper/lower case’ or ‘Ignore spaces’ and differences that come only from capitals or spacing are no longer marked.

What does the Similarity percentage mean?

It shows how much of the two texts is shared. 100 percent means identical, and the figure is only comparable between runs in the same mode.

How do I share the differences with someone?

Press ‘Copy result’. You get plain text in which removed and added parts are marked with symbols, so it still makes sense without the colors.

Are my texts stored or uploaded?

No. The comparison is done in your browser. Only your option choices are remembered, not the text.