Compare two blocks of text line by line, highlight added, removed and unchanged lines, with options to ignore case and surrounding whitespace, plus a change count. 100% client-side, nothing uploaded.
Comparing two texts means finding the smallest set of changes that turns one into the other. The classic approach is the longest common subsequence: keep everything the two versions share and flag the rest as added or removed. That is why a one-word edit shows as one small change rather than as two nearly identical lines.
| Compare by | Best for |
|---|---|
| Line | Source code, configuration files, logs, CSV exports |
| Word | Prose, legal text, documentation — shows exactly which words moved |
| Character | Short strings, IDs, single-line fields |
A line-level diff of two long prose paragraphs marks both as completely rewritten; a word-level diff of the same pair highlights only the dozen words that changed. Match the granularity to the material.
The format used by Git and the patch utility marks context lines with a space, removals with - and additions with +. A header like @@ -12,7 +12,8 @@ means the hunk starts at line 12 of the old file and line 12 of the new one, spanning seven and eight lines respectively. That is enough information to apply the change without the rest of the file.
Without these, a reformatted file produces a diff in which every line differs, which is technically true and practically useless.
When a diff reports that every line changed, the content was often identical and the file was simply stored differently. Three encoding-level differences produce exactly that symptom:
| Cause | What it looks like | Fix at the source |
|---|---|---|
| CRLF versus LF | Every line differs; nothing visible on screen | Normalise line endings in the editor, or pin them with .gitattributes |
| Byte-order mark | Only the first line differs | Save as UTF-8 without BOM |
| Different encodings | Scattered garbage characters, or a binary comparison | Decode both sides as the same charset before comparing |
These are worth fixing rather than filtering. An ignore-whitespace switch hides the symptom but leaves the repository with mixed line endings, which will resurface as a merge conflict later. The one exception is comparing a file you cannot control — a vendor export, a downloaded log — where ignoring whitespace is the only practical option.