Credit Card Validator
Check a card number format with the Luhn algorithm.
Checked locally in your browser. Nothing is sent or stored.
Visa
16
Pass
4111 1111 1111 1111
4111••••••••1111
3 digits
Credit Card Validator
Type or paste a card number to see whether it is well formed. The validator removes spaces and dashes, detects the card network from the leading digits, checks the length and runs the Luhn checksum. It shows a formatted and a masked version of the number so you can read it easily.
How to use it
- Enter the number or press one of the test buttons (Visa, Mastercard, Amex, Discover, JCB or an invalid example).
- Read the verdict: a green message means the number passes the length and checksum rules, a red message explains what is wrong.
- Check the detected network, digit count and the expected length of the security code.
What the checks mean
Length. Visa uses 13, 16 or 19 digits, Mastercard 16, American Express 15 and Diners Club 14 to 19. A number with the wrong length is rejected before the checksum.
Luhn checksum. Every real card number ends in a check digit chosen so the whole number satisfies the mod 10 formula. A mistyped digit usually breaks the checksum, which is why online forms run this check before submitting a payment.
Network prefix. The first digits (the issuer identification number) show the brand. This tool recognizes Visa, Mastercard, American Express, Discover, Diners Club, JCB, UnionPay, Mir and Maestro.
For developers and testers
The test buttons use numbers published by payment processors for sandbox testing. They pass the Luhn check but are not linked to any account, so they are safe to use in demos, unit tests and form validation work. Use the invalid example to see how your own form should react to a typo.
Privacy
Everything happens locally in the page. The number is not sent to a server, logged or saved. For real payments, always use the secure checkout of a trusted merchant.
Frequently Asked Questions
Does a valid result mean the card is real or has funds?
No. The validator only checks that the number is well formed: the right length for its network and a correct Luhn checksum. It cannot tell whether an account exists, is active, or has money. Only the card issuer can confirm that.
Is it safe to enter my card number here?
The check runs entirely in your browser and nothing is uploaded or stored. Even so, use the public test numbers when you are only testing a form, and never share a real card number, expiry date and security code together.
What is the Luhn algorithm?
The Luhn or mod 10 algorithm doubles every second digit from the right, adds the digits of the results, and checks that the total is divisible by 10. It catches most single-digit typos and swapped neighbors, but it is not a security feature.
How does the tool know the card type?
Card networks reserve number prefixes: Visa starts with 4, Mastercard with 51 to 55 or 2221 to 2720, American Express with 34 or 37, Discover with 6011 or 65, and so on. The first digits and the length identify the network.