HSM KitHSM Kit
English

Understanding PIN Block Formats (ISO 9564)

Payment Security# PIN Block# ISO 9564# Payment Security
Last Updated: January 15, 20262 min readBy HSM Kit Team
Need to calculate this now?
Use our free online PIN Blocks General Tool tool.

PIN blocks are the standard format for encrypting and transmitting Personal Identification Numbers (PINs) in financial systems. This guide covers all ISO 9564 formats.

What is a PIN Block?

A PIN block is a formatted data block that contains a PIN in a specific format, designed to be encrypted and transmitted securely. The format combines:

  • The PIN itself
  • A "fill" pattern (random or fixed data)
  • Often the Primary Account Number (PAN)

ISO 9564 PIN Block Formats

Format 0 (ISO-0)

The most widely used format, requires PAN for encoding:

PIN Block = PIN Field XOR PAN Field

PIN Field Structure:

  • Byte 0: 0x0 (format identifier) | PIN length (4 bits)
  • Bytes 1-7: PIN digits followed by 0xF padding

PAN Field Structure:

  • First 4 nibbles: 0x0000
  • Next 12 nibbles: Rightmost 12 digits of PAN (excluding check digit)

Format 1 (ISO-1)

Does NOT require PAN, uses random fill:

  • Byte 0: 0x1 | PIN length
  • PIN digits followed by random fill

Advantage: Works without PAN, more secure random padding Disadvantage: Cannot verify PIN block integrity without decryption

Format 2 (ISO-2)

ICC (chip card) format, never transmitted:

  • Byte 0: 0x2 | PIN length
  • PIN digits followed by 0xF fill
  • Used only for PIN verification within chip cards

Format 3 (ISO-3)

Similar to Format 0 but with random fill:

  • Byte 0: 0x3 | PIN length
  • PIN digits followed by random fill (0xA-0xE range)
  • XORed with PAN field

More secure than Format 0 due to randomness.

Format 4 (ISO-4)

The newest and most secure format, designed for AES:

  • 16 bytes (128 bits) instead of 8 bytes
  • Uses AES-128 encryption
  • Includes additional security features

Structure:

  • Control field with format indicator
  • PIN length
  • PIN digits
  • Random fill
  • PAN hash

Security Comparison

FormatPAN RequiredFill TypeBlock SizeRecommended
0YesFixed (0xF)8 bytesLegacy
1NoRandom8 bytesGood
2N/AFixed8 bytesChip only
3YesRandom8 bytesBetter
4YesRandom16 bytesBest

When to Use Each Format

  • Format 0: Legacy systems, ATM networks
  • Format 1: Systems without PAN access
  • Format 3: Modern TDES-based systems
  • Format 4: New AES-based implementations

Try It Yourself

Use our PIN Blocks tool to encode and decode PIN blocks in all formats with step-by-step visualization of the process.

Related Tool
PIN Blocks General Tool