About the BMP to Base64 Converter
Bitmaps turn up in places that never moved on: Windows resource files, scanner and fax output, industrial control software, and the icon assets bundled with older desktop applications. When one of those has to be embedded in XML, in a database column or in a signed manifest, Base64 is the format that gets it there intact.
BMP stores pixels uncompressed, so the files are large by modern standards and Base64 adds a further third. A 200 by 200 pixel bitmap at 24 bits per pixel is already about 120 kilobytes before encoding. That is fine for a resource blob but poor for a web page, where converting to PNG first would cut the payload dramatically with no visible difference.
The file is identified from the two byte BM signature at the start rather than from its name, and the bytes are copied without any conversion, so the colour depth, the palette and any bottom up row order are preserved exactly. Files saved with the .dib extension are accepted too, since they share the same layout.
Output can be a data URI, a CSS declaration, an img tag, a Markdown image or a JSON object with the metadata. Decode a bitmap string with Base64 to Image, or start from a smaller source using PNG to Base64.
How to use
- Choose or drop a
.bmpor.dibfile. - Pick the wrapper you need in the Output as list.
- Copy the encoded string, or download it as a text file for a build step.
Common questions
- Do browsers display a BMP data URI?
- Modern browsers do render image/bmp, but the payload is far larger than an equivalent PNG, so PNG is the better web choice.
- Is the colour palette preserved?
- Yes. The whole file is encoded unchanged, so 8 bit palettes and 32 bit colour both survive.
- Are .dib files accepted?
- Yes. A device independent bitmap uses the same structure and is encoded the same way.
- Why is my bitmap so much larger than a JPEG of the same picture?
- BMP stores every pixel uncompressed, while JPEG compresses. Base64 then adds a third to whichever you start from.