What a text compare tool does
When two versions of a text look almost the same, finding the difference by eye is slow and unreliable. A text compare tool, also called a diff checker, does it for you. You paste the original text on one side and the changed text on the other, and the tool shows what was added, what was removed and what stayed the same.
People use it to check edits in an article, to compare two drafts of a contract or a letter, to see what changed in a configuration file, or to review a snippet of code before and after a fix. It is also useful for checking that a copy is exactly the same as the source.
How to read the result
The comparison works line by line. Every row of the result has a line number, and every changed row also has a sign.
- A minus sign marks a line that is only in the original text. These lines were removed or replaced.
- A plus sign marks a line that is only in the changed text. These lines were added or are the new version of a line.
- A row with no sign is the same in both texts.
Colors help, red for removed and green for added, but you never need them. The signs and the line numbers carry the same information, and screen readers announce each changed row as removed or added.
Inside a line that was changed, the tool also highlights the words that differ. If you changed "quick" to "slow" in the middle of a sentence, only that word is highlighted, so you do not have to read the whole line again. Highlighted words are also underlined.
Side by side or unified
Side by side puts the original on the left and the changed text on the right, with matching lines in the same row. It is the best view on a wide screen, because you can read the old and new version of a line together.
Unified shows a single column. Removed lines appear first, with the added lines right under them. It fits a narrow phone screen, and it is the format used by many developer tools. The tool picks Unified on narrow screens and Side by side on wide ones, and you can switch at any time.
The Copy unified diff button copies the result as plain text, with a header, change markers and three lines of context around every change. You can paste it into an email, a ticket or a review.
Options
Ignore case treats capital and small letters as the same, so "Hello" and "hello" match.
Ignore leading and trailing spaces removes spaces and tabs at the start and end of each line before comparing. It helps when text was re-indented. Spaces inside a line still count.
Ignore blank lines leaves empty lines out of the comparison and out of the result. Line numbers still show the real position of each line.
The options only change how lines are matched. The lines are always shown as you wrote them. Line endings are not compared at all, so text from Windows, Mac and Linux can be compared without false differences.
How the comparison is done
The tool looks for the smallest number of added and removed lines that turns the original into the changed text. It uses the Myers diff algorithm, a well-known method for this problem, written into this page so no outside code is needed. Lines that moved are shown as removed in one place and added in another, because the tool compares lines in order and does not track moves.
Limits and what happens with big texts
This is the heaviest tool on the site, so its limits are strict. Each side can have up to 200,000 characters and 5,000 lines. If you paste more, the tool keeps the first part and tells you.
The tool also has a limit on effort. If more than 3,000 lines would have to change, the texts are probably unrelated, and the tool stops with a message instead of working for a long time. Compare smaller parts, or check that you pasted the right texts.
The comparison runs only when you click Compare, in the background of the page, so typing and scrolling stay smooth. A long result is drawn 1,000 rows at a time, and a button shows more.
Tips for a clear comparison
- Compare similar versions. Two texts that share most of their lines give the clearest result.
- If the result is noisy, tick Ignore leading and trailing spaces or Ignore case, and compare again.
- Put one sentence on each line when comparing prose, since the comparison is line based.
- Use Swap if you pasted the texts the wrong way around.
Privacy
Both texts stay in your browser. They are not uploaded, stored or tracked, and there is no sign-up. Like every page on this site, this one may show ads from third-party vendors once ads are switched on, and those vendors can use cookies. Read the privacy policy for details. For related jobs, the remove duplicate lines tool cleans lists, and the JSON formatter makes data easier to compare.