Credit Card Validator (Luhn)
Check whether a card number passes the Luhn checksum and detect its brand — all in your browser.
How to use
- Type or paste a card number (spaces are fine).
- It's checked against the Luhn formula and the brand is detected.
- Use test numbers like 4242 4242 4242 4242.
How the Credit Card Validator (Luhn) works
Checks whether a card number is structurally valid using the Luhn checksum, and identifies the issuing network from its prefix.
The Luhn algorithm doubles every second digit from the right, subtracts 9 from any result above 9, sums everything, and passes if the total is divisible by 10. The network comes from the leading digits.
double every 2nd digit from the right, subtract 9 if > 9, sum, then check sum mod 10 == 0
Worked example
4532015112830366 passes the checksum and starts with 4, so it is identified as Visa.
Things worth knowing
- Prefixes: 4 is Visa, 51–55 and 2221–2720 Mastercard, 34/37 American Express, 6011/65 Discover.
- Luhn only catches typos. A number can pass the checksum and still not correspond to any real account — only the issuer can confirm that.
- Validation is local; the number is never transmitted. Even so, do not paste real card numbers into any web tool as a habit.
Frequently asked questions
Does Luhn mean the card is real?
No — Luhn only checks the number is well-formed. It doesn't confirm the card exists or has funds.
Is my card number stored?
No — validation runs entirely in your browser and nothing is transmitted.
Why does Luhn exist?
To catch the mistakes humans actually make — single mistyped digits and transposed adjacent pairs — before a transaction is attempted.