Text diff (by line)

Text diff (by line)

Line-by-line diff between two texts

Computed in your browser

Put old text on the left and new text on the right. Minus marks deletions and plus marks additions. Each side is limited to 2,000 lines.

 
–

Example

Input

Left:  alpha
beta
Right: alpha
gamma

Example result

  alpha
- beta
+ gamma

Minus marks old text from the left; plus marks new text from the right.

Technical details & limits

Longest common subsequence (LCS) aligns lines, with time and memory growing with the product of the two line counts. Each side is capped at 2000 lines. It does not detect semantic equivalence, moved blocks or JSON-key reordering; an edit normally appears as one removal and one addition.

About this tool

Compare two texts line by line with added, removed and unchanged markers. Optional case and trailing-whitespace rules help inspect configuration changes, API fixtures and text revisions locally.

Use cases

  • Quickly see the difference between two config files.
  • Compare two log runs to find newly appearing errors.

How to use

  1. Paste the two texts into the left / right boxes.
  2. The diff appears below. Toggle options to change comparison rules.

Notes

This is a line-level diff — similar-but-different lines show as removed+added rather than as small edits.

FAQ

How many lines can the online text diff compare?
The text diff allows up to 2000 lines on each side to limit the cost of longest-common-subsequence alignment. With 2000 lines on both sides, their product is 4000000. Split larger files into smaller sections for comparison. The result describes line-level differences rather than semantic equivalence, and it does not identify moved code blocks or understand whether reordered JSON fields represent the same underlying data structure.
Why does changing one line appear as a deletion and an addition?
A line-based diff represents a changed line by removing the old line and adding the replacement. If 1 line containing a becomes 1 line containing b, the display shows 1 deletion and 1 addition. This is an alignment description, not a record of file operations. It does not imply that an application wrote the file twice or that two separate user edits necessarily occurred during the change.
Can text diff determine whether reordered JSON fields are equivalent?
Text diff cannot establish semantic equivalence for JSON with reordered fields; it compares line text. Swapping 2 fields named a and b can produce differences even if their values remain 1 and 2. Normalize the data using rules appropriate to your application before requesting semantic comparison. Preserve the original input when exact bytes or duplicate keys matter, since parsing and reserialization may remove information before the comparison begins.

Related tools

Text diff (by line) · Line-by-line diff between two texts
Text diff (by line) — Tool illustration · dayeku.com