Luhn Checksum Calculator
The Luhn algorithm is the mod 10 checksum that guards credit card numbers, IMEIs and many other identifiers against typos. It doubles every second digit from the right, sums everything, and treats the number as valid when the total is a multiple of 10. This calculator takes any number (spaces and dashes are ignored), reports its Luhn sum, whether it passes validation, and the check digit that would make a payload valid. It is an error-detection tool defined in ISO/IEC 7812, not a security check.
Luhn (mod 10) formula
from the rightmost digit, double every second digit
if a doubled value > 9, subtract 9
sum all (doubled and undoubled) digits = Luhn sum
valid if Luhn sum mod 10 = 0
check digit for a payload = (10 - (payload sum mod 10)) mod 10
Validity treats the full entered number as including its check digit. The check-digit output instead treats the entered digits as the payload and reports the digit that would complete a valid number.
Luhn checksum context
- Defined in ISO/IEC 7812 for issuer identification numbers.
- Validates credit and debit cards, IMEIs, ICCIDs and some IDs.
- Catches all single-digit errors and most adjacent transpositions.
- Does not detect a 09 to 90 transposition; it is not foolproof.
- It is error detection only, never a fraud or security control.
Luhn checksum: frequently asked questions
What is the Luhn algorithm?
The Luhn algorithm, also called the mod 10 algorithm, is a simple checksum that detects accidental errors in identification numbers. Starting from the rightmost digit, every second digit is doubled (and reduced by 9 if over 9), all digits are summed, and a valid number has a total divisible by 10. It is defined in ISO/IEC 7812.
Where is Luhn used?
It validates credit and debit card numbers, IMEI device serial numbers, some national identification numbers and SIM ICCIDs. It is not a security feature; it only catches typos and single-digit and most adjacent-transposition errors.
How is the check digit computed?
The check digit is the last digit chosen so the whole number passes Luhn. Compute the Luhn sum of the number without the check digit (treating its position correctly), then the check digit is (10 minus (sum mod 10)) mod 10. This calculator reports the correct check digit for the digits you enter as the payload.
What errors does Luhn catch?
It catches every single-digit error and most transpositions of adjacent digits. It does not catch the transposition of 09 to 90 (or 90 to 09), and it cannot detect all twin-digit errors. It is an error-detection aid, not error correction.
Does it work with spaces and dashes?
Yes. This calculator strips spaces, dashes and other non-digits before computing, so you can paste a card number formatted with spaces. Only the digit characters are used.
Official sources
- NIST: checksum and integrity references.
- U.S. Federal Trade Commission: payment card identifiers and consumer guidance.
Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.