Credit Card Validator
ValidatorValidate any credit card number's Luhn checksum and detect its network by IIN prefix. Free, runs entirely in your browser — nothing you type ever leaves your device.
For testing only — nothing leaves your browser
This tool only checks the mathematical structure of a card number (Luhn checksum + IIN prefix). It cannot check balance, validity with a bank, or whether a card is real. Never enter a live card number here or anywhere you don't fully trust — use the classic test numbers below.
About this tool
About the Credit Card Validator
This tool checks whether a credit or debit card number is internally consistent using the Luhn algorithm — the same checksum every major card network builds into its numbering scheme — and identifies the network from the number's IIN (Issuer Identification Number) prefix. It's a structural check only: it tells you the number is well-formed, not that it belongs to a real, active account.
The validator strips spaces and hyphens, runs the Luhn mod-10 checksum over the digits, and matches the leading digits against the published IIN ranges for Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, and Maestro — checked in an order that resolves overlapping ranges correctly, so a Mastercard 2-series number is never misread as Maestro. It reports the detected network, whether the length matches that network's expected length, and whether the Luhn checksum passes.
Use this validator to check that test card numbers behave as expected in a payment form before it reaches a real payment gateway, to debug why a card number is being rejected by client-side validation, or to learn how the Luhn algorithm and card network prefixes work.
Every computation happens locally in your browser in plain JavaScript — no network request is made, no number is logged, and nothing is stored. The classic test numbers built into this page (Visa, Mastercard, Amex) are the same numbers used industry-wide in payment gateway sandboxes.
Key Features
- Luhn mod-10 checksum validation
- Card network detection by IIN prefix (Visa, Mastercard, Amex, Discover, JCB, Diners, UnionPay, Maestro)
- Correctly resolves overlapping prefix ranges (e.g. Mastercard 2-series vs. Maestro)
- Expected-length check per detected network
- Built-in classic test numbers
- 100% browser-based — no data ever leaves your device
FAQ
Credit Card Validator — Frequently Asked Questions
Is it safe to enter a real credit card number here?
This tool only performs local, client-side arithmetic — no network request is ever made, and nothing you type is logged or stored. That said, you should never need to enter a real card number to test a checksum: use the built-in test numbers instead, which are the same publicly documented numbers used in payment gateway sandboxes worldwide.
Does a valid Luhn checksum mean the card is real and active?
No. The Luhn checksum only confirms the number is internally consistent — it's a typo-catching checksum, not proof the card exists, has funds, or hasn't been cancelled. Only the card issuer's systems can confirm a card is genuinely active.
How does the Luhn algorithm work?
Starting from the rightmost digit and moving left, every second digit is doubled; if doubling produces a number greater than 9, its digits are summed (or equivalently, 9 is subtracted). All digits are then added together, and the number is valid if the total is a multiple of 10.
Why does this tool say the network is unrecognized?
The card's leading digits don't fall into any of the published IIN ranges for Visa, Mastercard, Amex, Discover, JCB, Diners Club, UnionPay, or Maestro. The number may still pass the Luhn checksum and be a valid card from a network or region not covered by this tool's prefix table.
Tips
- Use the built-in test numbers — they're the same ones accepted by most payment gateway sandboxes
- Spaces and hyphens are stripped automatically before validation
- The Credit Card Generator on this site produces fresh Luhn-valid test numbers for any network
- A card can be Luhn-valid and still be entirely fictitious — this tool cannot confirm real-world validity
Explore more
Related Tools
Other tools that might be useful for your workflow