BMP to Base64 Converter
Convert BMP image files to Base64 encoded strings instantly in your browser. Supports data URI output, line wrapping, and batch processing.
Drop BMP file here or click to browse
Supports .bmp files up to 50 MB
Preview
Base64 Output
About
BMP (Bitmap) files store pixel data uncompressed, producing large file sizes that complicate embedding in HTML, CSS, or JSON payloads. Converting a BMP to Base64 encodes the binary data as an ASCII string using a 6-bit alphabet (64 characters: A - Z, a - z, 0 - 9, +, /). The output is approximately 33% larger than the source because every 3 input bytes map to 4 output characters. This tool performs the conversion entirely in your browser using the native FileReader API. No data leaves your machine.
Incorrect Base64 encoding breaks inline images, corrupts API payloads, and triggers CORS failures in production. A common mistake is omitting the Data URI prefix (data:image/bmp;base64,) when embedding in <img> tags, or including it when the backend expects raw Base64. This converter handles both cases explicitly. Note: BMP files lack compression. For web embedding, consider converting to PNG or WebP first if bandwidth matters. This tool approximates final string size before conversion so you can verify payload limits.
Formulas
The Base64 encoding maps every group of 3 input bytes to 4 output ASCII characters. The output length is computed as:
Where Lin = file size in bytes, Lout = Base64 string length in characters. The size overhead ratio is:
This means a 1MB BMP file produces approximately 1.33MB of Base64 text. When the Data URI prefix data:image/bmp;base64, (22 characters) is included, the total becomes Lout + 22. BMP file validity is confirmed by checking the first 2 bytes equal 0x42 0x4D (ASCII "BM"). The pixel data offset is read from bytes 10 - 13 as a 32-bit little-endian integer.
Reference Data
| Property | BMP Format Detail | Base64 Impact |
|---|---|---|
| Magic Bytes | 0x42 0x4D ("BM") | Validated before conversion |
| Bit Depth: 1-bit | Monochrome, palette-indexed | Smallest output per pixel |
| Bit Depth: 4-bit | 16 colors, palette-indexed | ~33% larger than source |
| Bit Depth: 8-bit | 256 colors, palette-indexed | ~33% larger than source |
| Bit Depth: 16-bit | High color, 65,536 colors | Moderate Base64 size |
| Bit Depth: 24-bit | True color, 16.7M colors | Large Base64 output |
| Bit Depth: 32-bit | True color + alpha channel | Largest Base64 output |
| Compression: BI_RGB | No compression (most common) | Direct byte-to-Base64 mapping |
| Compression: BI_RLE8 | Run-length encoding, 8-bit | Smaller source, smaller output |
| Compression: BI_RLE4 | Run-length encoding, 4-bit | Smaller source, smaller output |
| Max File Size (practical) | ~50MB in-browser | ~66.7MB Base64 string |
| MIME Type | image/bmp or image/x-bmp | Used in Data URI prefix |
| Data URI Prefix | N/A | data:image/bmp;base64, |
| Base64 Alphabet | N/A | A-Z a-z 0-9 + / = padding |
| Encoding Ratio | 3 bytes input | 4 characters output |
| Padding | BMP rows padded to 4-byte boundary | = or == appended if needed |
| Header Size (BITMAPINFOHEADER) | 54 bytes minimum | 72 Base64 characters |
| Endianness | Little-endian | Preserved in Base64 encoding |
| Color Space (v5) | sRGB / calibrated RGB | Metadata preserved in binary |
| Browser Support | Universal (all browsers) | FileReader API: IE10+ |