Skip to content

XBM (.xbm)

.xbm file signature | image/x-xbitmap

X BitMap (XBM) is a plain-text monochrome image format created for the X Window System and historically maintained by the X Consortium, now supported by X.Org implementations. It is used for simple icons, cursor images, and small graphics in X applications, especially in environments that use lightweight text-based image assets. XBM is a legacy format and remains safe to handle, though its limited color support and text-based structure make it largely obsolete in modern workflows.

Safe

Magic Bytes

Offset 0
23 64 65 66 69 6E 65 20

Sources: X BitMap (C-macro header '#define ')

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([0x23, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x20])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .xbm files in Node.js

Node.js
function isXBM(buffer: Buffer): boolean {
  const signature = Buffer.from([0x23, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x20]);
  return buffer.subarray(0, 8).equals(signature);
}

How to validate .xbm files in Go

Go
func IsXBM(data []byte) bool {
    signature := []byte{0x23, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x20}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .xbm file?

A .xbm file is identified by the magic bytes 23 64 65 66 69 6E 65 20 at byte offset 0. X BitMap (XBM) is a plain-text monochrome image format created for the X Window System and historically maintained by the X Consortium, now supported by X.Org implementations. It is used for simple icons, cursor images, and small graphics in X applications, especially in environments that use lightweight text-based image assets. XBM is a legacy format and remains safe to handle, though its limited color support and text-based structure make it largely obsolete in modern workflows.

What are the magic bytes for .xbm files?

The magic bytes for XBM files are 23 64 65 66 69 6E 65 20 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .xbm file?

To validate a .xbm file, read the first bytes of the file and compare them against the known magic bytes (23 64 65 66 69 6E 65 20) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .xbm files?

The primary MIME type for .xbm files is image/x-xbitmap.

Is it safe to open .xbm files?

XBM (.xbm) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.