networks · 2025-05-05 · 4 min read
Why card numbers are 12 to 19 digits long (and 16 is not a rule)
ISO/IEC 7812 allows up to 19 digits. Most cards use 16, but assuming 16 breaks Amex, Diners and many Maestro cards — one of the most common validation bugs in the wild.

The ISO/IEC 7812-1 standard sets a maximum of 19 digits for a PAN: up to 8 for the issuer identifier, a variable-length account identifier, and one check digit. There is no rule that says 16.
Lengths by network
- Visa — 13 (legacy), 16, and 19 for some newer programs.
- Mastercard — 16 only.
- American Express — always 15.
- Diners Club — 14 (classic), 16 (Discover-processed) or 19.
- Discover — 16 or 19.
- JCB — 16 to 19.
- UnionPay — 16 to 19.
- Maestro — anywhere from 12 to 19.
The prefix cheat-sheet pairs each range with its lengths, and the ranges table applies them live.
Validating length correctly
- Detect the brand first, then check the length against that brand's allowed set.
- If the brand is unknown, accept 12–19 and let Luhn and the gateway decide.
- Set input
maxlengthto 23 (19 digits plus up to 4 spaces) — see formatting as you type. - Treat 'too short' as incomplete (no error yet) and only 'wrong length for brand' as an error, per the error-message guidelines.
Hard-coding 16 as the only valid length rejects every American Express customer — a bug still shipped by surprisingly large sites.

Keywords: card number length, how many digits credit card, Amex 15 digits, Diners 14 digits, Maestro length, ISO 7812 length
Frequently asked questions
How many digits are on an American Express card?
Fifteen, grouped 4-6-5, with a 4-digit security code on the front.
Can a credit card number have 19 digits?
Yes. Visa, Discover, JCB, UnionPay, Diners Club and Maestro all issue 19-digit cards in some programs.