How the Inline Text Diff Works
AnyTool Inline Text Diff compares two texts entirely in the browser using the Myers diff algorithm from the jsdiff library. It tokenises each side into characters, words or lines depending on the chosen granularity, then computes the shortest sequence of additions and deletions that turns the original into the changed text. Ignore-options are applied through a comparator that normalises each token before comparison while always emitting the original text, so nothing the user typed is altered.
- Three granularities: character, word and line-level diff
- Token-based comparison so ignore-options never mutate the text
- Ignore case, trim line edges, or ignore all whitespace
- Large inputs are diffed in a Web Worker to keep the UI responsive
- All computation is client-side JavaScript — no server round-trip
