networks · 2025-01-27 · 8 min read
How prefixes map to Visa, Mastercard, Amex, Discover, JCB and the rest
A complete cheat-sheet of the leading digits and lengths each network uses, plus the three traps that break most home-grown validators.

Card networks carve up the leading digits of the PAN between them. Knowing the map lets a form show the right logo, pick the right security-code length and format the number correctly. The live ranges table on this site highlights whichever row matches what you type.
The reference table
- Visa — starts with 4 · 13, 16 or 19 digits · CVV2 (3 digits).
- Mastercard — 51–55 and 2221–2720 · 16 digits · CVC2 (3).
- American Express — 34 or 37 · 15 digits · CID (4, printed on the front).
- Discover — 6011, 644–649, 65 and 622126–622925 · 16 or 19 digits · CID (3).
- JCB — 3528–3589 · 16 to 19 digits · CAV2 (3).
- Diners Club — 300–305, 3095, 36, 38–39 · 14, 16 or 19 digits · CVV (3).
- UnionPay — 62 and 81 · 16 to 19 digits · CVN2 (3).
- Maestro — 5018, 5020, 5038, 56–59, 6304, 6759, 6761–6763 · 12 to 19 digits · CVV (3), sometimes absent.
Trap 1: the Mastercard 2-series
Mastercard added 2221–2720 in 2016 to relieve pressure on 51–55. Old regexes that only check ^5[1-5] silently reject millions of valid cards. Mastercard's own 2-series FAQ describes the rollout; test it with Stripe's 2223 0031 2200 3222 in the test numbers.
Trap 2: shared ranges
622126–622925 belongs to both Discover and UnionPay through a network agreement, and Maestro overlaps several of the above. Always prefer the most specific match (longest prefix) rather than the first regex that happens to pass.
Trap 3: assuming 16 digits
Amex is 15, Diners is often 14, Maestro can be 12. Validators that hard-code 16 fail real customers; see why card numbers are 12 to 19 digits long.
Prefix detection is a usability feature, not a security control. It tells you which logo to show; it does not tell you whether the card is real — only an authorization does.

Keywords: card prefixes, Visa prefix, Mastercard 2-series, Amex 34 37, Discover 6011, JCB 35, card brand detection, IIN ranges
Frequently asked questions
What numbers do Visa cards start with?
All Visa cards start with the digit 4 and have 13, 16 or 19 digits.
Why does my validator reject a Mastercard starting with 2?
Because it predates the 2016 2-series expansion. Mastercard now uses 2221–2720 in addition to 51–55.