---
id: "bankcard_mastercard"
kind: "pattern"
status: "draft"
is_pii: true
categories: ["pii", "finances"]
langs: ["common"]
quality: 85
url: "https://registry.apicrafter.io/datatype/bankcard_mastercard"
---

# Mastercard card number (`bankcard_mastercard`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Primary account number of a Mastercard card: 16 digits that start with 51 to 55 or, since 2017, with 2221 to 2720. The last digit is a Luhn check digit. The pattern accepts the number without spaces or hyphens.

- Pattern of: `bankcard`
- Personal data (PII): yes
- Categories: Personally identifiable information (pii), Finances and banking (finances)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$
```

Check digit algorithm: `luhn`

## Examples

- `5555555555554444` — Stripe test card number
- `2223003122003222` — Stripe test card number from the 2-series range
- `4242424242424242` (invalid example) — Visa test number

## Supported by tools

- `cloudflaredlp`
- `datadogsds`
- `pywhat`
- `validatorjs`

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/Payment_card_number>
- doc: <https://docs.stripe.com/testing>

## Quality

Score 85/100. Missing: mapping (Wikidata, Schema.org, ...), translation.

JSON: <https://registry.apicrafter.io/api/v1/datatypes/bankcard_mastercard.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/finances/bankcard_mastercard.yaml>
