User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
Drop a text file with Base64, or click to browse
Preview will appear here
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

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.

base64 bmp bitmap image converter base64 decode bmp encoder image format

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.

rowSize = floor(bpp Γ— w + 3132) Γ— 4
pixelDataSize = rowSize Γ— h
fileSize = 14 + 40 + pixelDataSize

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:

padding = (4 βˆ’ (w Γ— 3) mod 4) mod 4

Base64 decoded byte length from string length:

byteLength = 34 Γ— len βˆ’ paddingChars

Where len = Base64 string length and paddingChars = number of trailing = characters (0, 1, or 2).

Reference Data

PropertyBMP SpecificationDetails
File Signature0x42 0x4DASCII "BM" - identifies file as BMP
File Header Size14 bytesContains file size, reserved fields, pixel data offset
DIB Header (BITMAPINFOHEADER)40 bytesWidth, height, color depth, compression method
Bits Per Pixel (24-bit)24 bpp3 bytes per pixel: Blue, Green, Red (no alpha)
Bits Per Pixel (32-bit)32 bpp4 bytes per pixel: Blue, Green, Red, Alpha
Pixel OrderBottom-to-TopFirst row in file is bottom row of image
Channel OrderBGR / BGRAReverse of web-standard RGBA
Row Padding4-byte alignedEach row padded with 0x00 bytes to multiple of 4
Compression (BI_RGB)0No compression - raw pixel storage
Color Planes1Always 1 for BMP
Horizontal Resolution2835 px/m~72 DPI standard screen resolution
Vertical Resolution2835 px/m~72 DPI standard screen resolution
Max Base64 Input Ratio4:3Every 4 Base64 chars encode 3 bytes of binary
Base64 Charset64 charactersA - Z, a - z, 0-9, +, / with = padding
Max Image Dimension65535 Γ— 65535 pxPractical limit due to memory constraints
MIME Type (BMP)image/bmpAlso accepted: image/x-ms-bmp
File Extension.bmpSometimes .dib for device-independent bitmap
EndiannessLittle-endianAll multi-byte integers stored little-endian
Color Table (24-bit)None24/32-bit BMPs skip color table entirely
Typical File Size (1920Γ—1080)~5.93 MB1920 Γ— 1080 Γ— 3 + headers + padding

Frequently Asked Questions

BMP uses no compression (BI_RGB mode). A 1920Γ—1080 image at 24 bpp requires exactly 1920 Γ— 1080 Γ— 3 = 6,220,800 bytes of pixel data plus row padding and 54 bytes of headers, totaling approximately 5.93 MB. PNG uses DEFLATE compression and JPEG uses lossy DCT - both produce significantly smaller files. The size increase is inherent to the BMP format, not a defect.
Standard 24-bit BMP stores only Blue, Green, and Red channels - no alpha. Any transparent or semi-transparent pixels from PNG or WebP sources are composited against a white background (RGB 255, 255, 255) before encoding. If you need alpha preservation, 32-bit BMP with BGRA ordering is required, though viewer support is inconsistent.
Both formats are accepted. The tool automatically detects and strips the data URI prefix if present. You can paste raw Base64 characters (e.g., iVBORw0KGgo...) or the full data URI (data:image/png;base64,iVBORw0KGgo...). Whitespace and line breaks in the input are also stripped automatically.
Browser memory is the practical limit. Canvas elements in modern browsers support dimensions up to approximately 16,384 Γ— 16,384 pixels (268 megapixels). For a 24-bit BMP, a 4000 Γ— 3000 image produces approximately 34.3 MB of pixel data. Base64 input strings up to roughly 50 MB (decoded) are accepted. Extremely large images may cause the browser tab to run out of memory.
The BMP format inherits its coordinate system from OS/2 and early Windows GDI, which used a Cartesian coordinate system with the origin at the bottom-left. When the height value in the DIB header is positive, rows are stored from the bottom scanline first. A negative height value signals top-down storage, but this variant has limited support in older software. This tool uses the standard positive-height, bottom-up orientation for maximum compatibility.
BMP does not support animation. If you supply a Base64-encoded animated GIF, only the first frame is rendered to the Canvas and converted. All subsequent frames are discarded. For multi-frame extraction, a dedicated GIF parser would be required.