Luhn checksum, brand from the BIN, length and CVV checks — all in your browser
| Network | Leading Digits (BIN) | Number Length | Code Name & Length |
|---|---|---|---|
| Visa | 4 | 16, 18, 19 | CVV — 3 |
| Mastercard | 51–55, 2221–2720 | 16 | CVC — 3 |
| American Express | 34, 37 | 15 | CID — 4 |
| Diners Club | 300–305, 36, 38–39 | 14, 16, 19 | CVV — 3 |
| Discover | 6011, 644–649, 65 | 16, 19 | CID — 3 |
| JCB | 3528–3589 (also 2131, 1800) | 16–19 | CVV — 3 |
| UnionPay | 62 (620–629 ranges) | 14–19 | CVN — 3 |
| Maestro | 50, 56–59, 63, 67 | 12–19 | CVC — 3 |
| Mir | 2200–2204 | 16–19 | CVP2 — 3 |
| Troy | 9792, 65 (subset) | 16 | CVV — 3 |
Grouping quirks worth knowing: American Express numbers format as 4-6-5 (gaps after positions 4 and 10) instead of the usual 4-4-4-4, and carry a 4-digit code on the front. Maestro's 12–19 length range is the widest of any network. Local networks (Elo, Hipercard in Brazil; Troy in Türkiye; Mir in Russia) mostly coexist with the global six.
| Number | Brand | Luhn Weighted Sum | Use |
|---|---|---|---|
4242 4242 4242 4242 | Visa | 80 | Stripe's canonical test card |
5555 5555 5555 4444 | Mastercard | 60 | Standard MC test number |
3782 822463 10005 | American Express | 60 | 15-digit format + 4-digit CID |
6011 1111 1111 1117 | Discover | 30 | Discover test number |
3566 0020 2036 0505 | JCB | 50 | 16-digit JCB test |
6200 0000 0000 0005 | UnionPay | 10 | UnionPay start-62 test |
5019 7170 1010 3742 | Maestro | 50 | Debit-format test |
These are published by payment processors for testing checkout flows; they always decline in live processing. Sums were computed with this page's engine (every second digit from the right doubled, two-digit results reduced by 9).
A payment form can reject a card number as malformed without contacting anyone — that's what the Luhn checksum, BIN prefix rules, and per-network length rules accomplish together. This tool runs the same validation library (braintree's card-validator, MIT-licensed, the engine behind major checkout SDKs) locally in your browser.
Take the number and, starting from the rightmost digit, double every second digit. If a doubling gives a two-digit result, subtract 9 (which equals adding those two digits). Sum all the values; the number passes when the total is divisible by 10.
4242 4242 4242 4242: from the right, positions 2, 4, 6… hold the 4s, and each doubles 4 → 8 (no reduction needed since 8 is single-digit). The odd positions hold the 2s and stay 2. There are eight 4s and eight 2s, so the weighted sum is (8 × 8) + (8 × 2) = 64 + 16 = 80. Since 80 mod 10 = 0, the number is Luhn-valid — which is exactly why Stripe picked it as a test card. Flip the last digit to 1 and the sum becomes 79: not divisible by 10, invalid. A transposition of two adjacent different digits shifts the sum off a multiple of 10 in almost every case too, which is why the checksum survives as the front line of every card form.
The first 6–8 digits identify the network and (to issuers with BIN-table access) the issuing bank, country, and product tier. For validation purposes the network ranges give you three things for free: the expected number length (Amex 15, Mastercard exactly 16…), the security-code length (3 digits, except Amex's 4-digit CID), and the display grouping (4-6-5 for Amex versus 4-4-4-4 elsewhere). This tool reads the prefix, names the brand, and enforces all three as you type.
The engine is vendored on this page (open source, MIT) and runs entirely locally — open the network tab and type: no request fires. Nothing you enter is stored, logged, or transmitted, and the page works offline after loading.
Starting from the rightmost digit, double every second digit; if a doubling produces a two-digit number, subtract 9 (equivalently, add its digits). Sum everything. The number is valid when the total is a multiple of 10. For 4242 4242 4242 4242, the doubled digits (4→8) and plain digits (2) total 80, and 80 mod 10 = 0 — valid. The checksum catches any single mistyped digit and most adjacent transpositions, which is why every card network uses it.
The Bank Identification Number — also called the Issuer Identification Number — is the first 6 to 8 digits of a card number. The leading digits map to the network: 4 is Visa, 51–55 and 2221–2720 are Mastercard, 34 and 37 are Amex, 6011/65/644–649 are Discover. The same prefix ranges tell a payment form how to format the number and how long the security code should be, before any network call happens.
No — it means the number is well-formed. Luhn is a checksum for catching typos, not a proof of existence, and it says nothing about whether the account is open, funded, or not stolen. Only an authorized transaction (or a $0 auth) against the payment network can confirm a card is live. Validators like this one exist so forms reject garbage before that expensive step.
The check runs entirely in your browser with the open-source braintree/card-validator engine loaded from this site — no network request carries what you type, and you can verify that in the network tab. Still, the smarter habit is to use public test numbers (4242 4242 4242 4242 and friends) unless you're checking your own card. Never paste real card numbers into sites you don't trust.
It's Stripe's canonical public test card — a Visa number chosen to pass Luhn, published by payment processors for developers to test checkout flows without real money. Others in the set include 5555 5555 5555 4444 (Mastercard, Luhn sum 60), 3782 822463 10005 (Amex, sum 60), and 6011 1111 1111 1117 (Discover). They're well-formed by design; they will always decline in live processing.
16 digits is the norm, not the rule. Visa uses 16, 18, or 19; Mastercard exactly 16; Amex 15; Diners Club 14, 16, or 19; Discover 16 or 19; JCB and UnionPay anywhere from 16 to 19 (UnionPay down to 14). The validator knows each network's allowed lengths and flags a length mismatch even when Luhn passes.