Text Diff

Compare two texts and highlight added, removed, and unchanged content at word or character level.

runs locally on your browser. Your data never leaves your device.
Original Text
Modified Text

Awaiting Content

Enter text into both columns above to begin the line-by-line comparison analyzer.

Common Use Cases

Compare two versions of a legal contract to identify what was changed between drafts
Verify that an AI-generated rewrite preserved the meaning and structure of the original
Check whether a configuration file was modified correctly after a deployment
Find subtle differences between two nearly identical code snippets during a code review

About Text Diff

Text diffing is the process of computing and displaying the differences between two versions of a text. It's fundamental to version control systems like Git, which uses diff algorithms to track what changed between commits. But the use cases extend far beyond code: comparing two versions of a legal document, checking whether an AI-generated rewrite changed anything unexpected, verifying that a translated text has the same structure as the source, or auditing the differences between two configuration files.

The core algorithm is the Longest Common Subsequence (LCS) problem. Given two sequences, find the longest subsequence present in both in the same order. The diff is then: elements only in the first sequence are "deleted", elements only in the second are "inserted", and elements in the LCS are "unchanged". The Myers diff algorithm is the most widely used implementation, used by Git, GNU diff, and most modern diff tools.

This tool implements three levels of granularity. Line-level diff shows which entire lines were added or removed, which suits code files and structured text. Word-level diff shows which words changed within each line, useful for prose and documents. Character-level diff shows exactly which characters changed: this is useful for finding typos, subtle encoding differences, or near-identical lines.

Unchanged lines far from any change are collapsed by default (with ±3 lines of context shown around each change) to focus attention on what's different. Both unified view (single column, like Git's diff output) and split view (side-by-side, like GitHub's diff) are supported.

Frequently Asked Questions

What is the difference between line, word, and character granularity?
Line granularity compares whole lines as units, so if any character in a line changes, the entire line is marked as changed. Word granularity compares individual words, so you can see exactly which words were added or removed within a changed line. Character granularity is the most precise, showing individual character insertions and deletions, which helps with detecting single-character typos or invisible whitespace differences.
What algorithm is used to compute the diff?
The tool uses the Longest Common Subsequence (LCS) algorithm, which is the basis of the Myers diff algorithm used by Git. It finds the longest sequence of lines/words/characters that appear in both texts in the same order, then marks everything outside the LCS as either added or removed.
What is unified view vs split view?
Unified view shows both texts in a single column, interleaving removed lines (shown in red with a − prefix) and added lines (shown in green with a + prefix), similar to Git's default diff output. Split view shows the original and modified texts side by side in two columns with matching lines aligned, similar to GitHub's side-by-side diff view.
Why are some sections collapsed by default?
Long sections of unchanged text between changes are automatically collapsed to keep the focus on what actually changed. By default, 3 lines of context are shown above and below each change. Collapsed sections show a count ('... 42 unchanged lines ...') and can be expanded by clicking. This is the same behaviour as Git's diff context option (-U3).