Category 10 — String Search & Similarity

Hamming Distance

Count the number of positions where two equal-length strings differ — character or bit level.

How to use this tool

  1. Pick a mode with the tabs: Character Mode compares text position by position, while Hex / Bit Mode compares hex values down to the individual bits.
  2. Enter two equal-length strings into String A and String B — or two hex strings into Hex String A and Hex String B. Results update live as you type.
  3. Read the stats: Hamming distance, string length, match percentage, and the matches/differ split — or, in hex mode, byte/bit distance and bytes/bits compared.
  4. Check the comparison view below: matching positions render green and differing positions are highlighted red.
  5. Click a sample button like karolin / kathrin or deadbeef / deadc0de to see it in action instantly.

Why this tool is helpful

Spot typos & near-matches

See exactly how many characters separate two strings — useful when diffing identifiers, filenames, or user-entered values that should be identical.

Understand error-correcting codes

Hamming distance is the foundation of Hamming codes used in RAM, RAID, and QR codes. This tool shows the distance a code relies on.

Compare hashes & binaries bit-by-bit

Hex / Bit Mode reveals the exact bits where two hex values diverge — handy when comparing hashes, keys, or packet payloads.

Gauge similarity at a glance

Match percentage and the matches/differ split turn raw distance into an intuitive similarity measure for quick comparison.

Learn error-detection limits

A code's minimum Hamming distance determines how many bit errors it can detect or correct — experiment with values to see why.

Stay private

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

FAQ

What is Hamming distance?

Hamming distance is the number of positions at which two strings of equal length differ. For example, karolin and kathrin have a distance of 3.

Why do my strings need to be the same length?

Hamming distance is only defined for strings of equal length. If the lengths differ, the tool shows a "Length mismatch" error rather than computing a misleading value.

What's the difference between Character Mode and Hex / Bit Mode?

Character Mode compares two strings one character at a time. Hex / Bit Mode parses two hex strings into bytes and reports both the byte-level distance and the number of differing bits.

How is match percentage calculated?

It's (length − distance) / length × 100 — the share of positions that are identical. A distance of 0 means a 100% match.

Why does Hamming distance matter for error correction?

In coding theory, the minimum Hamming distance between valid codewords sets the limits: a distance of d detects up to d−1 errors and corrects up to ⌊(d−1)/2⌋ errors.

Can I compare strings of different lengths?

Not with Hamming distance — pad the shorter string first, or use an edit-distance metric like Levenshtein, which handles insertions and deletions.

Does any of my data leave my browser?

Never. All comparison happens locally in JavaScript. Your input is not sent to, stored on, or logged by any server.