Credit Card Validator

Validate credit card numbers using the Luhn algorithm. Check Visa, Mastercard, American Express, and other card types instantly.

Enter Credit Card Number

Enter 13-19 digits. Spaces are automatically formatted.

Test Card Numbers (For Testing Only)

  • Visa: 4539 1488 0343 6467
  • Mastercard: 5425 2334 3010 9903
  • American Express: 3782 822463 10005
  • Discover: 6011 1111 1111 1117

Note: These are test numbers only. This validator checks format, not if a card is active or has funds.

How Credit Card Validation Works

Our credit card validator uses the Luhn algorithm (also called mod-10 algorithm) to verify that a credit card number is mathematically valid. This is the same method used by banks and payment processors worldwide.

Luhn Algorithm Steps:

  1. Starting from the rightmost digit, double every second digit
  2. If doubling results in a number greater than 9, subtract 9
  3. Sum all the digits together
  4. If the total is divisible by 10, the card number is valid

Worked example — is 4539 1488 0343 6467 valid?

Starting from the right, double every second digit (the 6 in the second-from-last position becomes 12, and so on), subtract 9 from any result above 9, then add every digit together. For this number the total comes to a multiple of 10, so it passes. Flip just the last digit — 4539 1488 0343 6468 — and the total no longer divides by 10, so it fails. That single check digit is what catches most mistyped card numbers.

What This Validator Checks:

  • Card number length (13-19 digits)
  • Luhn algorithm checksum
  • Card type detection (Visa, Mastercard, Amex, etc.)
  • Does NOT check if card is active or has funds
  • Does NOT verify expiration date or CVV

Card number format by network

The first few digits — the Issuer Identification Number (IIN, also called the BIN) — tell you which network issued the card, and each network uses a set length. That is how this validator labels the brand before it runs the Luhn check:

NetworkStarts withLength
Visa416 (some 13 or 19) digits
Mastercard51–55, 2221–272016 digits
American Express34, 3715 digits
Discover6011, 65, 644–64916 digits
Diners Club36, 38, 300–30514 (some 16) digits
JCB3528–358916–19 digits

The final digit of every card is the Luhn check digit, calculated from the rest of the number.

Frequently Asked Questions

Should I enter my real credit card number here?

You can — it is technically safe, because everything runs in your browser and nothing is ever sent to our servers. But as general advice, do not type your real card number into random websites; use the test numbers above instead. This tool is built for developers testing payment forms, accountants checking invoices, and anyone curious how card validation works.

If it says valid, does that mean the card works?

No. The Luhn check only confirms the number is mathematically well-formed — like checking that a car’s VIN looks correct. It cannot see whether the card is active, expired, blocked, or has any money on it; only the issuing bank knows that. A valid result simply means the digits pass the checksum that catches most typos.

Which card types does this recognize?

Visa, Mastercard, American Express, Discover, Diners Club and JCB. Each brand has its own prefix, called the IIN or BIN: Visa starts with 4, Mastercard with 51–55 or 2221–2720, American Express with 34 or 37, and Discover with 6011 or 65. The validator reads that prefix to identify the card type instantly.

Why do some made-up numbers still pass?

Because the Luhn algorithm only checks the checksum, not whether the number was ever issued. Roughly one in ten random 16-digit numbers will pass by chance. The check digit exists to catch typos: transpose two digits in a real number and it will almost always fail, which is exactly its job.

How long is a credit card number?

Most are 16 digits — Visa, Mastercard and Discover. American Express is 15 and Diners Club is 14. The full range the standard allows is 13 to 19 digits, which is why this validator accepts anything in that window before applying the Luhn check and detecting the brand.

What is the Luhn algorithm?

The Luhn algorithm (also called the mod-10 algorithm) is a simple checksum formula used to validate identification numbers, most famously credit card numbers. Hans Peter Luhn patented it in 1960. It works by doubling every second digit from the right, subtracting 9 from any result above 9, summing all the digits, and checking whether the total is divisible by 10. Card networks, banks and payment forms use it as a first-pass check to catch mistyped numbers before a payment is attempted.

Why did my card fail the Luhn check?

A Luhn failure almost always means a typo - a wrong, missing, transposed or extra digit. Re-enter the number carefully, including the final check digit. If a genuinely correct, active card number fails, make sure you have all 13 to 19 digits and that no leading or trailing digits were dropped. Remember the Luhn check only tests the math of the digits: a number can pass and still belong to a card that is expired, blocked or empty.

Can I use this as a Luhn calculator or checker?

Yes. Paste any number and it runs the Luhn (mod-10) checksum and tells you instantly whether it passes, along with the detected card brand. It validates an existing number rather than generating one. For software testing, use the published test card numbers above - such as 4539 1488 0343 6467 for Visa or 3782 822463 10005 for American Express - which are designed to pass the Luhn check without being real accounts.

Last updated June 10, 2026. Validates card-number format with the Luhn (mod-10) algorithm; it does not check whether a card is active or has funds.