Luhn checksum
Validate a number against the Luhn checksum, or compute its check digit. Used by credit card and ID numbers.
Runs on your device. The file is never uploaded.
Luhn checksum reads a file of digits and either answers valid or invalid, which is the default mode, or appends the check digit and repeats it in brackets. Anything but digits after trimming is refused, so hyphens and spaces have to go first. A failing number is never located: no position and no wrong digit is named.
Questions
Is the Luhn check a security feature?
No. It is an error-detecting formula, designed to catch a single mistyped digit and most transpositions of neighbouring digits. It is public and unkeyed, so anyone can construct a number that passes it. A passing result is never evidence that a card, an IMEI or an ID number is genuine, active, or issued to anybody.
What are the two modes?
validate, which is the default, checks a complete number including its check digit and prints "valid" or "invalid". compute-check-digit takes a number without its final digit and prints the full number with the digit appended, followed by the digit again in brackets so you can see which one it added.
What input does it accept?
A file whose text is digits only after trimming whitespace. Anything else is refused with "input must contain only digits", so spaces between groups, hyphens, and a leading plus sign all have to be removed first. There is no length limit and no card-brand check, because the formula does not depend on either.
Does valid mean the credit card is real?
No. It means the digits satisfy the formula. A number you invent that happens to pass is still not issued to anyone, and a genuine card that is expired, blocked or empty still passes. Luhn tells you a typo is unlikely. It cannot tell you anything more than that.
Which numbers use Luhn?
Credit and debit card numbers, IMEI numbers, and various national ID and account numbers. The formula is the same in every case, which is why this tool has no per-format setting. What differs between them is the length and the meaning of the other digits, and none of that is checked here.
Is the number uploaded anywhere?
No. The check is arithmetic on the digits in a Web Worker in this tab. Nothing is sent, nothing is logged and nothing is stored, which is what makes it reasonable to check a real card number here rather than in a form that posts it somewhere. The site keeps working with the network off.