Text Diff
Paste two texts and see what changed between them, by line, word, or character.
Stays in your browserUnified diff (POSIX diff -u)As of 2026.10.03
A (original)
B (changed)
Differences
The result appears here
How to use Text Diff
- 1Paste the original text into A and the changed text into B, or press Sample.
- 2Choose Compare by (Line, Word, Character), a view, and what to ignore. The differences update as you type.
- 3Press Copy to copy the unified diff, or Download to save it as a .diff file.
Text Diff options
- Compare by
- Line compares whole lines and marks the changed characters inside a changed line. Word and Character match the lines first, then compare the changed parts word by word or character by character.
- View
- Side by side shows A on the left and B on the right. Unified shows one column, with removed lines above added lines. The default is Side by side on wide screens and Unified on narrow ones.
- Ignore whitespace
- Off compares the texts exactly. At line ends ignores spaces, tabs, and line-ending differences (CRLF or LF) at the end of each line. All whitespace also ignores spaces and tabs inside a line.
- Ignore case
- Treats upper and lower case as the same, so Hello and hello match.
How the comparison works
This tool finds the smallest set of removed and added lines that turns A into B. It uses the Myers difference algorithm (An O(ND) Difference Algorithm and Its Variations) from the open-source jsdiff library, the same method that diff and git diff use by default. Lines that exist in only one of the texts are set aside first, which keeps large comparisons quick without changing the result.
In Line mode, each removed line is paired with the added line in the same position, and the characters that differ are shown on a darker background. In Word and Character mode, only the regions that changed are compared again in the smaller unit.
The unified diff file
The downloaded file follows the unified format of diff -u in POSIX. It starts with --- A and +++ B. Each block opens with a line such as @@ -1,3 +1,4 @@, which reads: 3 lines starting at line 1 of A, and 4 lines starting at line 1 of B. A line that begins with a space is unchanged context, a - line exists only in A, and a + line exists only in B. \ No newline at end of file marks a last line with no line break after it.
Text Diff examples
Compare by line (defaults)
Lines added: 2 · removed: 1 · unchanged: 2
Input
A: apple banana cherry B: apple blueberry cherry date
Output
apple − banana + blueberry cherry + date
The downloaded .diff file for the same texts
In A, cherry is the last line and has no line break after it. In B it does, so the file lists that line as changed.
Input
A: apple banana cherry B: apple blueberry cherry date
Output
--- A +++ B @@ -1,3 +1,4 @@ apple -banana +blueberry -cherry \ No newline at end of file +cherry +date \ No newline at end of file
Ignore whitespace: All whitespace
B has two spaces between a and b.
Input
A: a b B: a b
Output
No differences with the selected ignore options
The same text on both sides
Input
A: apple banana cherry B: apple banana cherry
Output
The two texts are identical
Examples use the reference cases this tool is tested against.
Text Diff: frequently asked questions
Is my input sent to a server?
No. Your input and the result are processed only in this browser and are not stored. Reloading the page clears them.
How do I read the + and − signs?
A line marked − on a red background exists only in A. A line marked + on a green background exists only in B. Lines without a sign are the same in both. The signs are always shown together with the colors, and screen readers announce them as removed and added.
Two lines look the same but are marked as changed. Why?
They usually differ in something you cannot see: spaces or tabs at the end of the line, or the line ending (CRLF on Windows, LF elsewhere). Set Ignore whitespace to At line ends to leave those out. The tool also tells you when the two texts use different line endings.
What is in the downloaded .diff file?
A standard unified diff from A to B with the headers --- A and +++ B and 3 lines of context around each change. With the ignore options off, a tool such as patch can apply it to A to produce B. With an ignore option on, the ignored differences are left out of the file.
How large can the texts be?
Each side can be up to 5 MB. Up to 512 KB per side is compared as you type, and above that you press Run. The view shows the first 10,000 rows, while the downloaded file always has the full comparison. If the texts differ too much to line up in detail, some regions are shown as one replaced block.
How are words split in Korean and Japanese?
Korean is split at spaces. Japanese has no spaces, so words are split where the script changes between kanji, hiragana, and katakana. Choose Character for a finer comparison.
Related tools
How it works · Standards
- Processed in: this browser (your device). Nothing is sent or stored.
- Standards: Unified diff (POSIX diff -u)
- Engine: diff 9.0.0 (jsdiff) (BSD-3-Clause) · ZEKILO Dev line, word, and character splitting and unified diff writer (in-house code)
- The number of lines is the number of line breaks plus one, so a text that ends with a line break has an empty last line.
- The download is always a line-based unified diff, whichever unit is selected.
- Only the options are remembered. Texts A and B are never stored.
- As of 2026.10.03
- Changelog: 2026.10.03 First release