Advertisement

BIN & issuers

6-digit vs 8-digit BINs: the ISO/IEC 7812 change explained

For decades, the first six digits of a card number identified its issuer. The 2017 revision of ISO/IEC 7812-1 extended that prefix to eight digits, and Visa and Mastercard started issuing eight-digit BINs in 2022. Card numbers did not get longer, but every system that stores, masks, routes or analyzes BINs is affected.

By the Fakecreditcard teamPublished 7 min read

Advertisement

Key takeaways

  • ISO/IEC 7812-1:2017 defined an eight-digit issuer identification number (IIN/BIN); the card number itself still has at most 19 digits.
  • Visa and Mastercard set April 2022 as the date acquirers and processors had to support eight-digit BINs. Existing six-digit BINs remain valid, so both lengths coexist.
  • PCI SSC FAQ 1091 lets you retain at most the first 8 and any other 4 digits of a 16-digit PAN when truncating; 15-digit American Express PANs stay at first 6, last 4.
  • Update BIN tables to longest-prefix matching, widen BIN columns, and review masking, routing and analytics that assume six digits.
On this page
  1. What changed in ISO/IEC 7812
  2. The network timeline
  3. What PCI DSS allows you to keep
  4. Where six-digit assumptions hide in your code
  5. Extracting the BIN safely in code
  6. A migration checklist
  7. Testing with eight-digit BINs
  8. Frequently asked questions

If your code contains pan[:6], a CHAR(6) column called bin, or a masking function that prints 411111******1111, this change concerns you. Eight-digit BINs have been in circulation since 2022, they coexist with six-digit BINs, and the safe way to handle them is to stop assuming any fixed length.

What changed in ISO/IEC 7812

ISO/IEC 7812-1 is the international standard that defines how card numbers are built: an issuer identification number (IIN, commonly called the BIN), an individual account identifier, and a Luhn check digit. Its earlier editions used a six-digit IIN. The 2017 revision defined an eight-digit IIN and set out a path for converting the six-digit ranges.

The reason was capacity. Six digits give one million possible prefixes, and a large share of them begin with the few major industry identifiers used for bank cards. With new issuers, fintech programs, virtual cards and product-specific ranges, the supply of six-digit BINs was running short. Adding two digits multiplies the space by one hundred.

The total length of the card number did not change:

6-digit IIN8-digit IIN
Issuer prefix6 digits8 digits
Account identifier (max)12 digits10 digits
Check digit11
Maximum PAN length1919
Typical PAN length1616

Nothing about the number tells you which kind of BIN it has. 4111 1111 1111 1111 looks the same whether its issuer owns the six-digit range 411111 or the eight-digit range 41111111. Only BIN data can say how long the prefix is.

The network timeline

The standard allows eight digits; the card networks decided when to use them. Visa and Mastercard set April 2022 as the date by which acquirers and processors had to be able to handle eight-digit BINs. As Deloitte summarized the plans at the time:

  • Visa said it would only issue eight-digit BINs after April 2022.
  • Mastercard began issuing eight-digit BINs after April 2022 but did not set a date to stop issuing six-digit BINs, and asked acquirers to be ready for eight-digit BINs and 11-digit account ranges.
  • Other networks — American Express, Discover/Diners Club and UnionPay — had not announced timelines then.

Two consequences matter for developers. First, existing six-digit BINs were not forced to convert, so the payments industry runs on both lengths and will for years. Second, an issuer that converts can split one six-digit range into as many as one hundred eight-digit ranges and assign them to different products, countries or program managers. A six-digit lookup then returns a less precise — or simply wrong — answer.

Advertisement

What PCI DSS allows you to keep

Longer BINs raised an obvious question: if the BIN is eight digits, may you keep eight digits? The PCI Security Standards Council answers this in its FAQs, which distinguish between masking (hiding digits when displaying a PAN) and truncation (permanently removing digits from a stored PAN).

Masking: what may be displayed

PCI DSS Requirement 3.4.1 says no more than the BIN and the last four digits of the PAN may be displayed on screens, reports and similar outputs, unless a documented business need justifies more. PCI SSC FAQ 1492 confirms this applies to eight-digit BINs. In practice, most interfaces should show far less: a support agent rarely needs more than the last four digits.

Truncation: what may be stored

FAQ 1091 lists the maximum digits that may be retained when truncation is the method used to make stored PAN unreadable:

PANBrandsRemove at leastRetain at most
16 digits (6- or 8-digit BIN)Discover, JCB, Mastercard, UnionPay, Visa4 digitsFirst 8, any other 4
15 digitsAmerican Express5 digitsFirst 6, last 4

These are maximums, not targets. The PCI SSC blog on eight-digit BINs notes that first six, last four remains the format accepted by all payment brands, and that for PAN lengths not covered in the FAQ you should confirm your format with each brand. Truncation is also only one of the acceptable methods: FAQ 1492 lists encryption of the whole PAN, index tokens and one-way hashes too, and requires hashes generated after March 31, 2025 to be keyed cryptographic hashes (Requirement 3.5.1.1).

Truncated and hashed versions of the same PAN

PCI DSS requires extra controls wherever hashed and truncated versions of the same PAN exist, so the two can’t be correlated to rebuild the number. The risk is concrete: with the first eight and last four digits of a 16-digit PAN known, only four digits are missing, and the Luhn checksum cuts those 10,000 candidates to about 1,000. An unkeyed hash falls in milliseconds. Keyed hashes (HMAC) or tokens avoid the problem.

Where six-digit assumptions hide in your code

Most systems built before 2022 encoded the six-digit BIN somewhere. The usual places:

AreaTypical assumptionWhat to change
Database schemabin CHAR(6)Widen to 8 and store the prefix length, or store the matched range ID
BIN lookupExact match on the first 6 digitsLongest-prefix match: try 8 digits, then 6
MaskingAlways first6 + **** + last4Mask by policy; show the last 4 by default
Truncated storageFirst 6 + last 4Keep it unless you need 8; first 8 only for 16-digit PANs
Routing rulesTables keyed by 6-digit BINRe-key by range; re-test least-cost and domestic routing
Fraud rulesVelocity per 6-digit BINCount per issuer range, not per fixed length
AnalyticsApproval rates grouped by bin6Group by issuer and product from the BIN record
LogsRegexes that redact all but 6 + 4Redact all but the last 4; never log full PANs

Extracting the BIN safely in code

Don’t slice a fixed number of digits and call it “the BIN”. Keep a bin6 and a bin8 candidate, let the lookup decide which one matches, and enforce the PCI limits in one place. This helper returns only what you are allowed to keep for the PAN length:

Python
def card_prefixes(pan: str) -> dict:
    """Prefix candidates and last 4 for lookups and storage. Never returns the full PAN."""
    digits = ''.join(c for c in pan if c.isdigit())
    if not 12 <= len(digits) <= 19:
        raise ValueError('not a card number length')
    out = {'bin6': digits[:6], 'last4': digits[-4:], 'length': len(digits)}
    # PCI SSC FAQ 1091: "first 8, any other 4" applies to 16-digit PANs only.
    if len(digits) == 16:
        out['bin8'] = digits[:8]
    return out

def lookup(prefixes: dict, bin_table: dict):
    """Longest-prefix match: an 8-digit range wins over the 6-digit range it came from."""
    for key in ('bin8', 'bin6'):
        if key in prefixes and prefixes[key] in bin_table:
            return bin_table[prefixes[key]]
    return None

print(card_prefixes('4111 1111 1111 1111'))
# {'bin6': '411111', 'last4': '1111', 'length': 16, 'bin8': '41111111'}

On the database side, store ranges rather than single prefixes, so a six-digit row and the eight-digit rows carved out of it can live side by side:

SQL
CREATE TABLE bin_range (
  id          INTEGER PRIMARY KEY,
  prefix      VARCHAR(8) NOT NULL,     -- 6 or 8 digits
  prefix_len  SMALLINT   NOT NULL,     -- 6 or 8
  network     VARCHAR(20),
  issuer      VARCHAR(120),
  country     CHAR(2),
  funding     VARCHAR(10)              -- credit / debit / prepaid
);
CREATE UNIQUE INDEX bin_range_prefix ON bin_range (prefix);

-- Longest-prefix lookup for one card (pass bin8 and bin6 from application code)
SELECT * FROM bin_range
WHERE prefix IN (:bin8, :bin6)
ORDER BY prefix_len DESC
LIMIT 1;

A migration checklist

  1. Inventory. Search code, SQL, ETL jobs, dashboards and log processors for six-digit assumptions: [:6], substr(pan, 1, 6), CHAR(6), \d{6}.
  2. Get eight-digit BIN data. Ask your processor or BIN data provider for a table with both lengths and a defined update schedule.
  3. Switch to longest-prefix matching and keep a fallback for “unknown”.
  4. Review storage. Decide per use case whether you need six or eight digits. Document the business reason if you keep eight, and confirm the PAN length rules.
  5. Review masking. Make the last four digits the default on every screen and export.
  6. Re-test routing and fraud rules with cards from both kinds of ranges, including 15-digit American Express and 19-digit cards.
  7. Re-baseline analytics. Metrics grouped by six-digit BIN will shift when issuers split ranges; group by issuer and product instead.
  8. Update test fixtures. Add test numbers from eight-digit ranges so that regressions show up in CI.

Testing with eight-digit BINs

You don’t need real cards to test any of this. Generate format-valid numbers from a specific eight-digit prefix with our card generator (enter the prefix in the BIN field), run them through your lookup and masking code, and confirm that the eight-digit row wins over its six-digit parent. For end-to-end tests that reach a payment gateway, use the gateway’s documented test card numbers, because sandboxes only recognize those. Keep real card numbers out of these environments entirely; our guide to test data and PCI DSS explains why.

To see what a BIN record looks like, try any prefix in the BIN checker, and read what a BIN lookup tells you for the limits of that data.

Frequently asked questions

Did card numbers get longer with 8-digit BINs?

No. A typical card number is still 16 digits, and the maximum stays at 19. The issuer prefix takes two more digits, so the individual account identifier gets two fewer.

Do 6-digit BINs still exist?

Yes. Networks did not require issuers to convert existing six-digit BINs, so systems must handle both. A six-digit range can be split into up to one hundred eight-digit ranges.

Can I store the first 8 digits and the last 4?

For 16-digit PANs from Discover, JCB, Mastercard, UnionPay and Visa, PCI SSC FAQ 1091 lists “first 8, any other 4” as the maximum you may retain when truncating. Store only what you need, and remember truncation is one of several ways to render stored PAN unreadable.

How many digits can I display on screens and receipts?

PCI DSS Requirement 3.4.1 allows at most the BIN and the last four digits to be displayed, unless there is a documented business need to see more. Many merchants show only the last four.

Do American Express, Discover and UnionPay use 8-digit BINs too?

The April 2022 timeline came from Visa and Mastercard. Other networks announced their own plans separately, so check each network’s documentation or ask your processor before assuming a length.

Sources

  1. PCI SSC blog — 8-digit BINs and PCI DSS: what you need to know (2021)
  2. PCI SSC FAQ 1091 — Acceptable formats for truncation of PAN
  3. PCI SSC FAQ 1492 — PAN masking and truncation after migrating to 8-digit BINs
  4. Deloitte — 8-digit BIN expansion
  5. ISO/IEC 7812 — overview of the numbering system (Wikipedia)

Tools used in this guide

Related guides

Written for developers, QA teams and merchants. Generated card numbers are test data: they are not real cards and cannot pay for anything.

Advertisement