DevTools Logo

Text Similarity Checker

Text Similarity Checker

Compare two texts with Levenshtein distance, similarity percentage and a live color-coded alignment.

Runs in your browser

Paste two texts to see how far apart they are. The tool computes Levenshtein edit distance with a two-row dynamic program, normalizes it as 1 − distance / max(lengthA, lengthB), and builds an inline alignment so every insertion, deletion and substitution is visible rather than hidden behind a single percentage. Choose character mode (grapheme-safe, so emoji stay whole) or word mode, toggle case sensitivity, and optionally count adjacent transpositions with the restricted Damerau/OSA variant. This is deterministic edit distance over the two pasted strings — not plagiarism detection, not AI, and not vector cosine similarity.

Granularity
Try an example

Text A

Text B

Similarity

No comparison yet

Type in both panes or load an example.

3 example prompts available.

Examples

Classic golden pair

Input
kitten ↔ sitting
Output
Distance 3 · Similarity 57.1%

k→s, e→i and an inserted g: three edits over a maximum length of seven.

Word insertion

Input
Hello world! ↔ Hello there world!
Output
Distance 1 · Similarity 66.7% (word mode)

One extra word token; punctuation is not counted in word mode.

Transposition

Input
ab ↔ ba
Output
Distance 2 plain · Distance 1 with Damerau (OSA)

The restricted variant counts the swap as one transposition.

Emoji safety

Input
👨‍👩‍👧 family ↔ 👨‍👩‍👧 home
Output
Only the word changes; the emoji stays one grapheme

Grapheme segmentation avoids counting ZWJ sequence parts as separate edits.

About this tool

Text Similarity Checker compares two pasted strings and explains the result. It computes Levenshtein edit distance with a memory-efficient dynamic program, converts it to a similarity percentage with the documented formula 1 − distance / max(lengthA, lengthB), and renders a color-coded alignment so you can see which characters or words changed.

Character mode uses grapheme segmentation, so family emoji and combining marks remain single units. Word mode compares tokens instead of characters and normalizes separators, which makes format-only differences disappear. An optional restricted Damerau (optimal string alignment) mode counts adjacent transpositions as one edit; the label says so explicitly because the number changes.

The alignment shows insertions, deletions, substitutions and transpositions with text styling and accessible labels, not color alone. Everything runs in the browser, with a 50,000-character cap and an on-demand compute button for large inputs — no text is uploaded.

What this tool does not do

  • This is NOT plagiarism detection or AI detection: it only compares the two strings you paste, with no corpus or model.
  • Word mode ignores punctuation and separator differences; character mode is needed for byte-level string comparison.
  • Case folding uses toLowerCase, not full Unicode case folding (for example Straße vs STRASSE still differ).
  • The Damerau option is the restricted optimal string alignment form, not unrestricted Damerau–Levenshtein.
  • Input is capped at 50,000 characters per side; very large matrices show distance and similarity without a diff.

How to use this tool

  1. Paste two texts

    Enter text A and text B; distance and similarity update as you type.

  2. Choose a granularity

    Characters for exact string comparison (grapheme-safe), Words to ignore separator differences.

  3. Tune comparison options

    Toggle case sensitivity or Damerau transpositions; each option is labeled with its effect on the number.

  4. Read and export

    Inspect the alignment, then copy the stats block or download a full text report.

Use cases

Paraphrase distance

Students can quantify how much a paraphrase differs from its source, with the alignment showing where.

QA string checks

Compare expected and actual output strings without leaving the browser.

Draft drift

See how far a revised paragraph moved from the original version.

Options and their effect

OptionEffect
Character modeDistance in graphemes; emoji and combining sequences stay whole
Word modeDistance in word tokens; separators and punctuation are ignored
Case-insensitiveBoth sides folded with toLowerCase before comparison
Case-sensitiveUpper and lower case count as different characters
Damerau (OSA)Adjacent transpositions cost one edit; overlapping ones are not counted

Similarity = 1 − distance / max(lengthA, lengthB). Empty vs empty is 100%; empty vs non-empty is 0%.

Common mistakes

Mistake:Treating the percentage as plagiarism or AI detection.

Fix:This is edit distance between two pasted strings only. There is no corpus, web index or model behind it.

Mistake:Comparing long paragraphs live without noticing the cap.

Fix:Texts over 50,000 characters are rejected; large pairs within the cap switch to an on-demand Compute button.

Mistake:Expecting punctuation differences to count in word mode.

Fix:Word mode ignores punctuation and separators by design; switch to character mode for exact comparison.

Mistake:Assuming Damerau means unrestricted Damerau.

Fix:The toggle implements the optimal string alignment (restricted) variant, which does not combine overlapping transpositions.

Mistake:Comparing vectors with this tool.

Fix:Vector cosine similarity is a different operation; this tool measures string edits.

Frequently asked questions

What is Levenshtein distance?

It is the smallest number of single-character edits — insertions, deletions or substitutions — needed to turn one string into another. For example kitten → sitting takes three edits. The tool computes it with dynamic programming and shows the edit script as an inline alignment.

How is the similarity percentage calculated?

As 1 − distance / max(lengthA, lengthB), where lengths are graphemes in character mode or word tokens in word mode. Two empty texts score 100%; one empty and one non-empty text score 0%. The formula is shown in the UI so the number is explainable.

What is the difference between character and word mode?

Character mode compares grapheme clusters, so punctuation, whitespace and emoji all count. Word mode compares word tokens and normalizes separators, so 'Hello world!' and 'Hello world' score as identical. Word mode is useful for prose drift; character mode for exact strings.

Why do my texts with one word changed score below 100%?

Any edit lowers the ratio because the denominator is the longer text's length, not just the number of words changed. One insertion in a three-word text gives 1 − 1/3 = 66.7%. The alignment shows exactly which token changed.

Is anything uploaded?

No. The dynamic program, alignment and report all run in your browser. Nothing is uploaded or stored, and the tool is not a plagiarism or AI detector — it only compares the two texts you paste.

What does the Damerau (OSA) option change?

It counts an adjacent transposition such as ab → ba as one edit instead of two. The implementation is the restricted optimal string alignment variant, so overlapping transpositions are not combined; the UI and report label it accordingly.

References & standards