Skip to content
AZ Tools

Credit Card Validator (Luhn + Brand)

Validate a card number with the Luhn checksum, detect brand (Visa/MC/Amex/etc), and check expected length. Local, no network.

Enter a card number above.

⚠ Don't paste real cards into web tools. Use processor test numbers (e.g. Stripe's 4242 4242 4242 4242).

Detects brand from BIN/IIN prefix, validates length per brand, then runs Luhn mod-10. All local — nothing leaves your browser.

How to use

  1. Paste or type a card number. Spaces and dashes are stripped automatically.
  2. Watch the brand badge update as you type.
  3. ✓ valid means brand-correct length and Luhn pass. Real authorization still needs your processor.

About this tool

Show

Card numbers (PAN) embed a brand-specific Issuer Identification Number, an account number, and a final Luhn check digit. This tool: (1) detects brand from leading digits (Visa, Mastercard, Amex, Discover, JCB, Diners, UnionPay, Maestro), (2) checks the length matches that brand's spec, (3) runs the Luhn mod-10 checksum. Useful for client-side form validation — catches typos and obvious fakes before the payment processor sees them.

Luhn catches the mistakes people actually make, which is what it was designed for in the 1950s. Every single-digit error fails the check, and so does almost every transposition of two adjacent digits, the two commonest ways a number gets typed wrong. The exception is worth knowing: swapping 09 for 90 passes, because the doubling step maps both to the same value. That is the one transposition Luhn cannot see.

What the check cannot tell you is whether the card exists. Roughly one in ten random numbers of the right length passes Luhn by chance, so a number can be brand-correct, length-correct and checksum-valid while belonging to no account anywhere. Only an authorisation against the issuer answers that, and nothing running in a browser can. Treat a pass as evidence of no typo and nothing more.

The brand prefixes move. Issuer Identification Numbers are allocated and reallocated, ranges get added, and a table baked into client code drifts out of date rather than failing loudly: the symptom is a legitimate new card reported as an unknown brand. Refusing a payment on that basis turns a stale table into lost revenue, which is why brand detection belongs in the interface and never in the decision.

A card number is regulated data. PCI DSS governs storing or transmitting a PAN, which is why this runs entirely in the page and sends nothing, and it is also why a real form should hand the number to a processor's hosted field rather than to your own server.

Frequently asked questions

Does Luhn-passing mean the card is real?

No. Luhn only catches typos. A randomly generated Luhn-valid number is almost certainly not issued to anyone. Real validity needs your payment processor (Stripe, Adyen, etc) to attempt authorization.

Which brands are detected?

Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, and Maestro — by leading-digit pattern. Some cards (e.g. private-label store cards) won't match and show as 'unknown'.

Why does Amex show 15 digits?

Amex uses 15-digit PANs and a 4-digit CID (the security code). Visa/MC use 16-digit PANs and a 3-digit CVV. Discover/JCB are 16, sometimes 19.

Is it safe to paste a real card number here?

Computation runs entirely in your browser — nothing is sent over the network. That said, don't paste real cards into random web tools. Use test card numbers for validation testing (e.g. Stripe's 4242 4242 4242 4242).

Related tools