Tools

    PIN block calculator (ISO 9564)

    Build and decode ISO 9564 PIN blocks, formats 0–4, and encrypt them under a test PIN key.

    • Runs in your browser
    • No sign-up

    Input

    Format 0 PIN block built.

    Result

    ISO 9564 format 0
    PIN field
    041234FFFFFFFFFF
    PAN field
    0000987654321098
    Clear PIN block
    0412AC89ABCDEF67

    PIN verification failing between terminal, acquirer and issuer? IDNTEQ can find the cause. EMV transaction troubleshooting

    About this tool

    Runs in your browser. This page loads no analytics or third-party scripts and does not send what you type.

    Build a PIN block from a PIN and PAN, or decode one back to the PIN, in ISO 9564 formats 0 to 4. Enter a test PIN key to see the encrypted block, or to decrypt one. For test data only.

    Formats

    Format 0 puts the PIN length and digits in a 16-digit field filled with F and XORs it with the 12 rightmost PAN digits (check digit excluded). Format 1 uses a random or transaction-specific fill and no PAN. Format 2 is filled with F and has no PAN; it is the block the card receives in an offline plaintext PIN VERIFY. Format 3 is format 0 with random fill digits A to F.

    Format 4 is the 16-byte AES format: a PIN field with A fill and 8 random bytes, and a PAN field that holds up to 19 PAN digits. The enciphered block is E(K, E(K, PIN field) XOR PAN field), and the tool shows both intermediate blocks. Formats 0 to 3 are encrypted with DES or TDES in ECB mode.

    Decoding

    Paste a clear PIN block, or an encrypted one with its key. The format is read from the first digit, the PAN is removed where the format uses it, and the length, digits and fill are checked. A block that does not decode cleanly is reported as such, which usually means a wrong PAN or a wrong key.

    Spec references

    • ISO 9564-1:2017 §9 (PIN block formats 0–4)
    • ANSI X9.8-1 (format 0)
    • EMV 4.4 Book 3 §6.5.12 (VERIFY, format 2)

    Verified against

    Specifications
    • ISO 9564-1:2017 §9 (PIN block formats 0–4)
    • EMV 4.4 Book 3 §6.5.12 (VERIFY, format 2)
    Published examples in the tests
    Other checks in the tests
    • Formats 0–3 encrypted with TDES and format 4 with AES, against OpenSSL, and decrypted back
    • Random fill alphabets; a wrong PAN or key gives problems, not a PIN
    Inputs
    PIN of 4–12 digits, PAN, optional fill, optional test PIN key (DES/TDES for formats 0–3, AES for format 4).
    Not covered
    No PIN translation between keys or formats, DUKPT or PVV/IBM 3624 offsets.
    Last reviewed