Windows

image/bmp

Safe

Magic Bytes

Offset: 0
42 4D

The Windows Bitmap (BMP) is a raster graphics image file format developed by Microsoft for storing device-independent digital images. It is primarily used for uncompressed storage of simple graphics, icons, and local system resources within the Windows operating system environment. Although largely superseded by compressed formats like JPEG and PNG for network transmission, it remains a stable legacy format considered safe for general use because it does not typically support executable content.

Extension

.bmp

MIME Type

image/bmp

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .bmp files in Python

Python
def is_bmp(file_path: str) -> bool:
    """Check if file is a valid BMP by magic bytes."""
    signature = bytes([0x42, 0x4D])
    with open(file_path, "rb") as f:
        return f.read(2) == signature

How to validate .bmp files in Node.js

Node.js
function isBMP(buffer: Buffer): boolean {
  const signature = Buffer.from([0x42, 0x4D]);
  return buffer.subarray(0, 2).equals(signature);
}
Go
func IsBMP(data []byte) bool {
    signature := []byte{0x42, 0x4D}
    if len(data) < 2 {
        return false
    }
    return bytes.Equal(data[:2], signature)
}

API Endpoint

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

Related Formats