Text Diff
This free online text diff tool compares two texts and highlights the differences.
All tools on this site run entirely in your browser locally. No data is uploaded to any server.
Features:
- Local files: Open a local text file and diff it directly
- Sort: Sort lines before diffing
Diff Mark:
- Red Mark: Content that appears only on the left compared to the right
- Green Mark: Content that appears only on the right compared to the left
- Line number redirect: Click a diff line to jump to it
FAQ:
- Q: Do I need to click a Compare button, and what do the red and green underlines mean?
A: There's no Compare button: the diff refreshes automatically whenever you edit either side. Red underlines mark text that appears only on the left, green underlines text that appears only on the right. Identical lines stay visible instead of being folded away. Differences are cleaned up semantically, so neighbouring edits are grouped into readable blocks rather than flagged character by character. - Q: How are the "Diff lines" numbers chosen, and what happens when I click one?
A: Each number is the first line of a diff block in the left editor, and every block gets its own clickable number. Clicking one scrolls both editors to that spot, moves the left cursor to the start of the line and briefly thickens it before returning to normal. When the two sides match, the result reads "Both sides identical"; if either side is empty, the result area stays blank. - Q: What order does Sort use, and does it change the other side?
A: Only the side whose button you clicked. It trims the text, splits it into lines and writes them back in three groups: pure numbers by numeric value (negatives and decimals included), lines starting with a Chinese character by pinyin, and everything else by standard string order — case-sensitive, with uppercase first. The groups always come out as numbers, then everything else, then Chinese lines, and the diff refreshes automatically afterwards. - Q: Why is the Restore button sometimes greyed out?
A: Each side keeps its own copy of the last text you entered, saved locally in the browser whenever that side has content. The button is enabled only when you've just opened the page, a saved copy exists and you haven't started typing yet; once you edit, it's disabled so a stray click can't overwrite what you're working on. To bring back the previous text, reload the page and click it straight away. - Q: Can I edit both sides, and does changing one update the other?
A: Yes. Both panes are editable, so you can paste, delete or rewrite text directly. Changes affect only the side you edited and never sync across, and every edit triggers a fresh comparison. "Line Wrap" under Settings controls long-line wrapping in both panes at once; it changes only how text is displayed, not its content or the diff.