DevsToolkit

Text Diff

Formatting

Compare two blocks of text line by line and highlight additions, removals, and unchanged lines

All processing happens locally in your browser — your data never leaves your machine.
Loading tool...

Examples

Single Line Change

Input
Hello, world!
This is a test.
Goodbye!
---
Hello, world!
This is a demo.
Goodbye!
Output
0 additions, 0 removals, 1 change (line 2)

Added and Removed Lines

Input
apple
banana
cherry
---
apple
blueberry
cherry
date
Output
1 addition (date), 1 removal (banana), 1 addition (blueberry)

Completely Different Texts

Input
line one
line two
---
alpha
beta
Output
2 additions, 2 removals, 0 unchanged

Frequently Asked Questions

How does the Text Diff tool compare text?
The tool splits both inputs into lines and uses the Longest Common Subsequence (LCS) algorithm to find the optimal alignment. It then walks the LCS table to classify each line as added, removed, or unchanged, producing a unified diff with accurate line numbers.
Can I compare large documents with this tool?
Yes. The diff runs entirely in your browser so there is no upload size limit imposed by a server. Very large documents may take a moment to process since the LCS algorithm is O(m*n) in the number of lines, but typical documents diff instantly.
Is my data safe when using this tool?
Absolutely. All comparison logic runs locally in your browser using JavaScript. Your text data is never uploaded to any server.

Related Tools