Mastercard has two valid prefix ranges, not one.
If your validator only recognizes cards starting with 5, it's been silently rejecting a growing share of genuine Mastercards since 2017.
Mastercard's Number Structure
| Property | Value |
|---|---|
| Prefix (original) | 51, 52, 53, 54, 55 |
| Prefix (2-series, since 2017) | 2221–2720 |
| Length | 16 digits |
| Grouping | 4-4-4-4 |
| Security code | 3-digit CVC2, printed on the back |
| Network model | Open-loop — licensed to many issuing banks |
Why the Second Range Exists
The original 51–55 range was running out of available numbers as Mastercard's issuer base grew. In 2017, Mastercard officially opened a second range — 2221 through 2720 — to expand capacity. Cards in this range are genuine, fully valid Mastercards, processed identically to 51–55 cards: same interchange, same rules, same acceptance everywhere Mastercard is accepted. Merchants and payment systems are required to accept them.
The Assumption This Breaks
A shockingly common validation bug: a regex like ^5[1-5] that only recognizes the original range. Every card issued in the 2-series — a share that's been steadily growing since 2017 and represents a meaningful percentage of Mastercards in circulation today — gets silently misidentified or rejected outright by that kind of check. Worth being precise about the boundary too: the 2-series match needs to check all four digits, not just the leading 2. A card starting 2220 or 2721 is not Mastercard; only the window from 2221 through 2720 inclusive is.
Generating Mastercard Test Numbers
Select Mastercard from the Card Network dropdown above — Luhnly's generator randomly draws from both valid prefix ranges (51–55 and 2221–2720), so testing against it will naturally exercise both branches of your network-detection logic rather than just the more commonly-remembered one.
Related Guides
Frequently Asked Questions
Are 2-series Mastercards less common or somehow non-standard?
No — they're fully standard, officially issued Mastercards, identical in every functional respect to 51-55 cards. The only difference is the prefix range they were allocated from.
What's the exact boundary of the 2-series range?
2221 through 2720, inclusive, checking all four leading digits. A card starting 2220 falls just outside the range and isn't Mastercard; the same is true for anything starting 2721 or higher.
Does Luhnly's generator produce cards from both Mastercard ranges?
Yes — when you select Mastercard, the generator randomly draws from both the 51-55 and 2221-2720 prefix ranges, so you can test your own validation logic against both.