🔀 Text Diff

Line or word comparison · + additions − deletions · nothing uploaded

Advertisement

Compare two pieces of text and see exactly what changed: additions, deletions and unchanged lines highlighted. Useful for checking a document revision, spotting a config-file edit, or verifying two strings you think are identical really are. Uses the longest-common-subsequence algorithm — no external library, no upload.

How the algorithm works

The LCS (longest common subsequence) approach finds the maximal set of lines (or words) that appear in both texts in the same order. Everything in the LCS is "unchanged"; what remains in the first input is "deleted"; what remains in the second is "added". The classic Myers diff algorithm used by Git finds the minimum edit script more efficiently, but LCS gives the same result for the modest input sizes here and is small enough to ship in a page script.

Part of Everyday Tools. For text transformation try the Text Toolkit.

Advertisement
Advertisement