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. Colour table
.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)

Colour table

The colour table is the palette of a BMP file. In an image of 8 bits per pixel or fewer, each pixel is a number that picks an entry from this table. It sits straight after the DIB header, or after the bit masks when those follow the header.

00000036  00 00 00 00 FF FF FF 00
A two-colour table: entry 0 is black, entry 1 is white

When it is present

Bit countColour tableNumber of entries
1, 4, 8RequiredbiClrUsed, or 2, 16 or 256 when biClrUsed is 0
16, 24, 32OptionalbiClrUsed; none when it is 0
0NoneThe pixels are an embedded JPEG or PNG

At 16 bits per pixel and above the pixels hold their colours directly. A colour table there is only a hint for displays limited to a palette, and the pixels never refer to it. biClrUsed can be smaller than the maximum for a palette image, which saves space when an 8-bit image uses fewer than 256 colours. A BITMAPCOREHEADER has no biClrUsed field, so its table always has the full 2, 16 or 256 entries.

biClrImportant gives how many of the colours, counted from the start of the table, are needed to show the image well; 0 means all of them. Most readers ignore it.

Entries

With every header except BITMAPCOREHEADER, each entry is an RGBQUAD of 4 bytes, in the order blue, green, red:

OffsetSizeTypeNameDescription
01u8rgbBlueBlue, 0 to 255.
11u8rgbGreenGreen, 0 to 255.
21u8rgbRedRed, 0 to 255.
31u8rgbReservedReserved, zero.

With a BITMAPCOREHEADER, each entry is an RGBTRIPLE of 3 bytes, with no reserved byte:

OffsetSizeTypeNameDescription
01u8rgbtBlueBlue, 0 to 255.
11u8rgbtGreenGreen, 0 to 255.
21u8rgbtRedRed, 0 to 255.

The table is therefore 4 × entries bytes long, or 3 × entries with a core header. A full 256-colour table takes 1024 bytes.

Palette order

The table can hold any colours in any order. A 1-bit image is not always black and white, and index 0 is not always the darker colour. Always look colours up in the table rather than assuming them.

The pixels start at the offset given in the file header, which may leave a gap after the table.

© 2026 fileformats.org About Contact Made by Lewpen