Credit Card Validator

Check whether a card number is well-formed (Luhn check) and which network it belongs to — with official test numbers for developers.

Use test numbers. This tool runs entirely in your browser and stores nothing, but there's no reason to type a real card number into any website you don't buy from. It only checks the format — not whether a card exists, is active or has funds.

—Luhn check
—Network
—Length

Official test numbers

NetworkTest number

● The number is checked in your browser only. It is never stored, logged or sent anywhere.

What this validator checks

It only checks the format. It can't tell whether a card exists, is active or has funds — only the bank can, during a payment. Use the test numbers below: there's no reason to type a real card number into a site you aren't buying from.

How the Luhn algorithm works

The last digit of a card number is a check digit. To verify a number:

  1. Starting from the right, double every second digit (the 2nd, 4th, 6th… from the right).
  2. If a doubled value is over 9, subtract 9 (16 → 7).
  3. Add all the digits. If the total ends in 0, the number is valid.

Example with the classic test value 79927398713: the doubled digits give 2, 7, 6, 4, 9 (sum 28), the others 3, 7, 9, 7, 9, 7 (sum 42). 28 + 42 = 70, a multiple of 10: valid. The Luhn check catches any single mistyped digit and most swaps of two neighboring digits.

How to recognize the card network

NetworkStarts withLength
Visa413, 16 or 19
Mastercard51–55 or 2221–272016
American Express34 or 3715
Discover6011, 622, 644–649 or 6516 or 19
JCB3528–358916–19
Diners Club300–305, 36, 38, 3914, 16 or 19
UnionPay6216–19

The first 6 to 8 digits are the BIN (bank identification number), which identifies the issuing bank.

Test card numbers for developers

Payment providers publish numbers that pass the Luhn check but can't be charged, such as 4242 4242 4242 4242 (Visa), 5555 5555 5555 4444 (Mastercard) and 3782 822463 10005 (Amex). Use them in sandbox mode with any future expiry date and any CVC. Click Fill a test number or see the full table on this page.

FAQ

Is it safe to use?

The number is checked in your browser only and never stored, logged or sent. Still, use test numbers: no legitimate need requires typing a real card here.

Why does a valid-looking card get declined?

Passing the Luhn check only means the number is well-formed. A payment can still fail because of the expiry date, the CVC, the balance, fraud checks or a blocked card.

Can it generate card numbers?

No. It validates numbers and lists the official test numbers published for developers.

Does it check IBANs?

No. IBANs use a different checksum (mod 97).