Binary Values to Bitmap Converter
Convert binary values (0s and 1s) to BMP bitmap image files. Visualize binary grids as pixel art and download real .bmp files instantly.
About
A bitmap image at its most fundamental level is a grid of binary pixel states. This tool performs direct conversion from raw binary values (0 and 1) into a valid BMP file conforming to the Windows BITMAPINFOHEADER specification. Each 1 maps to a foreground pixel and each 0 maps to a background pixel. The output is a genuine 24-bit uncompressed BMP file constructed byte-by-byte in the browser, not a screenshot or canvas export. Incorrect row padding or inverted scanline order will produce a corrupted file that image viewers reject. This tool handles the padding calculation (rows must align to 4-byte boundaries) and bottom-up row ordering automatically.
Use cases include QR code prototyping, sprite design, font glyph creation, and visualizing binary data streams from embedded systems or memory dumps. The tool approximates ideal conversion assuming a rectangular grid. If your input rows have unequal lengths, shorter rows are right-padded with 0. Maximum supported resolution is 1024×1024 pixels. Pro tip: paste raw binary output from microcontroller UART logs directly. The parser strips common delimiters (commas, spaces, pipes) automatically.
Formulas
The BMP file size is computed from the image dimensions and the 24-bit pixel format. Each pixel occupies 3 bytes (BGR). Each row must be padded to a 4-byte boundary.
Where W = image width in pixels, H = image height in pixels. The constant 54 is the combined header size (14-byte file header + 40-byte DIB header). Scanlines are stored bottom-to-top: the first row in the pixel data block corresponds to the bottom row of the displayed image. Each pixel is stored in BGR order (blue byte first, then green, then red), not RGB.
Reference Data
| BMP Field | Offset (bytes) | Size (bytes) | Value / Description |
|---|---|---|---|
| Signature | 0 | 2 | 0x42 0x4D ("BM") |
| File Size | 2 | 4 | Total bytes: header + pixel data |
| Reserved | 6 | 4 | 0x00000000 |
| Pixel Data Offset | 10 | 4 | 54 (14 + 40) |
| DIB Header Size | 14 | 4 | 40 (BITMAPINFOHEADER) |
| Image Width | 18 | 4 | Pixels (signed 32-bit) |
| Image Height | 22 | 4 | Pixels (positive = bottom-up) |
| Color Planes | 26 | 2 | 1 |
| Bits Per Pixel | 28 | 2 | 24 (RGB, no alpha) |
| Compression | 30 | 4 | 0 (BI_RGB, uncompressed) |
| Image Data Size | 34 | 4 | rows × (width × 3 + padding) |
| H Resolution | 38 | 4 | 2835 px/m (~72 DPI) |
| V Resolution | 42 | 4 | 2835 px/m (~72 DPI) |
| Colors Used | 46 | 4 | 0 (all colors) |
| Important Colors | 50 | 4 | 0 |
| Row Padding | - | 0-3 | (4 − (w × 3) mod 4) mod 4 |
| Pixel Order | - | - | BGR (Blue, Green, Red) per pixel |
| Scanline Order | - | - | Bottom row first (inverted) |
| Max Width (this tool) | - | - | 1024 pixels |
| Max Height (this tool) | - | - | 1024 pixels |
| Typical 8×8 File Size | - | - | 250 bytes |
| Typical 32×32 File Size | - | - | 3,126 bytes |
| Typical 256×256 File Size | - | - | 196,662 bytes |