BMP to Base64 Converter

Encode Windows bitmap (.bmp) files as Base64. Because BMP is usually uncompressed, you can convert it to PNG, JPEG or WebP first for a much shorter result.

Runs entirely in your browser. Nothing is uploaded.

How to use

  1. Drop a .bmp file onto the drop area, click to choose one, or paste an image.
  2. Choose PNG as the target format for a lossless and much smaller result, or keep BMP if the receiving system requires it.
  3. Compare the original size with the encoded size to see the saving.
  4. Copy or download the result as a data URI, raw Base64, img tag, CSS rule or Markdown image.

What is a BMP file?

BMP is the Windows device-independent bitmap format. It stores pixels row by row, almost always without compression (a simple run-length mode exists for 4-bit and 8-bit images). The MIME type is image/bmp, though some systems report image/x-ms-bmp, and the Base64 output starts with Qk, the encoded letters BM.

Without compression, the size follows directly from the dimensions. A 24-bit image of 800 by 600 pixels needs about 1.4 MB, and its Base64 is close to 1.9 MB of text.

Convert to PNG before encoding

PNG is lossless as well, so a typical 24-bit bitmap converted to PNG keeps its pixels exactly while the file shrinks, often several times over and far more for screenshots and flat graphics. For photos that were saved as BMP, JPEG or WebP at a good quality gives an even shorter string. The original and encoded sizes shown for each image make the difference easy to see.

When to keep the original BMP

Some receivers expect a real bitmap: older Windows software, label and receipt printers, small displays driven by microcontrollers, or test fixtures that must match a file byte for byte. In those cases leave conversion off; the Base64 output is then an exact copy of the file. All major browsers can display data:image/bmp images, but for web pages and email PNG is the better format.

The same conversion in a script, using Python and Pillow:

from PIL import Image
import base64, io

buf = io.BytesIO()
Image.open('scan.bmp').save(buf, 'PNG')
uri = 'data:image/png;base64,' + base64.b64encode(buf.getvalue()).decode()

Frequently asked questions

Why is my BMP Base64 string so long?

BMP stores every pixel without compression, and Base64 adds another third on top. Converting to PNG first usually shortens the string dramatically without losing any detail.

Does converting BMP to PNG lose quality?

No. PNG is a lossless format, so the pixels stay the same. Only the way they are stored changes.

Can browsers display a data:image/bmp URI?

Yes, Chrome, Edge, Firefox and Safari all display BMP. Email clients and many online platforms handle it less reliably, so PNG is the safer choice there.

Does BMP support transparency?

A 32-bit BMP can store an alpha channel, but programs and browsers treat it inconsistently. If you need transparency, convert to PNG or WebP.