Compare the differences between two text blocks, highlighting added, deleted and modified content line by line
The Text Diff tool compares the differences between two text blocks, highlighting added, deleted, and unchanged content at the line level. Powered by the Longest Common Subsequence (LCS) algorithm, it provides precise line-level diff output — ideal for code review, document proofreading, and version comparison.
All operations run entirely in your browser. No text data is uploaded to any server, ensuring your privacy. The tool supports text of any length, handles blank lines and whitespace, and displays results in a side-by-side table format.
The tool uses the classic LCS (Longest Common Subsequence) dynamic programming algorithm. It splits both texts into arrays of lines, builds a 2D DP table to find the longest sequence of common lines, then backtracks to produce the diff. Lines that match are marked "unchanged," lines only in text A are marked "deleted," and lines only in text B are marked "inserted."
Time complexity is O(m×n), where m and n are the line counts. For typical documents (a few hundred lines), results are returned in milliseconds.
Left (original text):
Project initiation
Requirements analysis
System design
Implementation
Unit testing
Right (modified text):
Project initiation
Requirements analysis
System design
Implementation
Integration testing
Deployment
The Text Diff tool is often used alongside JSON Formatter and SQL Formatter for formatted data comparison. For encoding/decoding scenarios, you might also use URL Decoder or Unicode Encoder. Before comparing texts, using Word Counter to get a breakdown of character composition can help plan your diff workflow.
Before diffing, the Line Sorter can organize lines by ASCII code or leading number so comparisons stay clear.
If your text has many duplicate lines, remove them first with the Text Deduplicator so the diff focuses on meaningful changes.
To split a single line into multiple lines or merge lines into one before comparing, pre-process it with the Text Splitter & Merger.
Regular expressions are commonly used for text matching and extraction—the Regex Tester can help you debug and validate your regex patterns online.
When writing Markdown documents, the Markdown Editor renders your content in real time as you type, a great companion to these text-processing tools for content organization.