Validate a number
Enter digits only, including the final check digit.
About the Luhn algorithm
The Luhn algorithm is a simple checksum formula for detecting common errors in strings of digits. It is also called the Mod 10 algorithm because a valid sequence produces a transformed sum divisible by ten. Credit card account numbers are its best-known use, but the method also appears in IMEI device identifiers, national identification systems, membership numbers, and other structured codes. This calculator checks mathematical consistency only; it does not contact an issuer or confirm that an account exists.
Validation begins at the rightmost digit, which is treated as the check digit. Moving from right to left, every second digit is doubled. If doubling produces a value greater than nine, nine is subtracted from it; this is equivalent to adding the two digits of the doubled value. Digits in the alternating positions remain unchanged. All transformed values are added. When the total has a remainder of zero after division by ten, the complete number passes the Luhn test.
For example, changing a single digit usually changes the checksum remainder and makes the sequence invalid. The method also detects most swaps of adjacent digits, which covers many typing mistakes. It is not a cryptographic hash, however. Some different incorrect sequences can have the same remainder, and anyone can deliberately construct a passing check digit. Luhn validation should therefore be used as an early data-quality check, never as proof of identity, authorization, authenticity, or available funds.
The calculator processes the digits locally in your browser. Enter the entire number, including its existing final check digit, and select Validate Number. The result states whether the transformed sum is divisible by ten and displays the remainder. A remainder from one through nine indicates that the number does not satisfy the checksum. The fixture examples use published test-style sequences rather than real account information.
Avoid entering sensitive live financial data into tools when a synthetic test number will do. Although this implementation performs no network lookup, good security practice is to minimize exposure of account identifiers. Developers can use the calculator while testing form validation, support teams can diagnose transcription errors with redacted examples, and students can follow the arithmetic to understand weighted checksums. Passing the test means only that the sequence is compatible with the Luhn formula and should be followed by the appropriate secure business validation.
Luhn algorithm FAQ
What does a valid Luhn result prove?
It proves only that the digit sequence satisfies the Mod 10 checksum. It does not prove that an account exists, is active, or belongs to anyone.
Which digit is the check digit?
In a complete Luhn-protected sequence, the rightmost digit is normally the check digit. Include it when using this validator.
What errors can the Luhn algorithm detect?
It detects all single-digit substitutions and most adjacent digit transpositions. It cannot detect every possible multi-digit change.
Is Luhn a security or encryption algorithm?
No, it is a public error-detection formula and offers no secrecy or authentication. Secure systems must perform separate authorization and issuer checks.
Can I validate numbers containing spaces or hyphens?
This calculator intentionally requires digits only so the exact input is unambiguous. Remove formatting characters before validation.