File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Images
  • Raster
  • Vector
  • Camera raw
  • Layered projects
  • HDR & scientific
  • Icons
  • Retro
  1. Home
  2. Images
  3. Raster
  4. BMP
  5. BM
  6. File header
.BMP
  • Overview
  • Windows bitmap (BM)
    • File header
    • DIB header
    • Colour spaces
    • Colour table
    • Bit masks
    • Pixel data
    • Compression
  • OS/2 bitmap array (BA)
  • OS/2 icon (IC)
  • OS/2 colour icon (CI)
  • OS/2 pointer (PT)
  • OS/2 colour pointer (CP)

File header

Every BMP file starts with a 14-byte file header, called BITMAPFILEHEADER in the Windows headers. It marks the file as a bitmap and says where the pixels start. The DIB header follows straight after it.

00000000  42 4D 46 00 00 00 00 00 00 00 36 00 00 00
A file header: BM, 70 bytes long, pixels at offset 54

Fields

All numbers are little-endian. The header has no padding, so it is exactly 14 bytes and the fields after the first are not aligned to 4 bytes.

OffsetSizeTypeNameDescription
02char[2]bfTypeThe signature BM (42 4D). OS/2 files can carry other values, listed below.
24u32bfSizeThe size of the whole file in bytes. Some programs write a wrong value or zero, so readers should not depend on it.
62u16bfReserved1Reserved, zero.
82u16bfReserved2Reserved, zero.
104u32bfOffBitsThe offset from the start of the file to the pixel data.

Signatures

Windows bitmaps always use BM. OS/2 defined further types for its icon and pointer files, which use the same header; in those, the two reserved fields hold the hotspot.

ValueBytesMeaning
BM42 4DWindows or OS/2 bitmap
BA42 41OS/2 bitmap array
CI43 49OS/2 colour icon
CP43 50OS/2 colour pointer
IC49 43OS/2 icon
PT50 54OS/2 pointer

Finding the pixels

Use bfOffBits to find the pixel data rather than adding up the sizes of the parts before it. Writers may leave a gap after the colour table, for example to align the pixels, and the offset is the one value every reader agrees on.

Where a bitmap is held in memory, on the clipboard or inside an ICO file, there is no file header: the data starts directly with the DIB header.

© 2026 fileformats.org About Contact Made by Lewpen