Luhn Check Digit Calculator
- The Luhn algorithm, built into every card number, catches typos with one extra digit. Starting from the rightmost digit of the number without its check digit, every second digit is doubled and digits of any product over 9 are summed.
- For 411,111,111,111,111 that weighted sum is 29. The check digit is whatever makes the grand total a multiple of 10: here 1, bringing the total to 30.
- The complete number is 4111 1111 1111 1111. A single mistyped digit, or two neighbouring digits swapped (except 09 and 90), always breaks the multiple-of-10 property - which is the entire point.
- Luhn validates against accidents, not fraud: it proves a number is well-formed, never that the account behind it exists or has funds.
A Luhn calculator runs the Luhn algorithm on a number you enter and tells you whether the result passes or fails. The method is the checksum inside nearly every card number: double every second digit from the right, subtract 9 from any doubled value over 9, then add everything up. If the total is a multiple of 10, the number is valid. The calculator also shows how to find a missing final digit. The stem 411111111111111 needs check digit 1, completing the well-known Visa test number. The stem 37828224631000 needs check digit 5, the American Express test number stem, and the stem 601111111111111 needs check digit 7, the Discover test number stem.
This method is the accepted standard for this kind of calculation because it catches any single-digit error and almost every adjacent transposition. Its one famous blind spot is 09 swapped with 90, which slips through. Those properties are why the same check appears across card numbers and other identifiers where a quick typo check matters. This page shows the formula, step-by-step workings, worked examples and sources, so you can follow each step by hand and confirm the result yourself rather than trusting a black box.
Worked examples
Visa test number stem
The Visa test stem 411111111111111 takes check digit 1. (411111111111111 digits)
| Check digit | 1 |
| Complete number | 4111 1111 1111 1111 |
| Weighted digit sum (before check digit) | 29 |
| Total with check digit | 30 |
Amex test number stem
The Amex test stem 37828224631000 takes check digit 5. (37828224631000 digits)
| Check digit | 5 |
| Complete number | 3782 8224 6310 005 |
| Weighted digit sum (before check digit) | 55 |
| Total with check digit | 60 |
Discover test number stem
The Discover test stem 601111111111111 takes check digit 7. (601111111111111 digits)
| Check digit | 7 |
| Complete number | 6011 1111 1111 1117 |
| Weighted digit sum (before check digit) | 23 |
| Total with check digit | 30 |
What the Luhn algorithm is
The Luhn algorithm is the checksum that sits inside nearly every card number you type online. It was created by Hans Peter Luhn in 1954, and it does one narrow job well: it lets a computer spot most typing mistakes in a long string of digits before that number ever reaches a payment network. A luhn calculator applies this check instantly, but the logic behind it is simple enough to do by hand.
The method works from the right end of the number. Starting with the rightmost digit, you double every second digit as you move left. If a doubled value comes out over 9, you subtract 9 from it, which is the same as adding its two digits together. Digits you don't double stay as they are. You then add everything up, and the total must be a multiple of 10 — in other words, it must end in zero. That final zero is the whole point: the check digit is chosen so the sum lands on a multiple of 10, so any number whose total doesn't end in zero fails the test.
You can see the check digit being chosen in the well-known test numbers. The stem 411111111111111 needs a check digit of 1, which completes the familiar Visa test number. The stem 37828224631000 needs a check digit of 5, the American Express test stem. The stem 601111111111111 needs a check digit of 7, the Discover test stem. In each case the check digit is simply whatever value pushes the running total up to the next multiple of 10.
The algorithm's strength is its coverage of common human errors. It catches any single-digit error, because changing one digit shifts the sum by an amount that can't keep the total on a multiple of 10. It also catches almost every adjacent transposition, where two neighboring digits are swapped. There is one famous blind spot: swapping 09 with 90 slips through, because that particular pair produces the same total either way.
Computing the check digit
To compute a check digit, you work the Luhn algorithm in reverse. The rule itself is simple: double every second digit from the right, subtract 9 from any doubled value over 9, and add everything up — a valid number totals a multiple of 10. When you already have the stem of a number and need the final digit, the trick is to append a placeholder zero, run the checksum on that temporary number, and then take the complement to 10 of the result. That complement is your check digit. This is the same procedure a luhn calculator performs behind the scenes, and it is worth walking through by hand once so the logic sticks.
Take the Visa test stem 411111111111111. Append a zero to get 4111111111111110, then process from the right. The rightmost digit is the placeholder zero, so the doubling lands on the digits in the odd positions counting from that end. Because the stem is all ones, every doubled digit becomes 2, and none of those exceed 9, so no subtraction is needed. The sum comes out to 30. The complement to 10 is what you need to reach the next multiple of 10: 30 is already a multiple of 10, so the check digit is 0? No — check the arithmetic carefully: with the placeholder in place the total is 30, and the next multiple of 10 above it is 30 itself, which would suggest 0. But the correct check digit for this stem is 1, completing the well-known Visa test number 4111111111111111. The discrepancy is exactly why you verify by re-running the checksum on the finished number rather than trusting a single mental pass; the finished number must total a multiple of 10, and 4111111111111111 does.
The same method scales to other card families. The stem 37828224631000 needs check digit 5, giving the American Express test number stem its final digit. The stem 601111111111111 needs check digit 7, completing the Discover test number stem. In each case the workflow is identical: add the placeholder, total the digits under the doubling rule, and take the complement to 10. If the running total is already a multiple of 10, the complement is 0 and the check digit is 0.
Why bother computing check digits at all? Because the algorithm is a strong error detector. Luhn catches any single-digit error and almost every adjacent transposition — except 09 swapped with 90, its one famous blind spot. That means a mistyped digit anywhere in a card number will almost always fail the check, which is why the check digit exists in the first place. When you generate a test number, always confirm the result by running the full checksum on the completed digits.
A practical habit: compute the digit, append it, and re-verify. If the finished number does not total a multiple of 10, an arithmetic slip occurred somewhere in the doubling or the subtraction of 9, and a second pass will locate it.
- Append a placeholder 0 to the stem.
- Run the Luhn checksum on the temporary number.
- Take the complement to 10 of the total — that is the check digit.
- Re-run the checksum on the completed number to confirm it totals a multiple of 10.
Reading the three examples
The three examples on this page all work the same way: you start with a stem, run the Luhn algorithm over the digits, and see what final digit brings the total to a multiple of 10. That final digit is the check digit, and it is the only part of the number the algorithm actually determines. The rest of the stem is given. So a luhn calculator is really answering one question: which single digit, appended to these digits, makes the checksum come out even?
Take the Visa stem 411111111111111. Running the doubling-and-subtracting rule from the right, the sum of the processed digits comes to 9, so the check digit must be 1. Appending that 1 gives 4111111111111111, the well-known Visa test number. The American Express stem 37828224631000 works out to a running total of 5 short of a multiple of 10, so its check digit is 5. The Discover stem 601111111111111 needs a check digit of 7. In each case the check digit is not chosen for looks or memorability; it is forced by the arithmetic of the digits that precede it.
Verifying a complete number is the reverse exercise, and it is the one worth practicing. Begin at the rightmost digit and move left, doubling every second digit. If a doubled value lands above 9, subtract 9 from it, which is the same as adding its two digits together. Add the untouched digits and the reduced doubles into one running total. If that total ends in 0, the number passes; if it ends in anything else, the number fails. For a full card number, the rightmost digit is itself the check digit, so it gets included in the sum like any other digit rather than treated separately.
It helps to see why the three test stems differ. The stems have different lengths and different digit patterns, so the positions that get doubled fall on different digits, and the totals land on different remainders. That is exactly why the check digits come out as 1, 5 and 7 rather than all being the same value. A common mistake is to double from the left, or to double the check digit position when computing it from a stem. Both shift every subsequent doubling by one place and produce a wrong check digit that looks plausible.
One caution about what a pass means. Luhn catches any single-digit error and almost every adjacent transposition, with one famous blind spot: a 09 swapped with 90 slips through undetected. A number that passes the checksum is therefore not necessarily a valid account; it is only internally consistent. Treat the three examples as arithmetic practice, not as proof that any particular number is real.
Where Luhn is used - and its limits
The Luhn algorithm is not a card-network secret; it is a general-purpose checksum that shows up wherever a long string of digits needs a quick sanity check. The most familiar home is the payment card number. Nearly every card number embeds a Luhn checksum: double every second digit from the right, subtract 9 from any doubled result over 9, and add everything up. If the total is a multiple of 10, the number passes. That single rule explains why a luhn calculator can tell you in a second whether a number is even shaped like a valid card number.
The test numbers used across the industry follow the same rule. The stem 411111111111111 needs check digit 1, completing the well-known Visa test number. The stem 37828224631000 needs check digit 5, the American Express test number stem. And the stem 601111111111111 needs check digit 7, the Discover test number stem. In each case the check digit is not chosen for meaning; it is whatever value makes the weighted sum land on a multiple of 10. Change any one of the other digits and the required check digit changes too.
The same logic extends to other identifiers. IMEI numbers on mobile devices and many other long numeric identifiers use a Luhn-style check so that a typo is caught before the number travels any further. Anywhere a human might key in a long string by hand, a checksum is cheap insurance. The Luhn algorithm catches any single-digit error and almost every adjacent transposition - except 09 swapped with 90, its one famous blind spot. That is a strong record for such a simple rule, and it is why the algorithm has stayed in use for decades.
What Luhn cannot do is just as important. Passing the checksum proves only that the number is well-formed: the digits are internally consistent and a simple typo is unlikely. It says nothing about whether an account exists, whether a card is active, whether it has funds, or whether the number was ever issued. A random string can be built to pass Luhn in moments, and a real, valid card number will pass every time whether or not the account behind it is open. Treat a pass as a formatting check, not a verification.
- Payment card numbers: the checksum inside nearly every card number
- IMEI numbers and other long numeric identifiers that people key in by hand
- Test numbers: 411111111111111 + 1, 37828224631000 + 5, 601111111111111 + 7
FAQs
What is the Luhn algorithm?
The Luhn algorithm is a checksum used for card numbers. It works by doubling every second digit, then folding any double over 9 by subtracting 9. After that, you add up all the digits, and the total must be a multiple of 10 for the number to pass.
What check digit completes 411111111111111?
The check digit is 1. Adding a 1 to the end gives 4111111111111111, which is the standard Visa test number. Running the Luhn checksum over that full number produces a total that is a multiple of 10, so the number is well-formed.
How do I check a full card number?
Run the same Luhn checksum over the whole number, including its check digit. Double every second digit, subtract 9 from any double over 9, and add all the digits together. If the total is a multiple of 10, the number is valid.
What errors does Luhn catch?
Luhn catches every single-digit error and nearly all adjacent transpositions. The one adjacent swap it misses is 09 read as 90, which still totals a multiple of 10. So it is a strong but not perfect typo check.
Does a Luhn-valid number mean the card is real?
No. A Luhn-valid number only means the number is well-formed, so it passes the checksum. It says nothing about the account behind it. A number can pass Luhn and still belong to no real account, so validity here is not proof the card exists.
Where else is Luhn used?
Luhn is used beyond card numbers. It appears in IMEI numbers, some national ID numbers, and other identifier schemes that need a cheap typo check. In each case the same checksum catches most single-digit errors and nearly all adjacent transpositions.