🔀 Text Diff Checker
By ToolNimba Editorial Team · Updated 2026-06-19
Paste text into both boxes and press Compare.
This text diff checker compares two blocks of text line by line and shows you exactly what changed. Paste the original on the left and the changed version on the right, then press Compare. Added lines are highlighted in green, removed lines in red, and unchanged lines stay plain, with a running count of each. Everything happens in your browser, so nothing you paste is ever uploaded.
What is the Text Diff Checker?
A "diff" (short for difference) is a side-by-side or stacked view of what changed between two versions of some text. Instead of squinting at two paragraphs trying to spot the edit, you let the tool line them up and mark the differences. This is the same idea behind the diffs you see in code review, version control, and document tracking, just simplified to plain text that anyone can use.
This checker works at the line level. It splits each side on line breaks, then uses a longest common subsequence (LCS) algorithm to find the largest set of lines that appear, in the same order, in both texts. Those shared lines are treated as unchanged. Whatever is left over is classified as either a removal (present in the original but not the changed text) or an addition (present in the changed text but not the original). The LCS approach is important because it keeps the unchanged lines aligned even when you insert or delete a block in the middle, rather than marking everything after the edit as different.
Because the comparison is line based, the smallest unit it reports is a whole line. If you change one word in a long line, that entire line shows as one removal plus one addition rather than highlighting just the word. Two optional toggles help with noisy comparisons: "ignore case" treats upper and lower case as equal, and "ignore leading and trailing spaces" stops indentation or trailing whitespace from registering as a change. Use them when you only care about the substance of the text, and leave them off when exact characters matter.
When to use it
- Checking what an editor or collaborator changed between two drafts of an article or email.
- Comparing two configuration files or code snippets to find a stray edit before committing.
- Confirming that a copy-pasted block of text matches the original exactly, character for character.
- Spotting accidental changes in a list of names, IDs, or URLs between two exports.
How to use the Text Diff Checker
- Paste the original text into the left box.
- Paste the new or changed text into the right box.
- Optionally tick "ignore case" or "ignore leading and trailing spaces" to skip cosmetic differences.
- Press Compare (it also updates as you type).
- Read the highlighted result: green lines were added, red lines were removed, plain lines are unchanged.
Formula & method
Worked examples
Original has three lines: "apple", "banana", "cherry". The changed text has "apple", "blueberry", "cherry".
- Line 1 "apple" appears in both, in the same position: unchanged.
- Line 2 differs: "banana" is only in the original, so it is a removal.
- "blueberry" is only in the changed text, so it is an addition.
- Line 3 "cherry" appears in both: unchanged.
Result: 1 line added, 1 line removed, 2 unchanged.
Original is "one", "two". The changed text inserts a line: "one", "one-and-a-half", "two".
- "one" matches in both: unchanged.
- "one-and-a-half" exists only in the changed text: addition.
- "two" still matches because LCS keeps it aligned: unchanged.
Result: 1 line added, 0 removed, 2 unchanged.
How each line is classified
| Marker | Colour | Meaning |
|---|---|---|
| + | Green | Line is present in the changed text but not the original (added). |
| − | Red | Line is present in the original but not the changed text (removed). |
| (none) | Plain | Line appears, in order, in both texts (unchanged). |
What the comparison options do
| Option | Effect when ticked |
|---|---|
| Ignore case | Treats "Hello" and "hello" as the same line. |
| Ignore leading and trailing spaces | Trims each line before comparing, so indentation changes are ignored. |
| Both off (default) | Lines must match exactly, character for character, to count as unchanged. |
Common mistakes to avoid
- Expecting word-level highlighting. This is a line-based diff. Changing one word in a long line reports the whole line as one removal plus one addition. To pinpoint a single word, put the differing parts on their own lines first.
- Confusing the two sides. The left box is the original (baseline) and the right box is the changed version. Swapping them flips additions and removals. Use the Swap button if you pasted them the wrong way round.
- Whitespace causing surprise differences. A trailing space or a tab versus spaces will mark a line as changed even when it looks identical. Tick "ignore leading and trailing spaces" if you only care about the visible content.
- Different line endings between sources. Windows files use carriage-return plus newline while others use just newline. This tool normalises both, but if you paste from a source that adds invisible characters, lines may still differ.
Glossary
- Diff
- A representation of the differences between two versions of a text, showing what was added, removed, or kept.
- Longest common subsequence (LCS)
- The longest sequence of lines that appears, in the same order, in both texts. It is used to decide which lines are unchanged.
- Addition
- A line that exists in the changed text but not in the original.
- Removal (deletion)
- A line that exists in the original but not in the changed text.
- Whitespace
- Spaces, tabs, and line breaks. Invisible, but they count as characters when texts are compared exactly.
Frequently asked questions
How does the text diff checker work?
It splits both texts into lines and uses a longest common subsequence algorithm to find the lines that are shared, in order. Lines only in the original are marked as removed, lines only in the changed text are marked as added, and the rest are unchanged.
Is my text uploaded anywhere?
No. The comparison runs entirely in your browser with vanilla JavaScript. Nothing you paste is sent to a server, so it is safe for private or sensitive content.
Can it compare two text files?
Yes. Open each file, copy its contents, and paste one into the original box and the other into the changed box. The tool compares them line by line and reports the differences.
Does it highlight changes within a single line?
No, this is a line-level diff. If you edit one word in a line, the whole line shows as removed and the new version as added. To see word-level changes, break the text into shorter lines first.
What do the colours mean?
Green lines (marked +) were added in the changed text, red lines (marked −) were removed from the original, and plain lines are unchanged. A summary above the result counts each type.
Why are two identical-looking lines marked as different?
Usually invisible whitespace, like a trailing space or a tab, or a difference in capitalisation. Tick "ignore case" or "ignore leading and trailing spaces" to skip those cosmetic differences.