Base64 to BMP Converter
Convert Base64-encoded image strings to BMP bitmap files. Supports PNG, JPEG, GIF, WebP Base64 input with real binary BMP encoding and instant download.
About
BMP (Bitmap) is one of the oldest uncompressed raster image formats, storing pixel data in a rigid binary structure defined by Microsoft. Converting a Base64-encoded image to BMP requires decoding the Base64 payload, extracting raw RGBA pixel data, then re-encoding it into the BMP binary specification: a 14-byte file header, a 40-byte DIB header (BITMAPINFOHEADER), and a bottom-up, BGR-ordered pixel array where each row is padded to a 4-byte boundary. Getting any of these offsets wrong produces a corrupted file that no viewer can open. This tool performs real binary construction - no server round-trips, no simulated output.
Base64 encoding inflates binary data by approximately 33%, so a 1MB Base64 string decodes to roughly 750KB of image data. The resulting BMP file will typically be larger than the source because BMP stores uncompressed pixels. This tool accepts Base64 strings from any image format (PNG, JPEG, GIF, WebP) and produces a valid 24-bit BMP. Note: transparency (alpha channel) is discarded since standard 24-bit BMP does not support it - pixels are composited against a white background.
Formulas
The BMP file size is calculated from image dimensions and bit depth. Each pixel row must be padded so its byte length is a multiple of 4.
Where w = image width in pixels, h = image height in pixels, bpp = bits per pixel (24 for RGB). The constant 14 is the BMP file header size and 40 is the BITMAPINFOHEADER size. Row padding in bytes:
Base64 decoded byte length from string length:
Where len = Base64 string length and paddingChars = number of trailing = characters (0, 1, or 2).
Reference Data
| Property | BMP Specification | Details |
|---|---|---|
| File Signature | 0x42 0x4D | ASCII "BM" - identifies file as BMP |
| File Header Size | 14 bytes | Contains file size, reserved fields, pixel data offset |
| DIB Header (BITMAPINFOHEADER) | 40 bytes | Width, height, color depth, compression method |
| Bits Per Pixel (24-bit) | 24 bpp | 3 bytes per pixel: Blue, Green, Red (no alpha) |
| Bits Per Pixel (32-bit) | 32 bpp | 4 bytes per pixel: Blue, Green, Red, Alpha |
| Pixel Order | Bottom-to-Top | First row in file is bottom row of image |
| Channel Order | BGR / BGRA | Reverse of web-standard RGBA |
| Row Padding | 4-byte aligned | Each row padded with 0x00 bytes to multiple of 4 |
| Compression (BI_RGB) | 0 | No compression - raw pixel storage |
| Color Planes | 1 | Always 1 for BMP |
| Horizontal Resolution | 2835 px/m | ~72 DPI standard screen resolution |
| Vertical Resolution | 2835 px/m | ~72 DPI standard screen resolution |
| Max Base64 Input Ratio | 4:3 | Every 4 Base64 chars encode 3 bytes of binary |
| Base64 Charset | 64 characters | A - Z, a - z, 0-9, +, / with = padding |
| Max Image Dimension | 65535 Γ 65535 px | Practical limit due to memory constraints |
| MIME Type (BMP) | image/bmp | Also accepted: image/x-ms-bmp |
| File Extension | .bmp | Sometimes .dib for device-independent bitmap |
| Endianness | Little-endian | All multi-byte integers stored little-endian |
| Color Table (24-bit) | None | 24/32-bit BMPs skip color table entirely |
| Typical File Size (1920Γ1080) | ~5.93 MB | 1920 Γ 1080 Γ 3 + headers + padding |