User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Supports data URI prefixes and whitespace. Auto-stripped on decode.
๐Ÿ“ Drop a .bmp file here or click to browse
Decoded bitmap will appear here
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

BMP (Windows Bitmap) files encode pixel data with a rigid binary header structure: a 14-byte BITMAPFILEHEADER followed by a 40-byte BITMAPINFOHEADER (DIB header). Misreading the pixel data offset, row padding (each scanline is padded to a 4-byte boundary), or the bottom-up row order produces corrupted output. This tool parses the full BMP binary structure from a Base64 string, supporting bit depths from 1-bit monochrome through 32-bit BGRA, including indexed color table formats. It renders the decoded bitmap to a canvas pixel-by-pixel, so you can visually verify encoded payloads, embedded sprites, or legacy bitmap assets without external software.

This tool approximates standard uncompressed BMP (BI_RGB). RLE-compressed bitmaps (BI_RLE8, BI_RLE4) and OS/2 variants are not supported. If your Base64 string lacks the BMP file header (bytes 0x42 0x4D), decoding will fail. Pro tip: many systems strip the BMP file header and encode only raw pixel buffers. Use the "Raw Pixel Mode" option if your data lacks headers.

base64 decode bitmap bmp image converter binary pixel data

Formulas

Row padding ensures each scanline aligns to a 4-byte boundary. The number of padding bytes per row:

padding = (4 โˆ’ (w ร— bpp8) mod 4) mod 4

Where w = image width in pixels, bpp = bits per pixel. The raw stride (bytes per row including padding):

stride = w ร— bpp + 3132 ร— 4

For indexed formats (1-bit, 4-bit, 8-bit), pixel values are indices into a color table. Each color table entry is 4 bytes: B, G, R, 0x00 (reserved). For 16-bit (RGB555), each channel is extracted via bitmask:

R = ((pixel >> 10) & 0x1F) ร— 25531
G = ((pixel >> 5) & 0x1F) ร— 25531
B = (pixel & 0x1F) ร— 25531

BMP default row order is bottom-up. If the height field is negative, rows are stored top-down. The canvas Y coordinate for row i in bottom-up mode:

y = h โˆ’ 1 โˆ’ i

Reference Data

BMP FieldOffset (bytes)Size (bytes)Description
Signature02Magic bytes: 0x42 0x4D ("BM")
File Size24Total file size in bytes
Reserved64Unused, must be 0
Pixel Data Offset104Offset to start of pixel array
DIB Header Size144Size of info header (40 for BITMAPINFOHEADER)
Width184Image width in pixels (signed 32-bit)
Height224Image height (negative = top-down order)
Color Planes262Must be 1
Bits Per Pixel2821, 4, 8, 16, 24, or 32
Compression3040 = BI_RGB (none), 3 = BI_BITFIELDS
Image Size344Raw pixel data size (can be 0 for BI_RGB)
H Resolution384Pixels per meter (horizontal)
V Resolution424Pixels per meter (vertical)
Colors Used464Number of palette entries (0 = default)
Important Colors504Usually ignored, set to 0
Row Padding - VariableEach row padded to 4-byte boundary
Color Table (indexed)544 ร— nBGRA entries for 1/4/8-bit formats
1-bit Palette Size - 82 colors ร— 4 bytes
4-bit Palette Size - 6416 colors ร— 4 bytes
8-bit Palette Size - 1024256 colors ร— 4 bytes
16-bit Layout (555) - 2/px5 bits R, 5 bits G, 5 bits B
24-bit Layout - 3/pxB, G, R byte order (no alpha)
32-bit Layout - 4/pxB, G, R, A byte order

Frequently Asked Questions

BMP stores pixel rows bottom-up by default. The first row in the pixel array is the bottom row of the image. This tool handles both bottom-up (positive height) and top-down (negative height) automatically. If you're providing raw pixel data without headers, ensure you select the correct row order in the options.
BMP stores pixels in BGR order, not RGB. A 24-bit pixel reads Blue, Green, Red in sequence. If your Base64 data comes from a system that encoded RGB order, the red and blue channels will appear swapped. Use the "Swap Rโ†”B" option to correct this.
Each scanline in a BMP is padded to a 4-byte boundary. A 24-bit image with width 5 has 15 bytes of pixel data per row, padded to 16 bytes (1 byte padding). If padding is not accounted for, subsequent rows shift progressively, producing a diagonal shear artifact. The tool calculates padding as (4 โˆ’ (w ร— bpp รท 8) mod 4) mod 4.
Yes. Enable "Raw Pixel Mode" and manually specify width, height, and bit depth. The tool will skip header parsing and interpret the entire decoded byte array as pixel data. You must know the exact dimensions; incorrect values produce garbled output.
Browser canvas elements have implementation-defined limits, typically around 16384 ร— 16384 pixels or approximately 268 million total pixels. The Base64 input itself is limited by browser string length (usually several hundred MB). For practical use, bitmaps under 4096 ร— 4096 at 32-bit depth (64 MB raw) decode reliably.
Common causes: the string contains a data URI prefix (e.g., 'data:image/bmp;base64,') which must be stripped, or it contains line breaks or whitespace. The tool auto-strips data URI prefixes and whitespace. If it still fails, verify the string length is a multiple of 4 and uses only A-Z, a-z, 0-9, +, /, and = padding characters.