Text Diff — Compare Two Texts Online
A diff checker that highlights what changed between two texts
Runs in your browser · nothing is uploaded
Enter text in both boxes to see the differences instantly.
What it is
This text diff tool places two texts side by side and shows exactly what changed. Paste an old and a new version of an article, a contract draft, a config file or a code snippet. Added text is highlighted green and underlined, removed text red and struck through, and the number of additions and deletions is shown above the result.
How to use
- Paste the original into the left box and the changed version into the right box. The result appears as you type.
- Choose the comparison unit: lines, words or characters.
- Switch between side-by-side and unified views. In line mode, side-by-side lines up replaced lines in the same row.
- Turn on Ignore whitespace or Ignore case when those differences do not matter.
- Use the swap button to exchange the two boxes.
How it works
- The comparison uses the open-source jsdiff library (BSD-3-Clause), which implements Myers’ diff algorithm to find a minimal set of edits. It is loaded only when needed, so other pages are not affected.
- By default both texts are normalized to Unicode NFC first, so Hangul copied on a Mac (decomposed NFD) matches the same text typed on Windows. Turn the option off to compare the raw code points.
- Word mode splits words with the browser’s Intl.Segmenter, so in Chinese and Japanese, which use no spaces, only the changed word is marked.
- Counts use the selected unit: lines in line mode, whitespace-separated words in word mode and non-space characters in character mode.
- Each side is limited to 400,000 characters in line mode, 200,000 in word mode and 40,000 in character mode, and a comparison that takes longer than 4 seconds is stopped.
- For large inputs the comparison waits until you stop typing for a moment so the page stays responsive.
- If both texts match, the tool says they are identical.
Examples
| Original | Changed | Mode | Result |
|---|---|---|---|
| a / b / c | a / B / c / d | Lines | Lines: +2 −1 |
| the quick brown fox | the slow brown dog | Words | Words: +2 −2 |
| 안녕하세요 | 안녕하세오 | Characters | Characters: +1 −1 |
| Hello | hello | Lines, ignore case | Identical |
FAQ
When should I compare by line, word or character?
Lines suit code and config files where each line is a unit. Words work well for edited prose, and characters are best for spotting a one-letter typo.
Is there a size limit?
Each side can be up to 400,000 characters in line mode, 200,000 in word mode and 40,000 in character mode. Character diffs can take much longer on large inputs, so that limit is lower, and any comparison that runs past 4 seconds is stopped with a message.
What does Ignore whitespace do?
In line mode it ignores differences in leading and trailing whitespace on each line. Word mode already ignores differences in the amount of space between words.
Are my texts uploaded?
No. The comparison runs in your browser and nothing is stored or sent.