Also available in: Español · Português · Français · العربية
Luhn Algorithm Checker
Validate a Luhn checksum, see which digit the others imply, and find out exactly which mistake it cannot see.
What is the Luhn algorithm?
The Luhn algorithm is a checksum: a rule that turns the digits of a number into one extra digit at the end, so that a typo somewhere in the number makes the whole thing fail to add up. It is on every bank card, on the IMEI that identifies a phone, and on national identifiers in several countries.
The rule is short. Working from the right, double every second digit; if doubling takes you past nine, subtract nine. Add everything together. If the total divides by ten, the number is consistent.
It exists to catch mistakes, not to prove anything. A checkout form runs it before submitting so it can say “check that number again” without a round trip to the bank, and a warehouse scanner runs it so a mis-scanned IMEI is rejected on the spot.
How to use it
- Paste a number with or without spaces. Spaces and hyphens are ignored, so a card number copied in groups of four works as-is. Anything shorter than eight digits is refused: a checksum over a handful of digits does not tell you much, and no real Luhn-protected identifier is that short.
- Read the verdict. When the checksum fails, the tool says which digit the others imply — usually enough to spot which one you mistyped. When it passes, it notes what the length suggests, which is a hint about the shape of the number rather than an identification.
- Check the warning underneath. If the number contains a 0 next to a 9, it tells you where. That is the one place a typo can hide, for the reason set out below.
What it catches, counted rather than quoted
The usual claim is that Luhn catches all single-digit errors and all but one kind of transposition. Rather than repeat that, we measured it. Taking valid sixteen-digit numbers and changing one digit at a time, in every position, to every other value: 2,880,000 alterations tested, none escaped. Every single mistyped digit breaks the checksum.
Swapping two adjacent digits is the other common slip, and here Luhn is nearly but not quite perfect. Over 351,536 adjacent swaps, 7,731 passed — 2.20%. And they are one digit pair: 0 against 9. No other pair of neighbouring digits can be swapped without the checksum noticing.
The reason is the doubling step. Zero doubles to zero. Nine doubles to eighteen, which reduces to nine. So across the boundary between a doubled and an undoubled position, 0 and 9 contribute the same total whichever way round they sit, and the swap is invisible. Every other pair changes the sum. The tool checks this prediction against all ninety ordered digit pairs, so the claim rests on the arithmetic and not only on the sweep.
Why Luhn beats the other mod-10 checksum
ISBN-13, the checksum on every book published since 2007, is also modulo ten. This site measured it the same way and it misses five digit pairs — 0 and 5, 1 and 6, 2 and 7, 3 and 8, 4 and 9 — accounting for 10.21% of adjacent transpositions. Luhn misses one pair and 2.20%.
So the modulus is not what separates them. ISBN-13 weights its digits alternately 1 and 3, and that is linear: swapping neighbours shifts the total by twice their difference, and any difference of five vanishes modulo ten. Luhn's double-and-subtract-nine is not linear, and that single kink is what costs it only one blind pair instead of five.
It is a nice illustration that a checksum's strength lives in its weighting rather than its modulus, and that a scheme designed in 1954 for punched-card machines does a better job on this measure than one adopted in 2007.
Honest limits
A valid checksum means the digits are internally consistent. It does not mean the number was issued, belongs to anyone, or works. Card numbers, IMEIs and identity numbers are records in somebody's database, and the only way to know whether one is real is to ask whoever keeps that database. Any page claiming to verify a card without contacting an issuer is doing exactly what this one does: arithmetic.
This tool also does not identify an issuer. The leading digits of a card do encode one, through a registry maintained by the card networks, but that registry is not public in full, it changes, and a stale copy would be confidently wrong — the standing objection on this site to bundling data that moves. The length note is a hint about shape, nothing more.
Luhn is a typo check, not a security measure, and was never intended as one. It stops a transposed digit reaching a payment processor; it does nothing against anybody who can run the same three lines of arithmetic. Every implementation of it is public, including this one.
Finally, the figures above come from sweeping generated numbers rather than real ones, because the property is arithmetic and does not depend on which numbers were ever issued. The blind pair is provable from the doubling rule, and the page gives that proof rather than resting on the sample.
Why is it free?
Because it is addition and a remainder. There is no dataset, nothing to download, and no server involved — everything runs in your browser, and nothing you type is uploaded, logged or stored anywhere.
That last point matters more here than on most pages. So there is no account, no sign-up and nothing held back. The engine and its 218-assertion test suite are in the repository beside the page, including the sweeps behind every figure quoted above.