Binary Values to Bitmap Converter

Hand-builds a real, valid monochrome .bmp file from a binary digit string — a correct 14-byte file header, 40-byte DIB header, and bit-packed pixel data with proper row padding — and offers it for download. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Most "binary to image" tools just paint pixels on a canvas and export whatever format the browser defaults to — this one instead builds the actual bytes of a real BMP file.

Given a string of binary digits and a target width, it assembles a correct, spec-compliant monochrome bitmap you can download and open in any image viewer.

What Is Binary Values to Bitmap Converter?

A generator that packs a binary digit string into a genuine 1-bit-per-pixel (monochrome) .bmp file, with every header field and byte offset computed to match the real BMP format.

It's a hand-rolled binary file writer, not a canvas-to-PNG exporter — the bytes it produces are the literal BMP file format, header and all.

How Binary Values to Bitmap Converter Works

Height is computed from the bit count and chosen width (`ceil(bitCount / width)`), and each image row is packed into bytes MSB-first, then padded with zero bits so every row occupies a whole number of bytes rounded up to a multiple of 4 — a hard BMP requirement.

The file is assembled in the exact BMP byte order: a 14-byte BITMAPFILEHEADER (magic "BM", file size, pixel data offset), a 40-byte BITMAPINFOHEADER (width, height, bits-per-pixel), an 8-byte 2-color (black/white) palette, then the pixel rows written bottom-up as the format requires.

When To Use Binary Values to Bitmap Converter

Use it when you need an actual .bmp file from binary data — for testing a BMP parser, a file-format assignment, or embedded/legacy software that only reads BMP.

It's also a way to visualize a bit pattern as a real, shareable, openable image file rather than just an on-screen preview.

Features

Advantages

  • Produces a byte-correct BMP file, not a browser-default export — every header field is computed and written explicitly.
  • Handles BMP's mandatory 4-byte row padding automatically, so the file opens correctly in strict readers.
  • Fully client-side; the file never leaves your browser before download.

Limitations

  • Only produces 1-bit-per-pixel monochrome images (black/white), not grayscale or full color.
  • Capped at 4,000,000 total pixels (width × height) to avoid building a pathologically large file in the browser.

Examples

A single 8-pixel row

Input

10110010 (width 8)

Output

Downloads binary-values.bmp — a 66-byte BMP (62-byte header/palette + 1 padded 4-byte pixel row), with pixel byte 0xB2 (10110010) followed by 3 padding zero bytes.

8 bits at width 8 make exactly 1 row; 1 unpadded byte of pixel data (0xB2) is padded out to 4 bytes as BMP rows require.

Two rows showing bottom-up storage

Input

11110000 (width 4)

Output

Downloads a 70-byte BMP, 4×2 pixels; the file's first pixel row (stored bottom-up) is all-white (0x00), and its second (last-written) row is 0xF0 (the top image row, 1111).

8 bits at width 4 need 2 rows; the top logical row ("1111") is written LAST in the file because BMP stores rows bottom-up when height is positive.

Best Practices & Notes

Best Practices

  • Choose a width that evenly divides your bit count to avoid an oddly padded final row.
  • Open the downloaded file in an image viewer to confirm the pixel pattern looks as expected before relying on it elsewhere.

Developer Notes

Writes directly into a `Uint8Array`/`DataView` at hand-computed byte offsets (14-byte file header, 40-byte DIB header, 8-byte palette, then row-padded pixel data) rather than using any canvas or image-encoding API, since the goal is the literal BMP file format rather than a rasterized preview.

Binary Values to Bitmap Converter Use Cases

  • Generating real BMP test fixtures for a binary file parser or file-format assignment
  • Producing a genuinely openable image file from a hand-crafted or generated bit pattern
  • Learning the BMP file format's exact byte layout by inspecting a real generated example

Common Mistakes

  • Assuming this is the same as the Binary to Image Converter's canvas/PNG preview — this tool writes real BMP bytes, including headers, not a PNG.
  • Forgetting that BMP rows are padded to 4-byte boundaries, which is why file size doesn't scale as a clean "1 bit per pixel" count.

Tips

  • Use a width that's a multiple of 32 (4 bytes × 8 bits) to avoid any row padding at all.
  • Round-trip your generated file through the Bitmap to Binary Converter to confirm the bits you get back match your intent (allowing for its 1-bit-per-pixel thresholding).

References

Frequently Asked Questions