DE 2 carries the PAN and is a variable-length field, n ..19 β a 2-digit length prefix (LLVAR) followed by up to 19 digits. (If the dot notation is new to you, see how to read field format notation.) On the wire, using a synthetic test number β the length prefix is shown separated for clarity:
16 4000001234567899
| Bytes | Meaning |
|---|---|
16 | LLVAR length prefix β 16 digits of PAN follow |
40000012 | The IIN / BIN β up to the first 8 digits identify the issuer |
3456789 | Individual account number, assigned by the issuer |
9 | Luhn check digit |
Terminology first, because the two names cause real confusion in spec reviews: ISO/IEC 7812 calls this prefix the IIN (Issuer Identification Number). BIN (Bank Identification Number) is the older industry name for the same digits. Scheme manuals, processor docs and BIN files use them interchangeably; when a document mixes both, it is not describing two different things.
The very first digit of the IIN is the MII (Major Industry Identifier), which tells you what kind of institution issued the card:
| MII digit | Industry |
|---|---|
1, 2 | Airlines |
3 | Travel and entertainment (Amex, JCB, Diners live here) |
4, 5 | Banking and financial (Visa, Mastercard) |
6 | Merchandising and banking/financial (UnionPay lives here) |
7 | Petroleum |
8 | Healthcare and telecommunications |
9 | Assigned by national standards bodies |
In the field reference, DE 2 is one line: n ..19, primary account number. Everything this article discusses happens inside the first 8 of those digits.
ISO/IEC 7812 originally defined the IIN as 6 digits. The 2017 revision expanded it to 8 digits because the 6-digit space was running out, and the card networks required issuers, acquirers and processors to handle 8-digit IINs from April 2022. Both lengths are in circulation today.
What does not change: the PAN itself. It is still 13β19 digits, DE 2 is still n ..19, and the bytes on the wire are byte-for-byte identical. A parser that reads DE 2 by its LLVAR prefix needs no change at all. What moves is a boundary that exists only in your business logic: which of those digits belong to the issuer identifier.
What has to change is everything that treats the prefix as a key:
substring(0, 6). Ranges are now published at mixed lengths, so store them at 8 digits (or as explicit ranges) and match longest prefix first.The classic failure mode is code that still slices 6 digits. Under a single 6-digit prefix there can now be different issuers and different card products. Two synthetic examples: 40000012β¦ and 40000013β¦ share the 6-digit prefix 400000 but may belong to entirely different institutions. Nothing throws β the message parses, a route is found, a fee program is applied β but the transaction lands in the wrong bucket: wrong issuer attribution, wrong interchange qualification, wrong product flags, wrong risk profile. It is a silent-wrong-answer bug, which is why it survives testing.
Finding one usually means looking at real DE 2 values from production, because test ranges almost never put two issuers under the same six digits. Those messages parse in your browser here and go nowhere β though if live PANs are not allowed near a website at all, the offline edition does the same job with no network involved.
4 is Visa; 51β55 and 2221β2720 are Mastercard; 34/37 American Express; 62 UnionPay; 35 JCB; 36/38 Diners Club. These map a PAN to a scheme, not to an issuer β issuer-level attribution needs the licensed BIN file.= separator) and DE 45 (Track 1). A mismatch means either a badly built message or β more often in practice β a parser that lost its field boundaries somewhere upstream.Because DE 2 is usually the first variable-length field in the message, a length mistake here corrupts everything after it. Patterns to recognize:
16 followed by 15 digits and an = usually means track data leaked into the PAN slot, or the message was assembled with the wrong length.The fastest way to confirm any of these is to look at a message where DE 2 is known-good. This synthetic authorization (same one used in the annotated message examples) carries 16 + 4000001234567899 in DE 2 and the matching PAN in DE 35:
0100723C448028C08000164000001234567899000000000000005000081009302100012309302108102812541190200334000001234567899=2812101123450000622209000123TERM0001TESTMERCH000001840
Open this message in the parser β