Mastercard Number Checker
Check whether a number is a structurally valid Mastercard: the 51-55 or 2-series prefix, the 16-digit length and the Luhn check digit. Everything runs in your browser.
Mastercard card number format at a glance
| Starts with (IIN) | 51 to 55; 2221 to 2720 |
|---|---|
| Length | 16 digits |
| Security code | CVC2, 3 digits, back of the card, next to the signature strip |
| Luhn check digit | Yes. The last digit is a Luhn (mod 10) check digit. |
| Issued in | Worldwide. Mastercard credit, debit and prepaid cards are issued by banks and fintechs in almost every country. |
| Network operator | Mastercard Inc. |
Mastercard IIN (BIN) ranges
| Prefix | Notes |
|---|---|
| 51 to 55 | The original Mastercard range |
| 2221 to 2720 | 2-series range, issued since 2017 |
What the first digits mean
A first digit of 5 sits in the ISO/IEC 7812 banking and financial category; 2 was opened up when Mastercard added the 2221-2720 range because the 51-55 range was filling up. The first 6 or 8 digits form the BIN, which identifies the issuing bank and product. The last digit is the Luhn check digit.
A prefix tells you the network, not the bank. To see the issuing bank, country and card type behind a Mastercard BIN, use the BIN lookup tool or browse the full Mastercard BIN list.
Worked Luhn example with a Mastercard test number
This uses a public test number from the Stripe testing docs. It passes every format check but is not a real account, so it cannot be charged.
Number: 5555 5555 5555 4444 (16 digits)
- Start from the rightmost digit (the check digit) and move left.
- Double every second digit, starting with the one just left of the check digit.
- If doubling gives a number above 9, subtract 9 (same as adding its two digits).
- Add every value together. The number is valid if the total ends in 0.
| Digit | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 4 | 4 | 4 | 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Double? | x2=10 | - | x2=10 | - | x2=10 | - | x2=10 | - | x2=10 | - | x2=10 | - | x2=8 | - | x2=8 | - |
| Value | 1 | 5 | 1 | 5 | 1 | 5 | 1 | 5 | 1 | 5 | 1 | 5 | 8 | 4 | 8 | 4 |
Total: 60. 60 mod 10 = 0, so the number passes the Luhn check.
Working backwards: without the check digit, the other digits add up to 56. The check digit is whatever brings that total to the next multiple of 10: (10 - 6) mod 10 = 4, which matches the last digit.
Why a valid Mastercard card number still declines
Passing the Luhn and length checks only proves the number is well formed. Whether the payment goes through is decided by the issuer, and these are the common reasons a Mastercard card is still declined:
Outdated validation rejects 2-series cards
Checkout forms and fraud rules written before 2017 often only accept numbers starting 51-55, so valid 2221-2720 cards fail before they reach the issuer.
Insufficient funds
The number is fine, but the account cannot cover the amount right now. This is a soft decline: retrying after payday or once the balance recovers often succeeds.
Merchant Advice Codes say stop
Mastercard declines can carry a Merchant Advice Code. Some (such as 03 and 21) mean do not retry or cancel the recurring payment; others (such as 01) mean new account information is available.
Expired or replaced card
Luhn and length checks never look at the expiry date. A card reissued after loss, fraud or expiry keeps failing until the customer updates it or a card updater service supplies the new details.
Issuer fraud rules
Unusual amounts, a new merchant, or a country mismatch between the card and the customer can trigger a "do not honor" or suspected fraud decline even on a perfectly valid number.
Look up the exact response code in the Mastercard decline codes to see whether it is a soft decline worth retrying or a hard decline that needs the customer.
Mastercard card number FAQ
How many digits is a Mastercard card number?
A Mastercard card number is 16 digits. The last digit is a check digit calculated with the Luhn algorithm.
What does a Mastercard card number start with?
Mastercard card numbers start with 51 to 55, or 2221 to 2720. Numbers starting 2200 to 2204 are Mir cards, not Mastercard, even though they look similar.
What is the CVC2 on a Mastercard card?
The CVC2 (Card Validation Code 2) is the 3-digit security code on the back of the card, next to the signature strip. It is not part of the card number, so a number validator cannot check it.
Do Mastercard card numbers use the Luhn algorithm?
Yes. The last digit is a Luhn (mod 10) check digit.
Why would a valid Mastercard card number still be declined?
A valid number only proves the format is right. Outdated validation rejects 2-series cards, Insufficient funds, Merchant Advice Codes say stop are common reasons a Mastercard payment still fails.