Text Diff
Paste two versions of your text, then click Compare to see additions and deletions highlighted line by line.
All processing is client-side — your data never leaves your browser.About this tool
What is a diff?
A diff (short for "difference") is the set of changes between two versions of a text. Diff tools highlight which lines were added, which were removed, and which stayed the same. Developers use diffs constantly: every Git commit, every code review, and every merge conflict resolution depends on diffing.
How the LCS algorithm works
This tool uses the Longest Common Subsequence (LCS) algorithm to compute the diff. LCS finds the largest sequence of lines that appear in both texts in the same order. Lines outside that common sequence are marked as added or removed. The approach is the same one used by the Unix diff command and Git internally.
When to use this tool
Use Text Diff when you need a quick comparison without opening a code editor. Common use cases include comparing config file versions, spotting edits in a document draft, checking what changed in a copied SQL query, and reviewing API response payloads between two environments.
Line diff vs. character diff
This tool computes a line-level diff: each line is treated as a single unit. If one word changes inside a long line, the whole line shows as removed and re-added. Character-level diffs pinpoint the exact characters that changed but are harder to read. Line diffs are standard for code and plain text review.
Performance note
LCS runs in O(m x n) time, where m and n are the number of lines in each input. For inputs under 300 lines this is instant. Above 300 lines the tool shows a warning. For very large files (thousands of lines), consider using git diff or a dedicated tool like VS Code's built-in diff editor.
Privacy
The comparison runs entirely in your browser using plain JavaScript. No text you paste into either panel is sent to any server. The tool has no network requests beyond loading the page itself. It's safe to use with sensitive config files, credentials, or private document drafts.
How to use
- 1Paste two texts
Enter the original text in the left panel and the new/modified text in the right panel.
- 2Click Compare
The tool performs a line-by-line comparison of the two texts.
- 3Read the diff
Lines that were added are highlighted in green, removed lines in red, and unchanged lines in neutral color.
Frequently asked questions
How does the diff work?
The tool performs a line-by-line comparison using a longest common subsequence algorithm, similar to the Unix diff command. It identifies which lines were added, removed, or remained unchanged between the two texts.
Are changes color-coded?
Yes. Green indicates lines present in the new text that were not in the original (additions). Red indicates lines in the original that are not in the new text (deletions). Lines present in both texts appear in neutral color.
Can I compare code or programming files?
Yes — the tool works on any plain text, including source code, JSON, YAML, configuration files, log outputs, or prose. It treats each line independently.
Is this similar to git diff?
The concept is the same — git diff also shows line-level differences between file versions. This tool provides a visual, browser-based version without needing git or a command line.