To check whether a card number is well-formed: type it below. The validator runs the Luhn checksum (doubling every second digit from the right and requiring a multiple of 10 — 4242 4242 4242 4242 scores exactly 80, so it passes), identifies the brand from the BIN (4 = Visa, 51–55/2221–2720 = Mastercard, 34/37 = Amex), and checks the length and security-code format that brand requires. A pass means the number is structurally valid, not that the account exists — only the payment network can confirm that. Everything computes locally; what you type is never transmitted.

Check a Card Number

Type a number to see the Luhn, brand, length, and code checks.
Brand (from BIN)
BIN / IIN (first 6–8)
Digits entered / allowed
Security code name & size
Luhn checksum
Formatted number
This tool checks number structure only — it can't and doesn't query any bank or network. For testing payment forms, use the public test numbers above; they always decline in live processing. Never share real card details with sites you don't trust.
Advertisement

Card Brands: BIN Ranges, Lengths, and Security Codes

NetworkLeading Digits (BIN)Number LengthCode Name & Length
Visa416, 18, 19CVV — 3
Mastercard51–55, 2221–272016CVC — 3
American Express34, 3715CID — 4
Diners Club300–305, 36, 38–3914, 16, 19CVV — 3
Discover6011, 644–649, 6516, 19CID — 3
JCB3528–3589 (also 2131, 1800)16–19CVV — 3
UnionPay62 (620–629 ranges)14–19CVN — 3
Maestro50, 56–59, 63, 6712–19CVC — 3
Mir2200–220416–19CVP2 — 3
Troy9792, 65 (subset)16CVV — 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.

Public Test Numbers (All Pass Luhn)

NumberBrandLuhn Weighted SumUse
4242 4242 4242 4242Visa80Stripe's canonical test card
5555 5555 5555 4444Mastercard60Standard MC test number
3782 822463 10005American Express6015-digit format + 4-digit CID
6011 1111 1111 1117Discover30Discover test number
3566 0020 2036 0505JCB5016-digit JCB test
6200 0000 0000 0005UnionPay10UnionPay start-62 test
5019 7170 1010 3742Maestro50Debit-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).

How Card Number Validation Works

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.

The Luhn algorithm, step by step

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.

A worked example

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.

What the BIN tells you

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.

What validation cannot tell you

Privacy, concretely

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.

Frequently Asked Questions

How does the Luhn checksum work?

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.

What is a BIN or IIN?

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.

Does a passing Luhn check mean the card works?

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.

Is it safe to type a card number here?

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.

Why does 4242 4242 4242 4242 come up everywhere?

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.

How long is a credit card number supposed to be?

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.

Advertisement