Credit Card Validator — Luhn Check and Card Brand Detection
- Card network
- —
- Luhn checksum
- —
- Length
- —
- IIN (first 6 digits)
- —
- Security code
- —
Try a published test number
These are sandbox numbers published by payment processors. No real account is behind them.
Paste a card number to see whether it is structurally valid: the Luhn checksum, the digit count, and the issuing network detected from the IIN prefix. Useful for testing payment forms, debugging a checkout flow, or catching a typo before a transaction fails. Everything runs in your browser — the number never leaves the page.
How it works
- 1 Type or paste the number Spaces and dashes are fine — they are stripped automatically, and the number is regrouped as you type using the spacing that card network uses.
- 2 Read the verdict Green means the number passes the Luhn checksum and has a valid length for a recognised network. Red means one of those checks failed, and the note underneath says which.
- 3 Check the breakdown Below the verdict you get the detected brand, the Luhn result, the digit count against what the brand allows, the six-digit IIN, and the expected security-code length.
Your data stays private
All processing happens entirely in your browser. No files, text, or data are ever sent to our servers. You can disconnect from the internet and this tool will still work.
Frequently asked questions
- Does passing this check mean the card works?
- No. The Luhn checksum only proves the digits are internally consistent — it catches typos and swapped digits. Whether an account exists, has funds, or is expired can only be answered by the issuing bank through a payment processor.
- What is the Luhn algorithm?
- A checksum published by IBM engineer Hans Peter Luhn in 1954. Starting from the right, every second digit is doubled (subtracting 9 from any result over 9), all digits are summed, and a valid number gives a total divisible by 10. It catches every single-digit error and almost every transposition.
- Which card networks are detected?
- Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, Maestro, and Mir. Detection uses published IIN ranges, so a valid number from a network outside that list shows as unrecognised.
- Is my card number sent anywhere?
- No. The validator is JavaScript running in your browser. There is no request, no logging, and no storage — turn off your network connection and the page keeps working. Still, use test numbers rather than a real card wherever you can.
- Where do I get test card numbers?
- Payment processors publish them. 4111 1111 1111 1111 (Visa) and 4242 4242 4242 4242 (Stripe's Visa test card) are the best known. They pass Luhn and are reserved for sandboxes — no real account sits behind them.
- Why does my valid card show the wrong brand?
- IIN ranges get reassigned, and some co-branded or regional cards use prefixes outside the ranges their network publishes. The Luhn and length results stay accurate even when brand detection guesses wrong.