The Luhn algorithm (mod-10) is the checksum that guards almost every payment card number, as well as IMEI device IDs and many national identifiers. It catches the most common data-entry mistakes — a single wrong digit or two swapped digits — before a number ever reaches a server. This tool runs that check locally and explains the result.
How it works
Working from the rightmost digit leftward:
- Double every second digit.
- If a doubled value is greater than 9, subtract 9 (equivalently, add its two digits).
- Add up all the resulting values.
- The number is valid when that total is a multiple of 10.
The final digit of the number is the check digit — it is specifically chosen so the whole sequence passes step 4. When a number fails, the tool computes what the check digit should have been, which usually pinpoints the typo.
It also inspects the leading digits to label the likely card brand (Visa starts with 4, Mastercard with 51-55 or 2221-2720, American Express with 34 or 37, and so on).
Tips and notes
- Spaces and dashes are ignored, so you can paste
4539 1488 0343 6467directly. - For example,
79927398713is a classic Luhn-valid test value — its digits sum to a multiple of 10. - Use the generator to create fictitious, Luhn-valid numbers per brand for testing checkout forms. These are not real cards and cannot be charged; they only exercise your validation logic.
- A pass means well-formed, not authorised. Always rely on your payment processor for real authorisation. Everything here stays on your device.