Category 10 — String Search & Similarity

Levenshtein Distance

Measure edit distance between two strings — insertions, deletions, and substitutions.

How to use this tool

  1. Type or paste a first string into String A and a second into String B — results update as you type.
  2. Read the Edit distance stat: the minimum number of single-character edits needed to turn one string into the other.
  3. Check Insertions, Deletions, and Substitutions to see how that distance breaks down by edit type.
  4. Inspect the color-coded Alignment — matching characters line up, while substitutions, insertions, and deletions are highlighted.
  5. Click a sample button like kitten / sitting or Saturday / Sunday to load a ready-made pair.
  6. Use the Similarity percentage as a quick fuzzy-match score (100% = identical).

Why this tool is helpful

Fuzzy matching & dedupe

Score how close two strings are to spot near-duplicates, merge records, or match names across datasets.

Spell checking

Measure how far a word is from a dictionary entry — a small distance usually means a simple typo.

Understand the alignment

The two-line, color-coded view shows the actual edit script — which characters changed, appeared, or vanished — not just a number.

Bioinformatics & sequence comparison

Edit distance underlies DNA, RNA, and protein sequence alignment — a familiar primitive for genetics work.

Diff & plagiarism triage

Get a quick, objective gauge of how much two texts or code snippets differ before diving into a full diff.

Stay private

Everything runs in your browser. Nothing is uploaded, logged, or sent to a server — safe for sensitive strings.

FAQ

What is Levenshtein distance?

The minimum number of single-character edits — insertions, deletions, or substitutions — required to transform one string into another. For example, kitten to sitting is 3.

How is the distance actually calculated?

This tool uses the Wagner–Fischer dynamic-programming algorithm. It fills an (m+1) × (n+1) matrix where each cell holds the cheapest way to align the two prefixes so far, then backtracks to reconstruct the edit path.

Why does kitten → sitting give 3?

Substitute ks, substitute ei, then insert g at the end. That's three single-character edits, the minimum possible.

Is it case-sensitive? Do spaces count?

Yes. Each edit has a cost of 1, so A vs a is a substitution, and every space or punctuation mark counts as a character too.

What does the Similarity percentage mean?

It's 1 - distance / max(lengthA, lengthB), shown as a percent. Two identical strings score 100%, while completely different strings approach 0%.

Does it handle Unicode and emoji?

It operates on UTF-16 code units. Most text works as expected, but characters outside the Basic Multilingual Plane — like emoji — count as two units each, which affects the distance.

Does any of my data leave my browser?

Never. All computation happens locally in JavaScript. Your strings are not sent to, stored on, or logged by any server.