Free Text Diff
Compare two blocks of text and see exactly what changed. Line-by-line diff with added, removed, and unchanged lines.
Common uses
- Compare Code SnippetsSpot exactly what changed between two versions of a code snippet, config, or script.
- Compare Document DraftsFind every change between two drafts of a document, contract, or article β line by line.
- Compare Data and CSV FilesSpot differences between two versions of exported data, CSVs, logs, or configuration.
- Compare Translation VersionsSee what changed between two versions of a translated document, subtitle file, or localisation string.
- Track Changes in Content RevisionsCompare original and edited versions of an article, blog post, or marketing copy to review what changed.
How It Works
Text Diff uses a hand-written Longest Common Subsequence (LCS) algorithm implemented directly in this tool β no external diff library. Everything runs in the browser; your text is never sent to a server.
- 1Text is split into linesEach textarea's content is split on newline characters into an array of lines. Optional normalisation (lowercasing, collapsing whitespace) is applied to a copy of those arrays before comparison, while the originals are kept for display.
- 2LCS table computed in a Uint32ArrayA bottom-up dynamic-programming table is built in a typed Uint32Array β O(mΓn) in both time and memory. For inputs whose combined cell count would exceed 4 million (about 16 MB), the algorithm falls back to a coarser block diff automatically so the page stays responsive.
- 3Word-level highlights on changed linesWhen a deleted line is immediately followed by an inserted line, a second LCS pass runs on the tokenised words of that pair (split on whitespace). This produces inline highlighted segments showing exactly which words changed within the line, not just which lines changed.
- 4Unified-diff view with context collapsingThe ops list is rendered as a unified diff with +/β prefixes and colour coding. Unchanged lines outside the configurable context window (default: 3 lines) are collapsed behind an ellipsis. The full result can be copied to the clipboard or downloaded as a plain-text .txt file.
Related Tools
CSV Diff
Compare two CSV files by a key column and see exactly which rows were added, removed, or changed β with the specific fields that differ shown old to new. Handles quoted fields; runs entirely in your browser.
JSON Diff
Compare two JSON objects structurally β see exactly which keys were added, removed, or changed, even deep inside nested data. Runs in your browser.
PDF Compare
Free PDF compare with no upload: see what changed between two versions as a word-level text redline or a visual diff, in your browser.