Credit Card Validator

Check card numbers with the Luhn algorithm and identify the card network.

  • Runs in your browser
  • Free, no sign-up

Use test numbers. Nothing you type leaves your browser.

Test numbers

Result Waiting for a number
  • Card network-
  • Luhn checksum-
  • Length-
  • Check digit-
  • Issuer number (IIN)-

Check many numbers

Results

Results appear here.

About the Credit Card Validator

Every payment card number ends with a check digit, calculated from the other digits with the Luhn algorithm. If one digit is mistyped or two neighbors are swapped, the check fails. The Credit Card Validator runs that check, works out the card network from the first digits, and confirms that the length fits that network.

It is made for developers and testers: check the test numbers your payment provider publishes, validate a form before connecting it to a real gateway, or clean up a list of numbers in a test data set. The number is grouped as you type, the way it is printed on the card, and a batch mode checks up to 1,000 numbers at once and exports the results as CSV.

Validation only tells you that a number is well-formed. It does not show whether a card exists, is active or has funds; only the card issuer knows that. Everything runs in your browser, nothing is stored or sent, and you should only enter test numbers.

How to use it

  1. Enter a numberType or paste a card number. Spaces and hyphens are fine, and the number is grouped automatically, 4-6-5 for American Express and in fours for most others.
  2. Or use a test numberThe buttons fill in standard test numbers for Visa, Mastercard, American Express, Discover and JCB, plus one that fails the check.
  3. Read the resultThe result says whether the number is valid, and the list shows the network, the Luhn result, the length, the check digit and the first six digits (the issuer number).
  4. Check many at oncePaste one number per line into "Check many numbers" to get a table with the network, Luhn, length and result for each line.
  5. Export the resultsClick CSV to download the batch results as card-check.csv.

Key features

Luhn checksum

The standard mod 10 check used by every major card network, which catches every single-digit typo and most swapped neighbors.

Network detection

Recognizes Visa, Mastercard (including 2-series), American Express, Discover, JCB, Diners Club, UnionPay, Maestro and Mir by their number ranges.

Length check

Confirms the length fits the network, for example 15 digits for American Express and 16 for Mastercard.

Formatting as you type

Digits are grouped like on the card, and the cursor stays where you are typing.

Batch mode with CSV

Check up to 1,000 numbers at once and download the results.

Private by design

Nothing leaves your browser: no network requests, no storage, no logging.

Examples

The built-in test numbers

NumberNetworkResult
4111 1111 1111 1111VisaValid
5555 5555 5555 4444MastercardValid
3782 822463 10005American ExpressValid
6011 1111 1111 1117DiscoverValid
3530 1113 3330 0000JCBValid
4111 1111 1111 1112VisaLuhn fails

For the first one, the details read: network Visa, Luhn checksum Passes, length 16 digits, check digit 1 and issuer number 411111.

How the Luhn check works

Start from the rightmost digit and double every second digit, moving left. When doubling gives more than 9, subtract 9. Then add everything up. The number is valid when the total ends in 0.

For 4111 1111 1111 1111, the eight digits that are not doubled are all 1, which gives 8. The doubled digits are seven 1s, which become 2s (14), and the leading 4, which becomes 8. The total is 8 + 14 + 8 = 30, which ends in 0, so the number passes. Change the last digit to 2 and the total becomes 31, so the check fails.

Length problems

Typing 5555555555554 gives Not a valid number even though the Luhn checksum passes, because the length shows 13 digits (Mastercard uses 16). The result adds: "The length does not fit this card network."

More networks

NumberNetwork
2223 0031 2200 3222Mastercard (2-series)
3622 720627 1667Diners Club
6200 0000 0000 0005UnionPay
5018 0000 0000 0009Maestro
4222 2222 2222 2Visa (13 digits)

All five pass. A number that passes the checksum but matches no known range, such as 0000 0000 0000 0000, is shown as Checksum passes with an unknown card network, not as a valid card.

Tips

  • Use the test numbers from your payment provider's documentation when testing checkouts. They pass validation and trigger specific test responses, such as a decline, in the provider's sandbox.
  • Validate in your checkout form before sending the number to the payment provider. Catching typos early gives a faster, friendlier error message.
  • Let customers type spaces. Strip spaces and hyphens before validating, as this tool does, instead of rejecting them.
  • Show the detected network next to the card field so customers see right away that they entered the card they meant to use.
  • Use batch mode to check a whole fixture file of test numbers before a release, then keep the CSV with your test notes.

Common mistakes and limits

  • Treating "valid" as "real"A valid number only has the right form. It may never have been issued, may be expired or blocked. Only an authorization with the payment provider checks that.
  • Entering real card numbersThis tool never sends anything, but other websites might. Get into the habit of using test numbers for testing, here and anywhere else.
  • Storing card numbers to validate them laterKeeping full card numbers brings strict PCI DSS requirements. Use your payment provider's hosted fields or tokens instead.
  • Relying on the first six digits foreverCard networks are moving to 8-digit issuer numbers, and new ranges appear over time. Network detection is a convenience, not a guarantee.
  • Rejecting numbers by length aloneVisa cards can have 13, 16 or 19 digits, and Maestro 12 to 19. Validate the length per network, not with a single fixed value.

Frequently asked questions

What does this credit card validator check?
The Luhn checksum, the card network based on the first digits, and whether the length fits that network. Together they catch almost all typing mistakes.
Does a valid result mean the card works?
No. It only means the number is well-formed. Whether the card exists and can be charged is only known to the issuer, through a payment authorization.
What is the Luhn algorithm?
A simple checksum from 1954, also called mod 10. Every second digit from the right is doubled, the digits are added up, and the total must end in 0. It detects any single wrong digit.
Which card networks are recognized?
Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, Maestro and Mir. Other numbers can still pass the checksum and are shown with an unknown network.
What is the IIN?
The issuer identification number, the first digits of the card, which identify the network and the bank that issued the card. The tool shows the first six.
Is it safe to enter a card number here?
The check runs entirely in your browser and nothing is sent or saved. Still, there is no reason to enter a real card; use test numbers.
Can I validate many numbers at once?
Yes. Paste up to 1,000 numbers, one per line, into "Check many numbers", and download the results as CSV.
Does it check the expiry date or CVV?
No. Expiry dates and security codes are not part of the card number and cannot be checked without the issuer.