Skip to main content
CalcChef

Credit Card Validator

Credit card validator: checks the number’s length for its network (Visa, Mastercard, Amex), then the Luhn check digit. It cannot tell if a card exists. How it works

Use the Credit Card Validator

Digits entered: 0

Card check
Enter a card number
Network —

This tool checks that the length fits the card network and that the Luhn check digit matches. It does not check that the card is real, active or belongs to an account.

About the Credit Card Validator

A card number passes this check when its length fits its network and its Luhn check digit matches: 4111 1111 1111 1111 is Visa-length with a matching check digit, while 4242 4242 4242 4243 fails because the check digit is wrong. A pass shows the number is well formed. It does not show that the card exists, is active or has funds.

Card number lengths the tool accepts

NetworkStarts withDigits allowed
Visa413, 16 or 19
Mastercard51 to 55, 2221 to 272016
American Express34, 3715
Discover6011, 644 to 649, 65, 622126 to 62292516 to 19
JCB3528 to 358916 to 19
UnionPay62, outside the Discover range16 to 19
Diners Club300 to 305, 36, 38, 39, 309514 to 19
Maestro5018, 5020, 5038, 5893, 6304, 6759, 6761 to 6763, other 50 and 56 to 58 starts12 to 19
Any other startNo listed network12 to 19

Lengths come from the Wikipedia table of payment card numbers. A number must have a length from its row and pass the Luhn check digit to show Valid Number.

What the tool says for some example numbers

Number typedResultMessage under it
4111 1111 1111 1111Valid Number, Visa16 digits, and the check digit matches.
5555 5555 5555 4444Valid Number, Mastercard16 digits, and the check digit matches.
3782 822463 10005Valid Number, American Express15 digits, and the check digit matches.
4242 4242 4242 4243Invalid NumberThe check digit does not match, so the number is mistyped or made up.
4111 1111 1111 111Invalid NumberVisa numbers have 13, 16 or 19 digits. This one has 15.
4111111111111111111111Invalid NumberVisa numbers have 13, 16 or 19 digits. This one has 22.
0000 0000 0000 0000Invalid NumberA card number cannot be all zeros.

Example numbers only. The tool shows the network name only when the number is valid. A number of 12 to 19 digits that passes the check digit but starts with no listed prefix shows Valid Number with Unknown network.

How to use this tool

  1. Type or paste the card number. Spaces and dashes are ignored, and a result appears from 12 digits.
  2. Read the result: Valid Number with the network name, or Invalid Number with the reason underneath.
  3. Use Clear number to remove what you typed.

Frequently asked questions

How do I check if a credit card number is valid?
Type or paste the number. Spaces and dashes are ignored, and a result appears from 12 digits. The tool checks, in order, that the number is not all zeros, that its length fits the network its first digits point to, and that the Luhn check digit matches. 4111 1111 1111 1111 shows Valid Number and Visa, with the message "16 digits, and the check digit matches."
What is the Luhn algorithm?
A check-digit rule: from the right, double every second digit, subtract 9 from any result above 9, add all the digits, and the total must be a multiple of 10. For 4111111111111111 the total is 30, so it passes; with the last digit changed to 2 it is 31 and fails. It catches every single-digit error and almost every swap of two adjacent digits (09 and 90 slip through). It protects against typing mistakes, not against someone building a number on purpose.
How many digits does a credit card number have?
The general rule on the Wikipedia page for payment card numbers is 8 to 19 digits. This tool is stricter by network: Visa 13, 16 or 19, Mastercard 16, American Express 15, Diners Club 14 to 19, Discover, JCB and UnionPay 16 to 19, Maestro 12 to 19. A number that matches no listed network must have 12 to 19 digits.
Does a valid result mean the card is real?
No. About one string of digits in ten has a matching check digit, so passing the Luhn test says little about whether an account exists. The tool does not contact a bank or a card network, and it has no field for an expiry date or security code, so it cannot tell whether a card is active, blocked or has funds.
Why does it say the check digit does not match?
One digit is wrong, or two were swapped. 4242 4242 4242 4242 passes, while 4242 4242 4242 4243 fails with "The check digit does not match, so the number is mistyped or made up." Compare the digits with the card. A number made up at random fails this test about nine times in ten, even when its length is right.
Should I type a real card number into a validator?
You do not need to. The check works on the digits alone, so an example number such as 4111 1111 1111 1111 shows how it behaves. This tool asks for neither an expiry date nor a security code, and no tool that checks only a format needs them.

Related Tools

View all tools