How the bitmap works, how to read one in hex, and what the secondary bitmap adds, with worked examples.
The bitmap comes right after the MTI and tells the receiver which data elements follow. It is 64 bits, one per field. If bit 1 is set, a second 64-bit bitmap follows for fields 65 to 128. Convert hex to bits, number them from 1, and every 1 is a field in the message.
An ISO 8583 message does not send every field every time. The bitmap is a compact map of which data elements are present. The receiver reads the bitmap first, then reads the fields in ascending order, using the format table in its specification to know how long each one is. Without the bitmap there is no way to know where one field ends and the next begins.
Bits are numbered from 1, starting at the left, most significant bit of the first byte. Bit 1 is the secondary bitmap flag. Bit 2 stands for data element 2 (the primary account number), bit 3 for data element 3 (the processing code), and so on up to bit 64. A bit set to 1 means that field is in the message, a 0 means it is absent.
Bitmaps are usually shown as 16 hex characters. Turn each hex character into four bits using this table, join them, and number from the left starting at 1.
| Hex | Bits | Hex | Bits | Hex | Bits | Hex | Bits |
|---|---|---|---|---|---|---|---|
| 0 | 0000 | 4 | 0100 | 8 | 1000 | C | 1100 |
| 1 | 0001 | 5 | 0101 | 9 | 1001 | D | 1101 |
| 2 | 0010 | 6 | 0110 | A | 1010 | E | 1110 |
| 3 | 0011 | 7 | 0111 | B | 1011 | F | 1111 |
Take the bitmap 3020000000800000. Split it into bytes and expand each one.
| Byte | Hex | Bits | Fields it covers | Set bits |
|---|---|---|---|---|
| 1 | 30 | 0011 0000 | 1 to 8 | 3, 4 |
| 2 | 20 | 0010 0000 | 9 to 16 | 11 |
| 3 | 00 | 0000 0000 | 17 to 24 | none |
| 4 | 00 | 0000 0000 | 25 to 32 | none |
| 5 | 00 | 0000 0000 | 33 to 40 | none |
| 6 | 80 | 1000 0000 | 41 to 48 | 41 |
| 7 | 00 | 0000 0000 | 49 to 56 | none |
| 8 | 00 | 0000 0000 | 57 to 64 | none |
The message therefore carries data elements 3 (processing code), 4 (transaction amount), 11 (system trace audit number) and 41 (card acceptor terminal ID), in that order after the bitmap. Bit 1 is 0 here, so there is no secondary bitmap.
When a message needs a field above 64, bit 1 of the primary bitmap is set and a second 64-bit bitmap follows it. The second bitmap covers fields 65 to 128, with its own bit 1 standing for field 65. Network management messages are a common case, because field 70 (network management information code) is above 64.
Example for a sign-on request, MTI 0800:
0800 8220000000000000 0400000000000000 ...field data...
primary bitmap secondary bitmap | Bitmap | Hex | Set bits | Meaning |
|---|---|---|---|
| Primary | 8220000000000000 | 1, 7, 11 | Secondary bitmap present, field 7 (transmission date and time), field 11 (STAN) |
| Secondary | 0400000000000000 | 6 (field 70) | Field 70, network management information code |
The sixth bit of the secondary bitmap is data element 64 + 6 = 70. For the secondary bitmap, add 64 to the bit position you find to get the field number.
Going the other way is the same process in reverse. List the fields you will send, set those bits, and set bit 1 as well if any field is above 64. For fields 2, 3, 4, 11 and 55 the primary bitmap is 7020000000000200. Field 55 is the last bit that matters, in byte 7, where 02 is 0000 0010 and its seventh bit is field 55.
The same 64 bits can travel two ways. As binary, the bitmap is 8 bytes. As ASCII hex it is 16 characters, so it takes 16 bytes. Some hosts use one, some the other, and a few use EBCDIC for the whole message. The bit positions mean the same thing either way. The ISO 8583 decoder and bitmap decoder work on the hex form, 16 characters per bitmap.
Paste a bitmap into the ISO 8583 bitmap decoder to list the fields it says are present, or enter field numbers to build a bitmap. To see a whole message, use the message decoder. For annotated messages with real bitmaps in them, see the sample messages.
Tell us the host, the terminal and the region. A payments engineer will help you scope the integration and certification.
Talk to us Book a meeting with a founder