How Document Comparison Works
AnyTool Document Comparison compares two documents entirely in the browser. It first segments each document at the chosen granularity — paragraph, sentence, line or word — then runs a sequence diff (the Myers algorithm from the jsdiff library) over the segments to find the additions, removals and equal segments. Adjacent removals and additions are paired into in-place changes that carry a within-segment word highlight. Ignore-options are applied through a normalising comparator, so what counts as equal can change while the original text is always preserved.
- Four granularities: paragraph, sentence, line and word
- Sequence diff over segments, with word-level sub-highlighting on edits
- Ignore case, whitespace or punctuation without altering the text
- Large documents are compared in a Web Worker to keep the UI responsive
- All computation is client-side JavaScript — no server round-trip
