Text compare online

How online text comparison handles moved passages, which diff approach fits your task, and how to check that results stay readable, accessible and private.

What an online text comparison actually changes

A text comparison tool does not alter either of your documents. It calculates the differences between two inputs and presents them, usually as highlighted insertions and deletions. Both versions stay exactly as they were. The new thing is a view of the changes, and sometimes an exportable patch that describes how to turn the first version into the second.

Most diff engines find the longest run of content that both versions share in the same order. Anything outside that shared sequence is reported as removed from the first version or added to the second. This ordering assumption causes trouble with moved passages. If a paragraph is cut from the top and pasted near the bottom, a standard diff usually reports a deletion in one place and an unrelated insertion in another, with no sign that it is the same text.

Move detection is an extra step on top of the basic comparison. The tool looks for deleted and inserted blocks that match, either exactly or closely, and labels them as moved. Tools differ on whether they do this and on how close a match must be. Check the documentation or test the tool yourself rather than assuming it detects moves.

Characters that look identical but compare as different

Comparison works on stored characters, not on how text looks. This matters if either version has been through a styling or reversing tool. So-called font generators replace ordinary letters with different Unicode code points, such as mathematical bold or script letters. A styled word therefore will not match its plain version, even though it reads the same. Reversed text changes the actual order of characters, so it will not match either.

Some effects change only the display and leave the characters alone. Visual mirroring done with CSS transforms is one example, as is right-to-left ordering handled by the Unicode bidirectional algorithm. The characters you copy are unchanged in these cases. However, text copied from a rendered page can pick up invisible directional control marks, and those will show up as differences.

Other common causes of differences you cannot see on screen:

  • Non-breaking spaces versus regular spaces
  • Curly quotes versus straight quotes
  • Windows (CRLF) versus Unix (LF) line endings
  • Trailing whitespace
  • Zero-width characters
  • Accented letters stored precomposed (NFC) versus decomposed (NFD)

Many tools let you ignore whitespace or letter case. Few say whether they normalize Unicode. If a tool flags a difference you cannot see, suspect one of the invisible or lookalike characters above.

Choosing a comparison approach for moved passages

The two main decisions are granularity (line, word or character) and whether moves are recognized at all. The table below compares the approaches by how each one reports a relocated paragraph.

Approach | How a moved paragraph appears | Suits | Tradeoff
Line-based diff | Deleted at the old position, inserted at the new one | Code, configuration files, line-structured data | If prose lines are rewrapped, whole paragraphs show as changed
Word-level diff | Same delete/insert pair, but edits within a line are pinpointed | Edited prose, contracts, articles | Becomes noisy when a document is heavily restructured
Character-level diff | Same delete/insert pair at the finest detail | Typos, punctuation, invisible or lookalike Unicode characters | Hard to read when edits are substantial
Move-aware comparison | Marked as moved, ideally linking the old and new locations, with edits inside the block shown separately | Reorganized documents, reordered sections or clauses | Matching rules vary; short or heavily edited moves may still appear as delete/insert
Sorted or normalized comparison | Order differences disappear completely | Lists where order is irrelevant, such as keyword lists or inventories | Hides real reordering, so it is wrong when sequence matters

Illustrative example

Both versions below use the same three clauses. In Version 2, clause B has moved to the end and one word inside it has changed. The two outputs that follow show how each approach would typically present this. They are illustrations, not output captured from any particular tool.

Version 1
A. Scope of the agreement.
B. Payment is due on receipt.
C. Termination requires written notice.

Version 2
A. Scope of the agreement.
C. Termination requires written notice.
B. Payment is due on delivery.
Standard line diff (illustrative)
  A. Scope of the agreement.
- B. Payment is due on receipt.
  C. Termination requires written notice.
+ B. Payment is due on delivery.
Move-aware diff with word-level detail (illustrative)
  A. Scope of the agreement.
  [moved below]
  C. Termination requires written notice.
  [moved from above] B. Payment is due on {receipt -> delivery}.

The standard diff is technically accurate, but it makes clause B look like it was deleted and rewritten. A reviewer has to compare the two B lines by hand to find the one real edit. The move-aware view separates the relocation from the substantive change, so the edit from receipt to delivery is visible immediately.

Matching the approach to the job

  • Order does not matter (lists, tags, inventories): sort or normalize both inputs before comparing, so reordering does not appear as change.
  • Code or line-structured data: a line-based diff is usually enough. Moved blocks show as delete/insert pairs that you can match by eye.
  • Reorganized prose: use move detection combined with word-level highlighting, so relocations and edits are reported separately.
  • No move detection available: compare section by section. Paste the old and new versions of the moved passage as their own pair of inputs.
  • Differences you cannot see: switch to character-level comparison and turn on visible whitespace if the tool offers it.

Testing a tool before you rely on it

Move handling is not standardized, so run a short test. Create two texts like the example above, with one moved paragraph that also contains a single edit. Check three things: does the tool label the move, does it show the edit inside the moved block, and does it cope when the moved block is split in two. Repeat the test with a single moved sentence, because short blocks are where matching thresholds are most likely to fall back to plain deletion and insertion.

Will the comparison output stay readable and usable where you need it?

Copying and pasting: diff highlighting is usually presentation only, such as colored backgrounds or strikethrough applied by styling. Copying from a results page may not carry that styling across. In a plain-text destination, old and new wording can then merge into one confusing passage. To share results, use an export format that marks changes in the text itself. Examples are a unified diff with plus and minus markers, or a document format that stores tracked changes. After pasting, check the result in the destination.

Accessibility: red and green highlighting on its own fails readers with color vision deficiencies, and screen readers do not convey it. The Web Content Accessibility Guidelines, under the Use of Color criterion, advise against using color as the only way to convey information. Prefer output that also uses text markers, symbols, strikethrough and underline together, or explicit labels such as inserted, deleted and moved. Whether a tool exposes these labels to assistive technology depends on how its page is built, so test it with the screen reader you actually use.

Layout: side-by-side views suit wide screens. On narrow screens or at high zoom, an inline view is often easier to follow. Side-by-side views also make moved blocks hard to track unless the tool visually links the old and new positions.

Sensitive input: an online comparison may send both texts to a server unless it runs entirely in your browser. Take extra care before pasting contracts, personal data, credentials or unreleased code. First, read the privacy policy to see whether input is transmitted, logged or retained. Where possible, confirm that processing happens locally by watching the network activity in your browser's developer tools while you run a comparison. If you cannot confirm how input is handled, redact sensitive details or use an offline comparison instead. A claim of no storage is only worth trusting if it is documented.

Limits of this guide

No specific comparison services were tested for this article, and no product-specific evidence was available, so no tools are named or ranked. The descriptions of move-aware comparison are general. Confirm how any particular tool behaves using the test described above before relying on it for review work.