Skip to content
Card BIN Checker
PANBINLuhncard networksISO/IEC 7812

Anatomy of a Card Number: BIN, Account Number & Check Digit

Every digit on a card has a job. Here's how the MII, BIN, account number, and Luhn check digit fit together — and why lengths and grouping differ per network.

7 min read

A payment card number looks like a random string of digits, but it isn't. It's a structured identifier defined by ISO/IEC 7812, and every digit has a job. Read left to right, the number tells you which industry issued it, which network and bank it belongs to, which specific account it maps to, and finally whether the whole thing was even typed correctly.

This full string is called the PAN — the Primary Account Number. In this article we'll take a 16-digit Visa-style PAN apart field by field, then show how lengths and grouping shift across networks. Every fact here matches the detection and formatting logic that powers our own tools.

The four parts of a PAN

A PAN is not one number — it's four regions concatenated together. From left to right:

  • MII — the Major Industry Identifier. The single first digit, which broadly signals the issuing industry (banking/financial, travel, etc.).
  • BIN / IIN — the Bank Identification Number (also called Issuer Identification Number). The leading digits that identify the network and issuing institution. The MII is technically the first digit of the BIN.
  • Individual Account Number — the middle digits the issuer assigns to a specific account.
  • Check digit — the final digit, computed with the Luhn (mod 10) algorithm so a single mistyped digit is caught instantly.
4  5 3 9   1 4 8 8   0 3 4 3   6 4 6  7
│  └──── BIN / IIN ────┘  └─ account ─┘  └─ check digit
│
└─ MII (first digit, part of the BIN)

[ 4539 14 ] ....................... 8803 4364 6  7
  first 6 = classic BIN            account no.   Luhn
(networks now also use 8-digit BINs)

BIN or IIN?

BIN and IIN refer to the same leading digits — IIN is the ISO term, BIN is the older industry name that stuck. Historically the BIN was the first 6 digits; the card networks have since moved to 8-digit BINs to expand capacity. Either way, it's a prefix, not the whole account.

The MII: what the first digit means

The Major Industry Identifier is the first digit of the PAN and hints at the issuing sector. For payment cards it's usually a financial-industry digit, and in practice it's the coarsest signal a network detector uses before looking at more digits. A few examples that show up in real card numbers:

  • 3 — travel and entertainment: American Express (34, 37), Diners Club, and JCB all live here.
  • 4 — banking and finance: every Visa card starts with 4.
  • 5 — banking and finance: classic Mastercard (51–55), plus part of the Maestro range (50, 56–59).
  • 6 — merchandising/banking: Discover (6011, 65, …) and UnionPay (62).

The MII alone is never enough to identify a network — plenty of networks share a leading digit. That's why detection reads the whole prefix, not just the first character.

The BIN: how a prefix picks the network

The BIN is where the real identification happens. Networks don't own a single tidy prefix — they own sets of ranges, and those ranges vary in length. Here's exactly what our engine matches against:

  • Visa — starts with 4.
  • Mastercard51–55 and the newer 2221–2720 range.
  • American Express34 and 37.
  • Discover6011, 65, 644–649, and a 622126–622925 carve-out.
  • JCB3528–3589.
  • Diners Club300–305, 36, 38, 39.
  • UnionPay — starts with 62.
  • RuPay60, 65, 81, 82, 508, 353, 356 (note it shares 65 with Discover).

Because ranges differ in width, matching has to be careful. A number starting 65 is consistent with both Discover and RuPay; a number starting 622126 is a longer, more specific Discover match. The rule is simple: the unique most-specific (longest) full prefix match wins. If two networks match at the same length, or only a partial match exists, the result is ambiguous rather than guessed. You can watch this resolution happen live in the Card Network Lookup tool as you type.

The BIN carries metadata, not your identity

A BIN tells a merchant the network, the issuing bank, the card's country, and often the product type (debit vs. credit, consumer vs. commercial). It does not reveal your name, balance, or the individual account digits. That's why BIN lookups are safe to do on just the first 6–8 digits — see the glossary for more terms.

The account number and the check digit

Everything between the BIN and the final digit is the individual account number — the block the issuer uses to point at one specific account. Its length is whatever's left after you subtract the BIN and the one-digit checksum from the total PAN length. On a 16-digit Visa with an 8-digit BIN, that leaves 7 account digits and 1 check digit.

That last digit is the Luhn check digit, and it's not part of the account — it's math about the rest of the number. The algorithm is a mod-10 checksum: walking from the rightmost digit leftward, you double every second digit; if a doubled value exceeds 9 you subtract 9; then you sum everything. A valid number's total is divisible by 10.

PAN: 4 5 3 9 1 4 8 8 0 3 4 3 6 4 6 7

Start from the right. Double every 2nd digit (positions 2,4,6… from the right):

  digit:  4  5  3  9  1  4  8  8  0  3  4  3  6  4  6  7
  double? ✓  .  ✓  .  ✓  .  ✓  .  ✓  .  ✓  .  ✓  .  ✓  .
  →       8  5  6  9  2  4 16→7 8  0  3  8  3 12→3 4 12→3 7

  sum = 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80
  80 mod 10 = 0  →  passes ✓

To compute the check digit for a payload (the PAN minus its last digit), you run the same weighting and take (10 − (sum mod 10)) mod 10. That single digit is why a fat-fingered card number gets rejected before it ever leaves the checkout form. Try it yourself in the Luhn Checker with the full step-by-step breakdown, or use the Card Validator to combine the Luhn test with network and length rules.

Luhn is a typo catch, not a real-card check

Passing Luhn only means the digits are self-consistent. It says nothing about whether the card exists, is active, or has funds. A randomly generated number can pass Luhn and still be completely fake — which is exactly how safe test card numbers are built.

Lengths and grouping differ per network

The 16-digit, 4-4-4-4 layout most people picture is a Visa/Mastercard convention, not a universal rule. Total PAN length and the way digits are grouped for display are both network-specific:

  • Visa13, 16, or 19 digits. Grouped 4-4-4-4 at 16; 4-4-5 at 13; 4-4-4-4-3 at 19.
  • Mastercard16 digits, grouped 4-4-4-4.
  • American Express15 digits, grouped 4-6-5 (and a 4-digit CID instead of a 3-digit CVC).
  • Discover16 or 19 digits, 4-4-4-4 / 4-4-4-4-3.
  • Diners Club14, 16, or 19 digits; the 14-digit form groups 4-6-4.
  • JCB16 to 19 digits.
  • UnionPay16 to 19 digits.
  • Maestro — highly variable: 12 to 19 digits.

Grouping is purely cosmetic — the spaces exist so humans can read and verify long numbers, and they're stripped before any validation. But it has to match the network, or the number looks wrong to a trained eye. American Express in particular breaks the 4-4-4-4 habit with its distinctive 4-6-5 blocks. Our Credit Card Formatter applies the correct grouping as you type, falling back to plain groups of four when the network is unknown or the number runs longer than the template.

Visa  (16):  4539 1488 0343 6467      → 4-4-4-4
Amex  (15):  3782 822463 10005        → 4-6-5
Diners(14):  3056 930902 5904         → 4-6-4
Visa  (19):  4539 1488 0343 6467 123  → 4-4-4-4-3

How the parts work together

Reading a PAN is a funnel. The MII narrows the field to an industry; the BIN pins down the exact network and issuer using the most-specific matching prefix; the individual account number identifies one account within that issuer; and the Luhn check digit guarantees the whole string is internally consistent. Each field constrains the next, which is why a checkout form can flag a bad number, name the right network, and pick the correct grouping — all before a single request hits a bank.

It's also why none of this requires storing or transmitting card data. Prefix ranges, length tables, and the Luhn algorithm are public, deterministic rules — everything can run right in your browser. That's the whole design of this site: the digits never leave your device. Browse the glossary for definitions of BIN, PAN, MII, and CVC, and try the tools below on any number you like.

See network-correct grouping applied to any card number as you type — entirely in your browser.

Open the Credit Card Formatter