All Tools
Tools/ISO 8583 Bitmap Decoder
🗺️
ISO 8583Beta

ISO 8583 Bitmap Decoder

Decode primary and secondary ISO 8583 bitmaps (up to 128 bits / 16 bytes) into the list of present and absent data elements.

</> Code Implementation
# ISO 8583 Bitmap Decoder — extract present field numbers
# No external dependencies required

def decode_bitmap(hex_bitmap: str) -> list:
    data = bytes.fromhex(hex_bitmap.replace(" ", ""))
    fields = []
    for byte_idx, byte in enumerate(data):
        for bit_idx in range(8):
            if byte & (0x80 >> bit_idx):
                fields.append(byte_idx * 8 + bit_idx + 1)
    return fields

# Example — primary + secondary bitmap
bitmap = "F230000002C000001000000000000000"
fields = decode_bitmap(bitmap)
print(f"Present fields: {fields}")
# Present fields: [1, 2, 3, 7, 12, 28, 32, 39, 41, 42]