Canadian · Validation · Educational
Luhn algorithm validator.
Checks whether a card-style number satisfies the Luhn (mod-10) checksum used by payment card numbers under ISO/IEC 7812. This is a math check, not a card check — see the notice below before typing anything in.
Read this before you type anything
This tool checks mathematical validity only — whether the digits satisfy the Luhn checksum formula. It does not check whether a number is a real, issued card; whether that card is active; whether it has funds or a credit limit; or who it belongs to. A number can pass this checksum and still be completely made up. Never enter a real card number here, or on any site you don't fully trust — use the "Try a documented test number" button below instead. Nothing you type ever leaves your browser: this page makes no network request of any kind, which you can confirm yourself by opening your browser's Network tab while using it.
How the Luhn checksum works
The Luhn algorithm (also called "mod 10" or "modulus 10") is specified in ISO/IEC 7812-1 as the check-digit scheme for the Primary Account Number on payment cards, and is reused for many other identifiers (IMEI, some government and SIM card numbers). Starting from the rightmost digit of the number and moving left, every second digit is doubled; if doubling produces a number greater than 9, its digits are added together (equivalently, subtract 9). Every digit — doubled or not — is then summed, and the number is valid only if that total is a multiple of 10.
The canonical documented test number 79927398713 (used to validate implementations of this exact algorithm, not a real card) sums to 67 after doubling, so its check digit of 3 is the value that brings the total to 70 — a multiple of 10. This tool implements exactly that formula and nothing more.
What the Luhn check proves, and what it does not
The Luhn algorithm, also called the mod 10 or modulus 10 formula, is a simple check digit scheme created by IBM scientist Hans Peter Luhn. His patent, “Computer for Verifying Numbers” (US 2,950,048), was filed in January 1954 and granted in August 1960. Its purpose is narrow: a person types a long number and a computer can quickly tell whether it was probably typed correctly. The final digit of the number is the check digit, calculated from all the digits before it. If any of those digits is mistyped, the check digit will usually no longer fit.
That is all a pass means. It says the digits are consistent with each other. It does not say that a card was issued, that the account is open, that there is credit available or whose name is on it. Wikipedia’s summary puts the design goal plainly: it protects against accidental errors, not malicious attacks, and it is not a cryptographic hash. Anyone can generate a number that passes. That is why this page also asks you never to type a real card number into it: the check does not need one, and a typo-detector is not a place for live data.
How the algorithm works, step by step
- Start at the rightmost digit, which is the check digit, and move left.
- Leave the rightmost digit as it is, double the next one, leave the next, double the next, and so on, alternating.
- If doubling gives a number above 9, subtract 9 (which equals adding its two digits).
- Add up every digit, doubled or not.
- If the total is a multiple of 10, the number passes.
To create a check digit instead, drop it, run the same steps on the remaining digits with the doubling starting on the rightmost one, and use the amount needed to reach the next multiple of ten.
A full worked example
Take the widely used test number 79927398713. Reading from the right, the digits are 3, 1, 7, 8, 9, 3, 7, 2, 9, 9, 7. Double every second one starting with the 1: that turns 1 into 2, 8 into 16 (which becomes 7 after subtracting 9), 3 into 6, 2 into 4 and 9 into 18 (which becomes 9). The full list is now 3, 2, 7, 7, 9, 6, 7, 4, 9, 9, 7, and it sums to 70. Seventy is a multiple of ten, so the number passes. Had the last digit been 5 instead of 3, the sum would be 72 and the number would fail.
What errors Luhn catches, and the one it misses
Because doubling a digit changes the total in a way that depends on the digit, any single wrong digit changes the sum and fails the check. Most swaps of two neighbouring digits are also caught. Change 79927398713 to 79927389713 by swapping the 9 and the 8, and the total becomes 71, which fails. Wikipedia notes the algorithm detects all single-digit errors and almost all transpositions of adjacent digits, with one documented blind spot: swapping the two-digit sequence 09 with 90, or the other way around, is not detected. For example, 710947 and 719047 both pass, even though two digits have been exchanged. It also cannot find errors in the number of digits or in the fixed leading digits unless they change the sum.
Why a Luhn check can fail
- A typo. The most common cause. Re-enter the number slowly, or read it aloud against the source.
- A dropped or extra digit. Spaces and dashes are stripped by this tool, but a missing digit changes which positions are doubled, so the whole total shifts.
- A made-up number. Roughly one in ten random digit strings passes by chance, so a pass is weak evidence and a fail is strong evidence of a typo or of a non-Luhn identifier.
- An identifier that does not use Luhn. Many numbers have no check digit or use a different scheme, such as a UK National Insurance number, an ISBN or an ABA routing number. Failing a Luhn test is then meaningless.
Where else the same formula is used
Wikipedia lists credit card numbers, IMEI numbers, CUSIP numbers, US National Provider Identifiers and Canadian Social Insurance Numbers among the systems that use it. The site has validators for several of them: the SIN validator, the IMEI validator and the CUSIP validator. If you work with product barcodes, the weighted 3-and-1 scheme in the GS1 check digit validator is a close relative with different rules. The card number format itself is specified in ISO/IEC 7812, which is the standard this page cites for the card context.
For developers, the safe habit is to run the Luhn test client-side as a friendly typo alert and to leave real validation to your payment processor. Never treat a pass as proof of anything.
Frequently asked questions
What does Luhn check failed mean?
It means the digits do not satisfy the mod 10 rule, so the number was probably mistyped or is not a Luhn-based identifier. It does not mean a card is fake, blocked or fraudulent. Re-enter the number carefully and check for swapped or missing digits.
How does the Luhn algorithm work?
Starting from the rightmost digit, every second digit is doubled, with results above 9 reduced by subtracting 9. All the digits are then added, and the number is valid if the total is a multiple of 10.
Does passing the Luhn check mean a card number is real?
No. A pass only means the digits are internally consistent. It does not show that the number was issued, that the account is active or that it has funds. Anyone can generate numbers that pass.
Can the Luhn algorithm detect swapped digits?
It detects almost all swaps of adjacent digits, with one known exception: swapping 09 with 90 is not detected. For example, 710947 and 719047 both pass.
Is it safe to type my real card number into a Luhn checker?
You should not. The check only needs the mathematics, and this page asks you to use a documented test number instead. Do not enter real card details into any tool you do not fully trust.
What other numbers use the Luhn algorithm?
Wikipedia lists credit card numbers, IMEI numbers, CUSIP numbers, US National Provider Identifiers and Canadian Social Insurance Numbers, along with other national identifiers.
Is the Luhn algorithm a security feature?
No. It was designed to catch accidental errors, not to stop deliberate misuse. It is not a cryptographic hash, and payment security depends on other controls.
Sources
Primary and reference sources used for this page, each opened and checked in October 2026:
- Wikipedia: Luhn algorithm — algorithm description, error-detection strengths and the 09 to 90 weakness, design purpose, and the list of systems that use it (secondary source) (retrieved 2026-10)
- Google Patents: US 2,950,048, Luhn, Computer for Verifying Numbers — Luhn's original patent, filed January 1954, describing a check digit appended to a number and verified by a rule that returns zero (retrieved 2026-10)