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.