Credit Card Validator
Check card numbers with the Luhn algorithm and detect the card type.
Was this tool helpful?
Thanks for the feedback!
This Credit Card Validator checks whether a card number is mathematically well-formed using the Luhn checksum, then names the likely card network from its first digits. Developers use it to test checkout forms and payment integrations; shoppers can use it to catch a mistyped digit. It never contacts a bank, so it can't tell you whether a card is active or has funds.
What to enter and what you get back
Paste a number of 12 to 19 digits. Spaces and hyphens are removed automatically, so 4111 1111 1111 1111 and 4111-1111-1111-1111 are treated the same, but letters or other symbols trigger the message "Enter 12-19 digits." The result has two lines: ✓ Passes Luhn check or ✗ Fails Luhn check (invalid number), followed by a brand pattern.
The Luhn check, step by step
The Luhn algorithm (also called mod 10) was designed to catch typing mistakes. Starting from the rightmost digit, double every second digit; if a doubled value is over 9, subtract 9. Add everything up. A valid number gives a total divisible by 10.
For 4111 1111 1111 1111, the doubled positions are the first digit and every other 1 after it: 4 becomes 8, and seven 1s become 2 each, giving 8 + 14 = 22. The eight undoubled 1s add 8. The total, 30, ends in zero, so the number passes. Change the last digit to 2 and the total becomes 31, so it fails. The check catches every single wrong digit and nearly every swap of two neighbouring digits (09 and 90 is the one swap it misses).
The same checksum protects other numbers too. A 15-digit mobile IMEI such as 490154203237518 passes, because its last digit is a Luhn check digit; ignore the brand line in that case.
How the brand is guessed
| Number starts with | Tool shows |
|---|---|
| 4 | Visa |
| 51 to 55 | Mastercard |
| 34 or 37 | American Express |
| 6 | Discover/RuPay |
| anything else | Unknown |
Treat this as a hint, not an identification. Mastercard's newer 2221 to 2720 range, JCB, Diners Club, Maestro and some RuPay ranges all show Unknown, and UnionPay cards starting with 62 are labelled Discover/RuPay. The exact issuing bank can only be found from the full BIN (the first six to eight digits) through a BIN database.
Test numbers for developers
4111 1111 1111 1111(Visa format)5555 5555 5555 4444(Mastercard format)3782 822463 10005(American Express, 15 digits)6011 1111 1111 1117(Discover format)
These are widely published gateway test numbers. They pass Luhn but will be declined by any live payment system, which makes them ideal for testing form validation without risk.
What passing does not prove
A number can pass Luhn and still be unissued, expired, blocked or fake; roughly one in every ten random numbers passes by chance. Expiry date, CVV, cardholder name and OTP checks all happen at the bank during authorisation. The check runs in your browser, but as a habit, use test numbers rather than your real card.