The Luhn algorithm (mod 10) is the check-digit formula behind credit card numbers, IMEI device identifiers and many national IDs. It exists to catch accidental typos and digit swaps before a number is processed. This checker validates any number and computes the correct check digit, entirely in your browser.
How it works
To validate a number that already includes its check digit:
- Starting from the rightmost digit, double every second digit.
- If a doubled value exceeds 9, subtract 9 (equivalently, add its two digits).
- Sum all the resulting digits. The number is valid if the total is divisible by 10.
To compute the check digit for a payload that has no check digit yet, run the same weighting as if a 0 were appended, then the check digit is (10 - (sum mod 10)) mod 10.
Example
The number 4539 1488 0343 6467 produces a Luhn sum divisible by 10, so it passes. Change any single digit and the sum stops being a multiple of 10, which is exactly how Luhn catches typos.
Notes
Luhn detects all single-digit errors and nearly all adjacent transpositions, with the lone exception of swapping a 0 and a 9. A passing result means the digits are consistent, not that the card or device exists — it is a format check only. Nothing you type is sent anywhere.