What the validator checks
A card number can be checked for three things without contacting a bank. The validator runs all three and shows the result of each:
- Issuer (IIN) range. The first digits identify the card network: 4 for Visa, 51–55 or 2221–2720 for Mastercard, 34 or 37 for American Express, 6011, 644–649 and 65 for Discover (622126–622925 are UnionPay co-branded cards also routed as Discover), 3528–3589 for JCB, and so on.
- Length. Each brand allows specific lengths — 15 digits for Amex, 14 for most Diners Club cards, 16 for most others, and up to 19 for some Visa, Discover, JCB, UnionPay and Maestro cards.
- Luhn checksum. The last digit is a check digit. The Luhn formula catches any single mistyped digit and most swaps of two neighbouring digits (it misses 09 ↔ 90).
If all three pass, the number is well-formed. That is all any website can know on its own: whether the account exists, is open, and has funds is only known to the issuing bank and is checked when a payment is authorized.
Can you check a CVV online?
Only its format. The CVV is not calculated from the card number by any public formula, so a website can check just its length: 3 digits for Visa, Mastercard, Discover, JCB and most others, 4 digits for American Express. Type a code in the optional CVV field above to run that check. Whether a code matches the card is known only to the issuing bank and is checked during a payment authorization — tools that claim to "find" or "check live" CVVs are scams or fraud tools. More in CVV vs CVC vs CID.
Luhn algorithm, step by step
Here is the calculation for the test number 4111 1111 1111 1111. Every second digit from the right is doubled; when the double is greater than 9, 9 is subtracted. The values are added up:
| Digit | 4 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Doubled? | 8 | – | 2 | – | 2 | – | 2 | – | 2 | – | 2 | – | 2 | – | 2 | – |
| Value added | 8 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 |
The total is 30. Because 30 is divisible by 10, the number passes. If you change any single digit, the total changes and is no longer a multiple of 10 — try it in the validator above to see which check digit the edited number would need.
Card number structure
| Part | Digits | Meaning |
|---|---|---|
| Major Industry Identifier (MII) | 1st | Industry: 1–2 airlines, 3 travel & entertainment, 4–5 banking & finance, 6 merchandising & banking, 7 petroleum, 8 healthcare & telecom, 9 national assignment |
| Issuer Identification Number (IIN / BIN) | First 6–8 | Network and issuing bank, card type (credit, debit, prepaid) and country |
| Account identifier | Middle digits | Chosen by the issuer for the individual card |
| Check digit | Last | Calculated with the Luhn algorithm from all other digits |
When to use a card validator
- Debugging why a checkout form rejects a number a customer typed.
- Checking test fixtures and seed data before importing them.
- Comparing your own validation code against a reference implementation.
- Learning how card numbers are built — see also our FAQ.
Frequently asked questions
Does a valid result mean the card is real?
No. The validator checks the format only. Whether an account exists, is active or has funds can only be confirmed by the issuing bank through a payment authorization.
Is it safe to paste a real card number here?
The check runs in JavaScript on your device and the number is never sent to our server. Still, as a habit, avoid pasting real card numbers into any website you do not need to.
What does the Luhn check detect?
It catches all single-digit typos and most swaps of two adjacent digits. That is why forms use it to give instant feedback before the payment is submitted.
Why is my number invalid?
Usually a typo: one wrong digit makes the Luhn sum fail. The validator shows which check digit the number would need, so you can see the difference.
Can this validator check if a CVV is correct?
No tool outside the issuing bank can. A website can only confirm the length — 3 digits, or 4 for American Express. The bank checks whether the code matches when a payment is authorized.
How do I get a valid credit card number?
A real, usable number only comes from a bank or card issuer that opens an account in your name; it cannot be generated. For testing, “valid” means format-valid: use the generator for Luhn-valid numbers, or your payment gateway’s official test cards in sandbox mode.