Advertisement

Prefix 51–55, 2221–2720 · 16 digits · 3-digit CVV

Mastercard Credit Card Generator

Generate 16-digit Mastercard test numbers from both the classic 51–55 range and the newer 2-series range, with expiry date and CVC.

Advertisement

Runs in your browser · 8 networks · 374,788 BINs

Generated cards

Test data only — these numbers are not issued by any bank and every real payment with them will be declined. Need a card that works online? Ask your bank for a virtual card. Testing a checkout? Use your gateway’s sandbox test cards.

Advertisement

Prefix 51–55, 2221–2720 · 16 digits · 3-digit CVV

Generated locally with your browser’s crypto API — nothing is sent to a server.

Mastercard format

Starts with
51–55, 2221–2720
Length
16
Security code
3
Stripe
5555 5555 5555 4444
Advertisement

About Mastercard card numbers

Mastercard is the second-largest card network outside China, after Visa. Like Visa, it does not issue cards directly; banks issue Mastercard credit, debit and prepaid cards and Mastercard operates the network and sets the rules, including the numbering ranges.

For decades every Mastercard number started with 51 to 55. Because that range was running out, Mastercard added the 2-series range 2221–2720 in 2017. Many older validation scripts still only accept numbers starting with 5, so a 2-series number is one of the most useful test cases you can run: if your form rejects it, real customers with new cards are being turned away.

Mastercard numbers are always 16 digits and carry a 3-digit card verification code (CVC2) on the back. The generator above mixes both ranges at random; type 2221 or 5 in the BIN field to force one of them.

Mastercard card number format and example

Starts with (IIN)51–55 and 2221–2720
Number length16 digits
Typical layout5xxx xxxx xxxx xxxx or 2xxx xxxx xxxx xxxx
Security code3-digit CVC2 on the back
Check digitLast digit, calculated with the Luhn (mod 10) algorithm
NetworkMastercard Inc.
Example (test number)5555 5555 5555 4444
Advertisement

Official Mastercard sandbox test numbers

3 gateways publish fixed Mastercard numbers that work only in test mode, for a predictable gateway response; the generator above is for bulk or randomized data.

GatewayTest number
Stripe5555 5555 5555 4444
Stripe (2-series)2223 0031 2200 3222
Braintree5555 5555 5555 4444

Sources: the gateways' own documentation — Stripe, Braintree.

Mastercard number examples (5-series and 2-series)

A complete Mastercard test plan needs one number from each range, because they fail in different places: old validation code often accepts only numbers starting with 5, and some input masks mis-group numbers starting with 2.

RangeExample (Stripe test number)What it tests
51–555555 5555 5555 4444Classic prefix, accepted by almost every form
2221–27202223 0031 2200 32222-series detection, logo and grouping

Both numbers only work in Stripe test mode. For your own Mastercard number, look at the card itself or the card details in your bank’s app — a generator cannot tell you a real number.

Need a billing address and ZIP code as well? Tick Add billing address & ZIP (US) above; how address (AVS) testing works is explained on the Visa generator page.

What to test with Mastercard numbers

Test one number from the 51–55 range and one from the 2-series (type 2221 in the BIN field): both must be detected as Mastercard. Rejecting the 2-series is the most common Mastercard validation bug.

Then change one digit of a generated number: the form should now reject it because the Luhn check fails (the validator shows why). Approvals, declines and 3-D Secure need your gateway's sandbox cards, listed above.

Generated Mastercard numbers are for testing only. They are not linked to any Mastercard account, hold no balance and will be declined by any live payment system.

Frequently asked questions

What numbers do Mastercard cards start with?

Mastercard numbers start with 51–55 or with 2221–2720. The second range was introduced in 2017, so make sure your validation accepts both.

What is a Mastercard test number for Stripe?

Stripe documents 5555 5555 5555 4444 and the 2-series 2223 0031 2200 3222. Use any future expiry date and any 3-digit CVC in test mode.

Is Maestro the same as Mastercard?

Maestro is a debit brand owned by Mastercard, but it uses different prefixes (such as 5018, 5020, 6304 and 6759) and lengths from 12 to 19 digits. Select Maestro in the generator to create those numbers.

Where do I find my own Mastercard number?

On the front (or back) of your physical card, and in your bank’s app under card details. Generated numbers are not anyone’s card — they only exist to test forms.

Can I buy something or start a free trial with a generated card?

No. A real payment needs an authorization from the issuing bank, and no bank has issued these numbers, so every charge is declined. Trying to pay with a number you do not own is fraud. Use them only in sandboxes, forms and test data.

Related tools

Advertisement