About this tool
A text diff finds the differences between two pieces of text. The most common approach works line by line: first match the identical lines, and treat the rest as added, removed or changed content.
This tool runs a longest-common-subsequence (LCS) comparison locally in your browser. For lines classified as "changed" it performs a second, word-level comparison and highlights the parts that actually changed, so you can see exactly which characters were edited.
Comparing two versions of a text is one of the most common review tasks: checking what changed between two commits, confirming that a translation matches its source, spotting an unexpected edit in a contract, or finding why two configuration files behave differently. A diff tool removes the identical parts and presents only the differences, which turns an exhausting line-by-line reading exercise into a quick visual check.
The algorithm behind this page is a longest-common-subsequence comparison. It first removes identical lines at the top and bottom, then builds the largest set of lines that appear in both versions in the same order; whatever is left is a removal, an addition or a modification. When a removed block sits directly next to an added block, the two are paired as a “change” and compared again word by word, so the exact edited words are highlighted inside the line. The generated export uses the familiar unified diff format with + and − prefixes, which can be pasted into tickets, emails or code review comments.
A line-based diff has known limits worth understanding. A minified JSON file is a single huge line, so every edit marks the whole line — format the JSON first, then compare. Very large files are slow because the comparison cost grows with the number of differing lines, although stripping the common prefix and suffix keeps typical source files fast. And for languages written without spaces, inline word highlighting is less precise, because it cannot split a run of characters into words; the line-level result is still exact.
How to use
- Paste the text: put the original on the left and the version to compare on the right, or use "Load file" to read a local file.
- Compare line by line: the comparison starts automatically as you type, with no button to press. Identical lines stay plain, removed lines turn red, added lines green and changed lines yellow.
- Inline highlight: for lines classified as "changed", the specific changed parts are marked with a deeper color inside the line.
- Switch views: the side-by-side view shows both versions next to each other, while the unified view puts additions and deletions in a single column — handy for longer texts.
- Ignore options: enabling "Ignore case" or "Ignore whitespace" affects the comparison only; the displayed content stays exactly as you entered it.
- Copy or download: copy the diff in unified format (with + / - prefixes) or download it as a .diff file.
- Normalise before comparing: run both sides through the same formatter (or format the JSON in this site first) so that whitespace and indentation changes do not hide the real edits.
- Keep a record: download the .diff file and attach it to the review, ticket or email when the comparison needs to be archived or discussed by someone else.
FAQ
Is the text I compare uploaded anywhere?
No. The comparison runs locally in your browser with JavaScript and makes no network requests. Closing or reloading the page clears the content immediately.
What is the difference between "changed" and "added + removed"?
When a removed block and an added block are adjacent, the tool recognises them as a "change" and highlights the differences inline. If they cannot be paired, they are shown separately as a removal and an addition.
Why are two lines flagged as different when they look the same?
The usual reasons are leading or trailing spaces, tabs mixed with spaces, or full-width versus half-width characters. Try enabling "Ignore whitespace" or "Ignore case" to rule these out.
How much text can it handle?
The tool first strips the identical leading and trailing parts, then compares what remains, so typical code and documents are fast. If the remaining difference is very large it falls back to a single block comparison to stay responsive.
Should I use the side-by-side or the unified view?
The side-by-side view is best when there are many changes, since you can see each version in full. The unified view is narrower and better for long texts or small screens.
Does it work with Chinese, Japanese or Korean text?
Yes. Line-level comparison is exact for any language, including CJK text and emoji. Only the extra word-level highlighting inside a changed line is less precise for languages that do not separate words with spaces, because the text is split on whitespace.
Can I compare images, PDFs or other binary files?
No. This tool compares plain text only. Binary formats need a format-aware comparison — for images, an image diff tool; for PDFs, a document comparison service that extracts the text layer first.
Can I compare three or more versions at once?
No, the comparison is pairwise. To review a longer history, compare A with B, then B with C; each step shows exactly what that revision introduced. A three-way merge would additionally need a common ancestor, which is a different operation.
Why is a one-character edit shown as many changed lines?
Adjacent removed and added lines are grouped as a single changed block, so the outer statistics can look larger than the edit itself. The inline highlighting inside each line shows the precise characters that differ.
How much text can I compare at once?
Ordinary source files and articles are no problem. Performance depends mainly on how many lines actually differ, not on the total size, because identical leading and trailing sections are removed first. For multi-megabyte files, split the text into smaller sections.