Tools

PIN Block Calculator

Build and decode ISO 9564-1 PIN blocks in formats 0, 1, 2, 3 and 4. Optionally encrypt or decrypt them with a DES, Triple DES or AES key, and see every intermediate step.

Test data only. Everything runs in your browser and nothing is sent anywhere, but never enter a real PIN, a real card number or a production key in any website.
4 to 12 digits.
12 to 19 digits.

Result

How each format works

ISO 0 (ANSI X9.8, format 0)

The PIN field is 0, the PIN length, the PIN, then F up to 16 digits. The PAN field is 0000 followed by the 12 rightmost digits of the PAN, excluding the check digit. The PIN block is the two fields XORed together, so it is tied to the card. This is the most common format for online PIN.

ISO 1 (format 1)

1, the PIN length, the PIN, then random fill. It does not use the PAN, so it suits cases where the PAN is not available. The random fill means the same PIN gives a different block every time.

ISO 2 (format 2)

2, the PIN length, the PIN, then F. It is the plaintext format the terminal sends to the chip in the VERIFY command for offline PIN. It is not meant to be sent over a network.

ISO 3 (format 3)

Like format 0, but the fill after the PIN is random values from A to F instead of F. The random fill makes identical PINs on the same card produce different blocks.

ISO 4 (format 4)

The AES format from ISO 9564-1:2017. The 16-byte PIN field is 4, the PIN length, the PIN, A fill up to 16 digits, then 8 random bytes. The PAN field is the PAN length minus 12, the PAN, then zeros. The PIN field is encrypted with the AES key, XORed with the PAN field, and encrypted again. Because the PAN is bound inside the encryption, format 4 always needs the key.

Key and check value

For formats 0 to 3 the key is optional: with one, the tool also encrypts or decrypts the 8-byte block with DES (8-byte key) or Triple DES (16 or 24 bytes), in ECB mode. Format 4 needs an AES key of 16, 24 or 32 bytes. The key check value is the first 3 bytes of a block of zeros encrypted with the key.