XBM

image/x-xbitmap

Safe

Magic Bytes

Offset: 0
2F 2A 20 58 50 4D

The X BitMap (XBM) is a legacy monochrome image format originally developed for the X Window System by the MIT X Consortium. It was primarily used for storing small icons, cursors, and user interface elements as C language source code that could be compiled directly into applications. Although largely obsolete and replaced by more modern formats like PNG, XBM remains a secure format because its plain-text structure lacks support for executable macros or complex metadata.

Extension

.xbm

MIME Type

image/x-xbitmap

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .xbm files in Python

Python
def is_xbm(file_path: str) -> bool:
    """Check if file is a valid XBM by magic bytes."""
    signature = bytes([0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D])
    with open(file_path, "rb") as f:
        return f.read(6) == signature

How to validate .xbm files in Node.js

Node.js
function isXBM(buffer: Buffer): boolean {
  const signature = Buffer.from([0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D]);
  return buffer.subarray(0, 6).equals(signature);
}
Go
func IsXBM(data []byte) bool {
    signature := []byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D}
    if len(data) < 6 {
        return false
    }
    return bytes.Equal(data[:6], signature)
}

API Endpoint

GET /api/v1/xbm
curl https://filesignature.org/api/v1/xbm

Related Formats