BMP / ICO File Inspector

Inspect BMP DIB header and ICO directory — size, bit depth, color planes

Free BMP and ICO inspector that decodes the BITMAPFILEHEADER and BITMAPINFOHEADER of a .bmp, or the icon directory of a multi-resolution .ico, showing width, height, bit depth, compression and per-image entries. Runs locally with DataView, no upload. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between BITMAPFILEHEADER and BITMAPINFOHEADER?

BITMAPFILEHEADER is the first 14 bytes of a BMP — the BM signature, total file size and the offset where pixel data begins. BITMAPINFOHEADER (usually the next 40 bytes) describes the image itself: width, height, color planes, bit depth, compression and resolution.

Decode the binary header of a Windows bitmap (.bmp) or icon (.ico) file — its dimensions, bit depth, compression and, for icons, every resolution packed inside. The inspector reads the BITMAPFILEHEADER, BITMAPINFOHEADER and ICO directory directly with the browser’s DataView API, entirely on your device. No file is uploaded; everything happens in your browser’s memory.

When to use this tool

  • You have a .bmp file from a legacy scanner, imaging device, or old graphics pipeline and need to confirm its bit depth or compression mode before converting it.
  • A favicon .ico looks correct in one browser but broken in another and you want to verify whether the 16×16 or 48×48 variant is actually present in the file.
  • You are debugging a custom BMP writer and need to audit the exact bytes your code produces.
  • You are checking whether an ICO’s large-size entry is PNG-compressed (modern) or an uncompressed DIB (legacy).

How it works

BMP structure

A BMP starts with a 14-byte BITMAPFILEHEADER:

bytes 0-1  : "BM" signature
bytes 2-5  : total file size (LE)
bytes 10-13: offset to pixel data

then a 40-byte BITMAPINFOHEADER (the common DIB header):

biSize         (4)  header size, usually 40
biWidth        (4)  pixel width (signed)
biHeight       (4)  pixel height (signed; negative = top-down)
biPlanes       (2)  color planes, always 1
biBitCount     (2)  bits per pixel: 1, 4, 8, 16, 24, 32
biCompression  (4)  0=RGB, 1=RLE8, 2=RLE4, 3=BITFIELDS, 4=JPEG, 5=PNG
biSizeImage    (4)  pixel data size in bytes
biClrUsed      (4)  palette entries used

ICO structure

An icon file begins with a 6-byte header: a reserved word, a type word (1 = icon, 2 = cursor) and the image count. Each image then has a 16-byte directory entry:

width  (1)  0 means 256
height (1)  0 means 256
colors (1)  palette size, 0 if ≥256
reserved(1)
planes (2)
bitCount(2)
bytesInRes(4)  size of this image's data
imageOffset(4) where its data starts

The inspector walks the directory and lists every entry, so you can confirm a favicon really contains 16×16, 32×32 and 48×48 variants.

Worked example — reading a 24-bit BMP

Imagine a 100×80 pixel, 24-bit uncompressed image. The inspector would show:

FieldValueWhat it means
SignatureBMValid Windows bitmap
File size24,054 bytes14 + 40 + (100 × 80 × 3) + row padding
biWidth100100 pixels wide
biHeight8080 pixels tall, stored bottom-up
biBitCount243 bytes per pixel, RGB, no palette
biCompression0 (RGB)Uncompressed
biSizeImage24,000Pixel data bytes (rows padded to 4-byte boundaries)

A negative biHeight would mean the rows are stored top-down instead — many screen-capture tools write top-down BMPs that some older programs cannot read.

Tips and edge cases

  • A 32-bit BMP with compression 3 (BITFIELDS) carries an alpha channel via custom channel masks — check the mask values if the transparency isn’t loading correctly.
  • ICO entries whose bytesInRes starts with the PNG signature (89 50 4E 47) are PNG-compressed icons, common for 256×256 sizes — modern browsers handle these but some older frameworks do not.
  • If biSizeImage is 0, that is legal for uncompressed images; the actual size can be computed from width, height, bit depth, and row padding (each row rounds up to the next 4-byte boundary).
  • A cursor .ico (type word = 2) uses the same directory structure; the inspector reports the type.
  • For very old BMPs, biSize may be 12 (BITMAPCOREHEADER format) rather than 40; the inspector reports the header version so you know which fields are valid.