Inline Text Diff Viewer

Compare two strings character-by-character with inline highlights

Ad placeholder (leaderboard)

When two strings look almost identical, spotting the one character that differs by eye is hard. This viewer compares them character by character and highlights the exact additions and deletions inline, so the change jumps out immediately.

How it works

The tool builds a longest-common-subsequence table over the two strings. The LCS is the longest run of characters that appears in both, in order, and everything outside it is an edit:

dp[i][j] = length of LCS of original[i..] and changed[j..]

Walking the table from the start, when characters match they are emitted as unchanged; otherwise the tool deletes from the original or inserts from the changed text, whichever keeps the edit minimal. Adjacent edits of the same kind are merged into single highlighted runs.

Tips and notes

Character-level diffing is ideal for catching subtle problems: a smart quote swapped for a straight quote, a trailing space, a transposed digit in an API key, or a one-letter typo in a variable name. Because whitespace is compared too, you can use it to verify that two config snippets are byte-identical. For comparing whole documents line by line, sort or split them first and diff the pieces you care about.

Ad placeholder (rectangle)