Text tools

Diff checker for lines, words and characters

This diff checker compares two texts, or two UTF-8 files, and highlights every addition and removal between them. Choose line, word or character comparison, then run it in your browser to see the changes, a count of additions and removals, and a complete report you can copy or download.

Editor text: the browser converts CRLF and CR to LF.

Editor text: the browser converts CRLF and CR to LF.

Comparison options

Options compare lowercase text, remove ASCII spaces/tabs, or convert all line endings to LF. Your originals are kept in the report.

Add your texts, choose a comparison, then compare.

How to compare two texts

Add two texts under Original text and Changed text. Type or paste into each box, select Open UTF-8 file to load a file into either side, or select Use example to try a sample pair. An empty side is a valid comparison, treated as no lines, words or characters at all.

Under Comparison options, choose Compare by Line, Word or Character, then turn on Ignore case, Ignore spaces and tabs, or Normalize line endings as needed; all three start off for an exact comparison. Select Compare texts to run it, or Cancel to stop a long comparison and keep both inputs untouched. The Comparison result panel opens with Copy report and Download report (.json) at the top, then a summary line with the additions and removals, then the highlighted comparison; Reset clears both texts, any opened files and the result, and sets the options back to Line with nothing ignored.

What the three comparison modes compare

Line mode treats each line, with its terminator, as one unit; comparing "The cat sat.\nThe dog ran.\n" against "The cat sat.\nThe dog sprinted.\n" gives 1 line added and 1 line removed, since only the second line changed. Word mode splits text into words, punctuation marks and runs of whitespace, and compares those tokens, so "The cat sat on the mat" against "The cat sat on the rug" gives 1 word added and 1 word removed. Character mode compares Unicode code points one at a time; "color" against "colour" gives 1 character added and 0 removed, the inserted "u".

A missing final newline counts as a change in line mode. An emoji sequence or a letter with combining marks can span several units in character mode, since no Unicode canonical normalization runs first. None of the three modes is language-aware word or sentence segmentation; word mode's rules are fixed, not dictionary-based.

Ignore case, whitespace and line endings

Ignore case lowercases both texts with JavaScript's locale-independent mapping before comparing. Comparing "Hello World" against "HELLO WORLD" with this option on and word mode selected, the summary reports the texts as equal under the selected options. Ignore spaces and tabs removes every ASCII space and tab from both texts, including the spaces between words, so "a b c" against "abc" in character mode with this option on also gives 0 added and 0 removed.

Normalize line endings converts CRLF, CR and the Unicode line and paragraph separators to LF in both texts before comparing. With this option on, an opened file with CRLF endings and the same text with LF endings compare as equal; with it off, "line one\r\nline two" against "line one\nline two" gives 1 line added and 1 line removed, because the line terminator is part of each line unit. Every option compares only the normalized copy; the report keeps both exact originals regardless of the options chosen.

Files, the report and its limits

Opened files must be valid UTF-8 text, regardless of their extension or MIME type; a file that fails to decode as UTF-8 shows an error rather than a garbled comparison. A leading byte-order mark and each file's original line endings stay in the comparison and the report, while text typed or pasted into either box is editor text, where the browser has already converted CRLF and CR to LF.

The downloaded report is UTF-8 JSON holding both exact original texts, the compared texts after the options, the chosen options, the totals, and every change group with its kind, its text and its unit count; it is a comparison record, not a patch file that could be applied elsewhere. There is no fixed text-length or processing-time limit; a very large or very different pair of inputs can need substantial browser memory and time to compare.

Questions

How do I check the differences between two texts?

Put the older version in Original text and the newer one in Changed text, pick Line, Word or Character, and select Compare texts. In the result, removed text carries a minus sign and added text a plus sign. Changing Compare by or an option afterward keeps both texts; select Compare texts again for the new result.

Is my text uploaded when I compare or open a file?

Comparison and file reading both run in your browser; this tool does not upload, log or store either text. Copy writes the report to your clipboard, and Download saves it only when you select it. Opening a file reads it locally to compare against the other side, nothing more.

What do the three comparison modes compare?

Line mode is the default. Use it when whole lines matter, such as lists or code, because one changed letter marks the whole line as removed and added. Use Word mode for prose, where only the changed words are marked. Use Character mode for spelling-level edits; its summary counts Unicode code points.

What do the normalization options ignore?

The options can be combined. With Ignore case and Normalize line endings both on, a CRLF file and an LF file that differ only in letter case compare as equal, and the summary reads "Equal under selected options. The original texts differ." Ignore spaces and tabs leaves non-breaking spaces and line breaks in place.

How are files and line endings handled?

Each side is read on its own, so you can compare an opened file against text you type or paste on the other side. After a comparison, the file's text appears in its box; editing that box switches the side to editor text, with LF line endings. A file that is not UTF-8 shows an error above its own box.

Can I cancel a large comparison?

Yes, with Cancel, which appears only while a comparison runs. Editing either text or changing an option during a run also cancels it, so a result never mixes old and new input. Cancel still works while a long result is being drawn on the page, after the comparison itself has finished.