Text Diff
Compare two texts side by side and see differences highlighted line by line, like a GitHub diff.
Compare two text blocks side-by-side and inspect line-by-line additions and removals like GitHub diffs.
How do I use Text Diff?
Paste the baseline text into 'Original Text' and the updated version into 'Modified Text', or click 'Load Sample Data'.
Click 'Compare Text Diff' (or press `Ctrl+Enter`) and toggle between Side-by-Side and Stacked layout views.
Inspect the green (`+added`) and red (`-removed`) line-by-line diff output to audit every modification.
What features does Text Diff offer?
GitHub-style side-by-side & inline text diff comparison
Line-by-line character difference highlighting
Ignore whitespace and case options
100% private in-browser diff calculation
Longest Common Subsequence (LCS) & Myers Diff Algorithm
Line-by-line text comparison computes the Longest Common Subsequence (LCS) between two line arrays $A$ and $B$ to find the minimum edit script of insertions and deletions.
| Diff Line Type | Prefix Symbol | Visual Highlight | LCS Algorithm Meaning |
|---|---|---|---|
| Unchanged Context | (space) | Neutral background | Line exists in both Original and Modified LCS |
| Added Line | + (Plus) | Green (+added) | Line inserted in Modified text |
| Removed Line | - (Minus) | Red (-removed) | Line deleted from Original text |
| Modified Line | - then + | Red row followed by Green row | In-place line edit represented as delete + insert |
Frequently Asked Questions about Text Diff
Why does the diff checker mark the entire file as changed when comparing Windows and Linux files?
Windows uses `CRLF` (`\r\n`) line endings while Linux and macOS use `LF` (`\n`). If trailing `\r` carriage returns differ on every line, strict line comparators see every line as modified. Normalize line endings first if needed.
How does the Longest Common Subsequence (LCS) diff algorithm scale on large files?
Standard dynamic-programming LCS requires $O(N \times M)$ time and space where $N$ and $M$ are line counts. Files up to 2,000–5,000 lines compare instantaneously in browser memory.
Why does changing a single character on a line show the whole line as `-removed` and `+added`?
Unified diff tools operate at line granularity (like `git diff`). Modifying any character or trailing space within a line replaces the old line entry with a `-` deletion followed by a `+` insertion.
Are confidential contracts, `.env` files, or source code uploaded during comparison?
No. The LCS diff engine executes 100% locally in your browser's JavaScript memory with zero network requests.
Explore Related Text Tools
Smart Text Cleaner
Deduplicate lines, strip HTML tags, unescape entities, and sort text lists alphabetically in real time.
Lorem Ipsum
Generate placeholder text in paragraphs, sentences, or words for your designs and prototypes.
Markdown Preview
Write and preview GitHub Flavored Markdown in real-time with split, edit, and preview modes.
Markdown to HTML & Printable A4 PDF Converter
Convert GFM Markdown text into styled HTML markup or print formatted documents to A4 PDF with custom themes.
Case Converter
Convert text between UPPER, lower, Title, Sentence, camelCase, snake_case, kebab-case, and CONSTANT_CASE.
Word Counter
Count words, characters, sentences, and paragraphs in real time with estimated reading time.