Complete list of PIN-blocks

The most common PIN-block formats are based on ISO 9564, but many more are in implemented worldwide. Another common problem is that same PIN-block calculation methods are being called with their aliases, making sometimes difficult to get a right one. This article brings a list of PIN-blocks applied in payments, their calculation methods and examples and bit of related background.

Well worded Wikipedia’s definition of a PIN-block format: «The PIN is used to verify the identity of a customer (the user of a bank card) within an electronic funds transfer system, and (typically) to authorize the transfer of funds, so it is important to protect it against unauthorized disclosure or misuse. Modern banking systems require interoperability between different card issuers, acquiring banks and retailers - including transmission of PINs between those entities - so a common set of rules for handling and securing PINs is required, both to ensure technical compatibility and a mutually agreed level of security.»

Note that the same encoding & decoding functionality as covered in this article is also available through our freeware BP-Tools product.

PIN Block Format
AliasDescription
ISO-0Format 0, ANSI X9.8, VISA-1, and ECI-0ISO 9564-1 Format 0. An ISO-0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats and is similar to a VISA-4 PIN block format. The ISO-0 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right. The first nibble (which identifies the block format) has the value 0.
ISO-1Format 1 and ECI-4ISO 9564-1:2003 Format 1. The ISO-1 PIN block format is equivalent to an ECI-4 PIN block format and is recommended for usage where no PAN data is available. The ISO-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right. The first nibble (which identifies the block format) has the value 1.
ISO-2Format 2ISO 9564-3: 2003 Format 2. Format 2 is for local use with off-line systems only. The first nibble (which identifies the block format) has the value 2.
ISO-3Format 3ISO 9564-1: 2002 Format 3. Format 3 is the same as format 1, except that the “fill” digits are random values from 10 to 15(A-F), and the first nibble (which identifies the block format) has the value 3.
ISO-4Format 4ISO 9564-1: 2017 Format 4. Format 4 comes in with AES support. It uses similar logic as format 3, while it doubles PIN block length by padding expansion. The first nibble (which identifies the block format) has the value 4.
ANSI X9.8Same as ISO 9564 Format 0 (ISO-0)
OEM-1Diebold, Docutel, NCRThe OEM-1 PIN block format is equivalent to the PIN block formats that Diebold, Docutel, and NCR define. The OEM-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right. Identical to existing Docutel 5100 Format 8
ECI-1Eurocheque International format 1. Same as ISO 9564 Format 0 (ISO-0)
ECI-2Eurocheque International format 2. The ECI-2 PIN block format supports a 4-digit PIN. A PIN that is longer than 4 digits is truncated on the right.
ECI-3Eurocheque International format 3. The ECI-3 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.
ECI-4Eurocheque International format 4. Same as ISO 9564 Format 1 (ISO-1)
IBM 3621The 3621 PIN block format supports a PIN from 1 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.
IBM 3624PIN-TRAN 4The 3624 PIN block format is equivalent to the PIN-TRAN 4 format and supports a PIN from 1 to 16 digits in length. A PIN that is longer than 16 digits is truncated on the right.
IBM 4704-EPP (Encrypting PIN Pad)The 4704 encrypting PIN Pad PIN block format supports a PIN from 1 to 13 digits in length. A PIN that is longer than 13 digits is truncated on the right.
IBM 5906Same as IBM 3621.
VISA-1Same as ISO 9564 Format 0 (ISO-0)
VISA-2Docutel 2The VISA-2 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.
VISA-3The VISA-3 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.
VISA-4The VISA-4 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.
Docutel 2VISA-2Same as VISA-2. Contains 1-digit PIN length, 4 to 6-digit PIN and a user-defined padding string of 9 digits. If the PIN has 4 or 5 digits, it is initially padded to the right with 2 or 1 zero digits to total 6 digits.
AS2805 Format 1The AS2805 Format 1 PIN block is used in situations where the account number is not available. The PIN block is formed by concatenation of the PIN and other data. PIN block format supports a PIN from 4 to 12 digits in length.
AS2805 Format 8Format 46The zero length PIN block format is identical to format 01 with the some exceptions.
ISO-4Format 4ISO 9564-1: 2017 Format 4. Format 4 uses AES encryption. PIN Block is padded with fill digit ‘A’ and also with random random values from 0 to 15, and the first nibble (which identifies the block format) has the value 4.

Is any PIN-block or its alias missing? Please let us know.

ISO-0 (Format 0)

Is the first and most common PIN block encoding  format based on ISO 9564 – an international standard for personal identification number (PIN) management and security in retail banking.

Calculation steps:

1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value “F”

12345678910111213141516
0LPPPPP/FP/FP/FP/FP/FP/FP/FP/FP/FP/F

2. Prepare PAN – take 12 rightmost digits of the primary account number (excluding the check digit)

12345678910111213141516
0000PANPANPANPANPANPANPANPANPANPANPANPAN

3. XOR both values

12345678910111213141516
0LPPPPP/FP/FP/FP/FP/FP/FP/FP/FP/FP/F
XORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXOR
0000PANPANPANPANPANPANPANPANPANPANPANPAN

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         Format 0 (ISO-0)
—————————————-
Clear PIN block:0412AC89ABCDEF67

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      0412AC89ABCDEF67
PAN:            43219876543210987
PAD:            N/A
Format:         Format 0 (ISO-0)
—————————————-
Decoded PIN:    1234

ISO-1 (Format 1)

The ISO-1 PIN block format is equivalent to an ECI-4 PIN block format. The ISO-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.

Calculation steps:

Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value

12345678910111213141516
1LPPPPP/RP/RP/RP/RP/RP/RP/RP/RP/RP/R

Where:

> L – is the length of the PIN, which is a 4-bit value from X’4′ to X’C’.

> R – is a random digit, which is a value from X’0′ to X’F’. Typically, this should be used for predetermined transaction unique data such as a sequence number.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         Format 1 (ISO-1)
—————————————-
Clear PIN block:141234CE8C767872

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      141234CE8C767872
PAN:            N/A
PAD:            N/A
Format:         Format 1 (ISO-1)
—————————————-
Decoded PIN:    1234

ISO-2 (Format 2)

Format 2 is for local use with off-line systems only (e.g. smart cards).

Calculation steps:

Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value ‘F’

12345678910111213141516
2LPPPPP/FP/FP/FP/FP/FP/FP/FP/FP/FP/F

Where:

> L – is the length of the PIN, which is a 4-bit value from X’4′ to X’C’.

> F – is a padding character, which is a value of X’F’.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         Format 2 (ISO-2)
—————————————-
Clear PIN block:241234FFFFFFFFFF

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      241234FFFFFFFFFF
PAN:            N/A
PAD:            N/A
Format:         Format 2 (ISO-2)
—————————————-
Decoded PIN:    1234

ISO-3 (Format 3)

Format 3 is the same as format 0, except that the “fill” digits are random values from 10 to 15, and the first nibble (which identifies the block format) has the value 3.

Calculation steps:

1. Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value from X’0′ to X’F’

12345678910111213141516
3LPPPPP/RP/RP/RP/RP/RP/RP/RP/RP/RP/R

2. Prepare PAN – take 12 rightmost digits of the primary account number (excluding the check digit)

12345678910111213141516
0000PANPANPANPANPANPANPANPANPANPANPANPAN

3. XOR both values

12345678910111213141516
0LPPPPP/RP/RP/RP/RP/RP/RP/RP/RP/RP/R
XORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXOR
0000PANPANPANPANPANPANPANPANPANPANPANPAN

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         Format 3 (ISO-3)
—————————————-
Clear PIN block:3412ACC9B98CDF43

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      3412ACC9B98CDF43
PAN:            43219876543210987
PAD:            N/A
Format:         Format 3 (ISO-3)
—————————————-
Decoded PIN:    1234

ISO-4 (Format 4)

ISO 9564-1: 2017 Format 4. Format 4 uses AES-128 ECB encryption. PIN Block is padded with fill digit ‘A’ and also with random random values from 0 to 15, and the first nibble (which identifies the block format) has the value 4.

Calculation steps:

1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is fill digit ‘A’. R is random value from X’0′ to X’F’

1234567891011121314151617181920212223242526272829303132
4LPPPPP/FP/FP/FP/FP/FP/FP/FP/FFFRRRRRRRRRRRRRRRR

2. Prepare PAN – take the primary account number – M is PAN length indicating PAN length of 12 plus the value of the field ‘0’-‘7’ (ranging then from 12 to 19). If the PAN is less than 12 digits, the digits are right justified and padded to the left with zeros and M is set to ‘0’. A is PAN digit, 0 is PAD digit ‘0’

1234567891011121314151617181920212223242526272829303132
MAAAAAAAAAAAAA/0A/0A/0A/0A/0A/0A/0000000000000

3. PIN block is encrypted with AES key

4. The resulting Intermediate Block A is then XOR’ed with PAN Block

5. The resulting Intermediate Block B is enciphered with the AES key again so we get the Enciphered PIN Block

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            432198765432109870
PIN:            1234
PAD:            N/A
Format:         Format 4 (ISO-4)
—————————————-
Clear PIN block:441234AAAAAAAAAA911B9B36BC7CE94E
Clear PAN block:64321987654321098700000000000000

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      441234AAAAAAAAAA911B9B36BC7CE94E
PAN block:      64321987654321098700000000000000
PAD:            N/A
Format:         Format 4 (ISO-4)
—————————————-
Decoded PIN:    1234
Decoded PAN:    432198765432109870

ANSI X9.8

Same as ISO-0.

OEM-1 / Diebold / Docutel / NCR

The OEM-1 PIN block format is equivalent to the PIN block formats that Diebold, Docutel, and NCR define. The OEM-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – P is PIN digit, X is pad value, which is a 4-bit value from X’0′ to X’F’

12345678910111213141516
PPPPP/XP/XP/XP/XP/XP/XP/XP/XXXXX

Where:

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> X – is a pad value has a 4-bit value from X’0′ to X’F’ and must be different from any PIN digit. The number of pad values for this format is in the range from 4 to 12, and all the pad values must have the same value.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            5
Format:         Diebold, Docutel, NCR
—————————————-
Clear PIN block:1234555555555555

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      1234555555555555
PAN:            N/A
PAD:            5
Format:         Diebold, Docutel, NCR
—————————————-
Decoded PIN:    1234

ECI-1

Same as ISO-0.

ECI-2

The ECI-2 PIN block format supports a 4-digit PIN. A PIN that is longer than 4 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – P is PIN digit, R is random value

12345678910111213141516
PPPPRRRRRRRRRRRR

Where:

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The PIN length for this format is always 4.The values of the PIN digits are independent.

> R is a random pad value, which is a value from X’0′ to X’F’. This format contains 12 random pad values that can have different values.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         ECI-2
—————————————-
Clear PIN block:1234095621C2F02F

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      1234095621C2F02F
PAN:            N/A
PAD:            N/A
Format:         ECI-2
—————————————-
Decoded PIN:    1234

ECI-3

The ECI-3 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character for PIN shorter than 6 digits, R is random value

12345678910111213141516
LPPPPP/0P/0RRRRRRRRR

Where:

> L is the length of the PIN, which is a 4-bit value from X’4′ to X’6′.

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> 0 – is a filling character for PIN’s shorter than 6 digits, so 4 digit PIN will be extended to 6 digits (1234 -> 123400).

> R is a random pad value, which is a value from X’0′ to X’F’. This format contains 9 random pad values that can have different values.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         ECI-3
—————————————-
Clear PIN block:41234E07180DD697

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      41234E07180DD697
PAN:            N/A
PAD:            N/A
Format:         ECI-3
—————————————-
Decoded PIN:    1234

ECI-4

Same as ISO-1.

IBM 3621

The 3621 PIN block format supports a PIN from 1 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – S1,S2,S3,S4 form a 2-byte sequence number that 3621 (or the originating terminal or node) assigns. P is PIN digit, X is defined padding value

12345678910111213141516
S1S2S3S4PP/XP/XP/XP/XP/XP/XP/XP/XP/XP/XP/X

Where:

> S1 S2 S3 S4 – Forms a 2-byte sequence number that the 3621 (or the originating terminal or node) assigns. A 3621 assigns the sequence number in ascending order, starting with X’0000′.

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> X – is A pad value has a 4-bit value from X’0′ to X’F’ and must be different from any PIN digit. The number of pad values for this format are in the range from 0 to 11, and all the pad values must have the same value.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            5
Format:         IBM 3621
—————————————-
Clear PIN block:0000123455555555

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      0000123455555555
PAN:            43219876543210987
PAD:            N/A
Format:         IBM 3621
—————————————-
Decoded PIN:    1234

IBM 3624

The 3624 PIN block format supports a PIN from 1 to 16 digits in length. A PIN that is longer than 16 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – P is PIN digit, X is defined padding value

12345678910111213141516
PP/XP/XP/XP/XP/XP/XP/XP/XP/XP/XP/XP/XP/XP/XP/X

Where:

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> X – is A pad value has a 4-bit value from X’0′ to X’F’ and must be different from any PIN digit. The number of pad values for this format are in the range from 0 to 15, and all the pad values must have the same value.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            5
Format:         IBM 3624
—————————————-
Clear PIN block:1234555555555555

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      1234555555555555
PAN:            N/A
PAD:            N/A
Format:         IBM 3624
—————————————-
Decoded PIN:    1234

IBM 4704-EPP (Encrypting PIN Pad)

The 4704 encrypting PIN Pad PIN block format supports a PIN from 1 to 13 digits in length. A PIN that is longer than 13 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – L – is a PIN length, P is PIN digit, F is padding value ‘F’, S1 S2 is a 1-byte sequence number

12345678910111213141516
LPP/FP/FP/FP/XP/FP/FP/FP/FP/FP/FP/FP/FS1S2

Where:

> L – is the length of the PIN, which is a 4-bit value from X’4′ to X’D’.

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> F – is A pad value has a 4-bit value of X’F’. The number of pad values for this format are in the range from 0 to 12.

> S1 S2 – is a 1-byte sequence number from X’00’ to X’FF’.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         IBM 4704 EPP
—————————————-
Clear PIN block:41234FFFFFFFFF00

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      41234FFFFFFFFF00
PAN:            N/A
PAD:            5
Format:         IBM 4704 EPP
—————————————-
Decoded PIN:    1234

IBM 5906

Same as IBM 3621.

VISA-1

Same as ISO-0.

VISA-2

The VISA-2 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character for PIN shorter than 6 digits, D is decimal value

12345678910111213141516
LPPPPP/0P/0DDDDDDDDD

Where:

> L is the length of the PIN, which is a 4-bit value from X’4′ to X’6′.

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> 0 – is a filling character for PIN’s shorter than 6 digits, so 4 digit PIN will be extended to 6 digits (1234 -> 123400).

> D is a decimal pad value, which is a 4-bit value from X’0′ to X’9′. All nine pad values must have the same value.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            5
Format:         VISA-2
—————————————-
Clear PIN block:4123400555555555

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      4123400555555555
PAN:            N/A
PAD:            N/A
Format:         VISA-2
—————————————-
Decoded PIN:    1234

VISA-3

The VISA-3 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – P is PIN digit, F is PIN delimiter, X is a pad value

12345678910111213141516
PPPPP/FP/F/XP/F/XP/F/XP/F/XP/F/XP/F/XP/F/XF/XXXX

Where:

> P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> F – is a a PIN digit or a delimiter X’F’. If the preceding digit is the last (or rightmost) PIN digit, this digit is the delimiter X’F’.

> X is a pad value, which is a 4-bit value from X’0′ to X’F’. All the pad values must have the same value.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            5
Format:       VISA-3
—————————————-
Clear PIN block:1234F55555555555

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      1234F55555555555
PAN:            N/A
PAD:            N/A
Format:         VISA-3
—————————————-
Decoded PIN:    1234

VISA-4

The VISA-4 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.

Calculation steps:

1. Prepare a PIN – 0 – is the value X’0′, L is length of the PIN, P is PIN digit, F – is the value X’F’ for the pad value, PAN is twelve 4-bit digits representing the leftmost 12 digits of the primary account number (excluding the check digit).

12345678910111213141516
0LPPPPP/FP/FP/FP/FP/FP/FP/FP/FFF

2. Prepare PAN – take 12 leftmost digits of the primary account number (excluding the check digit)

12345678910111213141516
0000PANPANPANPANPANPANPANPANPANPANPANPAN

3. XOR both values

12345678910111213141516
0LPPPPP/FP/FP/FP/FP/FP/FP/FP/FFF
XORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXOR
0000PANPANPANPANPANPANPANPANPANPANPANPAN

Where:

> 0 is the value X’0′

> L – is a PIN length

> P is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of the PIN digits are independent.

> F – is a pad value of X’F’. The number of PAD digits X’F’ in the intermediate PIN block (IPB) is in the range from 2 to 10.

> PAN – is twelve 4-bit digits representing the leftmost 12 digits of the primary account number (excluding the check digit). Each PAN digit has a value from X’0′ to X’9′.

Example:

PIN blocks: PIN block encrypt operation finished
****************************************
PAN:            43219876543210987
PIN:            1234
PAD:            N/A
Format:         VISA-4
—————————————-
Clear PIN block:041277DE6789ABCD

PIN blocks: PIN block decode operation finished
****************************************
PIN block:      041277DE6789ABCD
PAN:            N/A
PAD:            N/A
Format:         VISA-4
—————————————-
Decoded PIN:    1234

AS2805 Format 1

The AS2805 Format 1 PIN block format is similar to an ISO-1 PIN block format. The PIN block format supports a PIN from 4 to 12 digits in length.

Calculation steps:

1. Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value

12345678910111213141516
1LPPPPP/RP/RP/RP/RP/RP/RP/RP/RRR

Where:

> L – is the length of the PIN, which is a 4-bit value from X’4′ to X’C’.

> R – is a random digit, which is a value from X’0′ to X’F’.

AS2805 Format 8 (format 46)

The AS2805 Format 8 PIN block (format 46) is similar to an Format 1 PIN block format. The PIN block format supports zero length PIN Block.

Calculation steps:

1. Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value

12345678910111213141516
CLPPPPP/RP/RP/RP/RP/RP/RP/RP/RFF
80RRRRRRRRRRRRFF

Where:

> C – Control field, if is X’0′, then the PIN block is processed as a standard format 01 PIN block.

> L – is the length of the PIN, which is a 4-bit X’0′ or value from X’4′ to X’C’. If it is X’0′ then the PIN block is a Zero PIN block. No checking of the PIN block is required in this case.

> R – is a random digit, which is a value from X’0′ to X’F’.

> F – the X’F’ character.