Credit Card Number Generator & Validator
Validate a credit card number with the Luhn algorithm and identify its issuer, or generate fake, Luhn-valid test numbers.
Loading tool...
How to validate a credit card number
Every payment card number ends with a check digit computed with the Luhn algorithm (also called "modulus 10" or "mod 10", described in ISO/IEC 7812-1). It was designed to catch accidental typing errors before a transaction is even attempted. It is not a security feature: a number that passes the check is well formed, it is not necessarily attached to a real account.
The algorithm, step by step
- Drop the last digit of the number: this is the check digit you want to verify.
- Reverse the remaining digits.
- Multiply the digits in odd positions (1st, 3rd, 5th...) by 2.
- If a product is greater than 9, subtract 9 from it.
- Add all the resulting digits together.
- The check digit is
(10 - sum mod 10) mod 10. If it equals the digit you dropped in step 1, the number is valid.
Anatomy of a card number
- MII: the first digit identifies the industry of the issuer.
- IIN / BIN: the first 6-8 digits identify the issuing institution.
- Account number: the digits between the IIN and the check digit.
- Check digit: the last digit, computed with the Luhn algorithm.
List of credit card formats
| Issuer | Starts with | Length |
|---|---|---|
| American Express | 34, 37 | 15 |
| Diners Club | 300-305, 36, 54, 55 | 14-16 |
| Discover | 6011, 622126-622925, 644-649, 65 | 16-19 |
| JCB | 3528-3589 | 16-19 |
| MasterCard | 2221-2720, 51-55 | 16 |
| Visa | 4 | 13-19 |