Luhn Algorithm Calculator
Test cases replayed : 4 of 4 match · Methodology · No outside source listed
Type a number without spaces. The calculator gives the check digit to append to it, and says whether the number as typed already passes the Luhn check.
Result
Check digit to append
Number with its check digit
- The number as typed
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Number (digits only, up to 15 digits for the check digit, 16 for validation): enter 0 or more.
- Read the result: Check digit to append; the panel also shows Number with its check digit and The number as typed.
How this calculator works
The Luhn formula (H. P. Luhn, U.S. Patent 2,950,048, 1960; the check-digit method of ISO/IEC 7812-1 for card numbers): starting from the rightmost digit, double every second digit; when a doubled digit is over 9, subtract 9; then add all the digits.
A full number is valid when that total is a multiple of 10 (the rightmost digit, the check digit, is not doubled). To make a check digit, the doubling starts with the rightmost digit of the number without it, and the check digit is (10 − total mod 10) mod 10.
The check catches any single mistyped digit and most swaps of two adjacent digits. Passing it does not mean a card or account exists.
Worked example
| Number (digits only, up to 15 digits for the check digit, 16 for validation) | 7,992,739,871 |
|---|
| Check digit to append | 3 |
|---|---|
| Number with its check digit | 79927398713 |
| The number as typed | Fails the Luhn check |
Frequently asked questions
What is the check digit for 7992739871?
3, so the full number is 79927398713, which passes the Luhn check.
Does 4111111111111111 pass the Luhn check?
Yes. It is the widely used test card number: 411111111111111 followed by its check digit 1.