How to use
- Paste the original text into Text A and the changed text into Text B.
- Select Compare, or press Ctrl+Enter (⌘+Enter on Mac) in either box.
- Read the summary, then the result: lines marked − were removed from Text A, lines marked + were added in Text B.
- Use Copy diff to copy the result as plain text.
Line-by-line comparison
The texts are compared line by line. A line counts as unchanged only if it is exactly the same in both texts; otherwise it is shown as removed from Text A and added in Text B. There is no character-level highlighting within a line, so a one-character edit shows the whole old line and the whole new line.
The diff uses the smallest set of added and removed lines (the longest common subsequence of lines, found with Myers' algorithm). Each row shows its line number in Text A and Text B. Long runs of unchanged lines are collapsed to the 3 lines around each change, so the changes are easy to find.
Whitespace, line endings and Unicode
Whitespace is part of the text: leading and trailing spaces, tabs and repeated spaces all make lines different, and nothing is trimmed. Turn on Show whitespace to see spaces as · and tabs as →. Unicode is compared exactly as entered, without normalization — an accented letter typed as one character differs from the same letter built from two.
Windows (CRLF), Unix (LF) and old Mac (CR) line endings all end a line in the same way, so a file saved with different line endings is not reported as changed on every line. A line break at the very end of a text ends the last line rather than adding an empty one. When the texts differ only in line-ending style or in a final line break, the summary says so instead of reporting them as identical.
Comparing JSON and other structured text
Text Diff compares text, not data structures. To compare two JSON documents, format both with the same indentation first (for example with the JSON Formatter) so that every value is on its own line; otherwise a reformatted but identical document shows as changed.
Limits
Text A and Text B together are limited to 5,000,000 characters, and the result can show up to 10,000 lines; larger results are not truncated — compare smaller sections instead. For texts with very many scattered changes, the search for the smallest diff is bounded so the page stays responsive; if that bound is reached, some regions are shown as fully removed and added, and the summary says so.
FAQ
- Is my text uploaded?
- No. Your text is compared in your browser. It is not sent to a server, not stored, and not added to the page URL.
- Why are two lines that look the same marked as changed?
- They differ in invisible characters — usually trailing spaces, tabs instead of spaces, or Unicode characters that look alike. Turn on Show whitespace to see spaces and tabs.
- Is HTML or code in my text run?
- No. Everything you paste is displayed as plain text; HTML tags and scripts are shown, never executed.