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
.bmpfile 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
.icolooks 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:
| Field | Value | What it means |
|---|---|---|
| Signature | BM | Valid Windows bitmap |
| File size | 24,054 bytes | 14 + 40 + (100 × 80 × 3) + row padding |
| biWidth | 100 | 100 pixels wide |
| biHeight | 80 | 80 pixels tall, stored bottom-up |
| biBitCount | 24 | 3 bytes per pixel, RGB, no palette |
| biCompression | 0 (RGB) | Uncompressed |
| biSizeImage | 24,000 | Pixel 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
bytesInResstarts 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
biSizeImageis 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,
biSizemay be 12 (BITMAPCOREHEADER format) rather than 40; the inspector reports the header version so you know which fields are valid.