File Formats
What Is BMP? The Bitmap Format Explained
BMP is Windows' uncompressed, lossless bitmap format. We explain its header structure, color depths, limitations and how to make the files smaller.
Author: Hemen Dönüştür Editör EkibiPublished: 8 min read

BMP is one of the oldest and simplest image formats in the Windows world. A BMP file usually writes pixels to disk row by row without any compression at all. That simplicity makes it easy to read and lossless, and the same simplicity makes the files enormous. This article covers where BMP came from, what is inside the file, the details of color depth and transparency, where you still run into it today and how to convert BMP files into more practical formats.
What is BMP?
BMP (bitmap, extension .bmp) is a raster, pixel-based image file format. Technical documentation also calls it a DIB, a device-independent bitmap. "Device-independent" means the image can be interpreted the same way regardless of the graphics card or printer it was created on: the file carries the information needed to decode its colors in its own header and color table.
According to Microsoft's Win32 documentation, a bitmap file starts with a BITMAPFILEHEADER structure, followed by a BITMAPINFOHEADER, BITMAPV4HEADER or BITMAPV5HEADER, then an optional color table and finally the pixel data. The MIME type is image/bmp.
A short history: from Windows and OS/2 to today
BMP came out of joint work by Microsoft and IBM on Windows and OS/2 in the late 1980s. Bitmaps in the Windows 1.0 era depended heavily on the output device; the device-independent form became widespread with Windows 3.0 in 1990. The 12-byte BITMAPCOREHEADER defined for OS/2 Presentation Manager is why people still talk about "OS/2 BMP" files.
Over the years the format was extended by adding fields to the end of the header. According to the Library of Congress format description, version 5 arrived with Windows 98 in 1998 and made it possible to record ICC color profiles in the file. The common header sizes today are:
| Header | Size | Main addition |
|---|---|---|
| BITMAPCOREHEADER | 12 bytes | Basic structure compatible with OS/2 1.x |
| BITMAPINFOHEADER | 40 bytes | The most common header, from Windows 3.0; compression and resolution fields |
| BITMAPV4HEADER | 108 bytes | Color masks, an alpha mask and color space information |
| BITMAPV5HEADER | 124 bytes | Embedded or linked ICC profiles, rendering intent |
Readers detect which header is in use from the size value in its first field. That lets older software ignore the newer fields and still read the basics.
Inside a BMP file
File header and the "BM" signature
Every BMP file starts with a 14-byte file header, and its first two bytes are the ASCII characters BM (hex 42 4D). The header stores the total file size and the byte offset where the pixel data begins. A DIB placed on the Windows clipboard (the CF_DIB format) omits these 14 bytes and starts directly with the info header.
Info header
The info header holds the width, height, bits per pixel (biBitCount), compression type, horizontal and vertical resolution (in pixels per meter) and the number of colors used in the color table.
Color table (palette)
In images of 8 bits per pixel or less, a pixel is not a color but an index into the color table. In Microsoft's documented example, a 32x32 bitmap with 16 colors has a pixel array of 32 x 32 x 4 = 4096 bits, because 4 bits are enough to address 16 colors.
Pixel data: bottom-up rows and 4-byte alignment
BMP has two unusual traits. First, if the height is positive, rows are stored bottom-up: the first row in the file is the bottom row of the picture. A negative height stores rows top-down, but such images cannot be compressed. Second, every row is padded to a multiple of 4 bytes. Microsoft gives the row length (stride) as:
stride = ((width * bitCount + 31) & ~31) >> 3
imageSize = |height| * stride
For a 1920x1080 image at 24 bits, each row is 1920 x 3 = 5,760 bytes (already a multiple of 4), so the pixel data is 5,760 x 1,080 = 6,220,800 bytes. With the 54-byte headers the file is about 6.2 MB. The same picture as a JPG is usually a small fraction of that.
Color depth, compression and transparency
The BITMAPV5HEADER documentation defines 1, 4, 8, 16, 24 and 32 bits per pixel (a value of 0 means the depth comes from embedded JPEG or PNG data). 1 bit is black and white, 4 bits is 16 colors and 8 bits is a 256-color palette. At 24 bits each pixel is three bytes in blue, green, red order.
The compression field can take these values:
- BI_RGB: Uncompressed. In practice the vast majority of BMP files.
- BI_RLE8 and BI_RLE4: Simple run-length encoding for 8-bit and 4-bit palette images. Useful for large flat areas, almost useless for photos.
- BI_BITFIELDS: Not compression; masks define where the red, green and blue bits sit in 16-bit and 32-bit pixels (for example RGB 565).
- BI_JPEG and BI_PNG: Allow JPEG or PNG data inside the bitmap. Rarely supported by general-purpose viewers.
Transparency is BMP's most inconsistent area. The alpha mask in V4 and V5 headers can define the fourth byte of a 32-bit pixel as opacity, but in a classic 32-bit BMP that byte is described as unused and many programs ignore it. So a 32-bit BMP that looks transparent in one program and sits on black in another is nothing unusual. If you need transparency, PNG is the far safer choice.
Support across systems, browsers and software
BMP opens almost everywhere. The built-in Windows viewers and Paint, macOS Preview and common Linux viewers all read it. MDN's image format guide lists BMP support in all versions of Chrome, Edge, Firefox, Opera and Safari. The same guide also stresses that uncompressed BMP files are very large compared with PNG or JPG and should generally be avoided for website content.
Where is BMP used today?
- Windows application resources and legacy software: Toolbar images, installer wizard graphics and some game assets are still BMP.
- Embedded systems and microcontrollers: A device with a display needs no JPEG decoder; pixel data can be copied straight to the screen.
- Industrial cameras, scanners and test tools: When raw, lossless output is needed, BMP is a simple intermediate format.
- Teaching: With a header of only a few dozen bytes, BMP is often the first format students read and write in image processing courses.
Strengths and weaknesses
| Strengths | Weaknesses |
|---|---|
| Lossless; pixel values never change | Uncompressed, so files are very large |
| Trivial to read and write, no CPU cost | Inconsistent transparency support |
| Opens in nearly every operating system and browser | Weak metadata support (EXIF, descriptions) |
| Palette modes suit low-resource devices | Impractical for the web, e-mail and upload forms |
Common problems and how to fix them
The file is too big for e-mail or an upload form
This is the most common issue. For photos and scans, converting BMP to JPG usually cuts the size by an order of magnitude or more. For screenshots, diagrams or anything with text, converting BMP to PNG is better: PNG is lossless too but compressed, and it does not add the noise JPG creates around sharp edges.
A 32-bit BMP shows a black background
The program does not recognize or misreads the alpha byte. Converting to PNG usually fixes it. When converting to JPG, which has no transparency, transparent areas are filled with white or a color you pick.
The image is upside down or skewed
In a reader you wrote yourself this usually comes from two mistakes: ignoring that rows are stored bottom-up, or not skipping the padding bytes at the end of each row. Using the stride formula above and checking the sign of the height prevents both.
A program refuses to open a BMP
BMP files with RLE compression, BI_BITFIELDS or embedded JPEG/PNG data are not supported by some simple readers. Re-saving as an uncompressed 24-bit BMP or converting to PNG removes the compatibility problem.
Conversion tips
- JPG for photos, PNG for graphics: The usual rule applies when leaving BMP. For the web you can also pick WebP or AVIF in the image converter.
- Keep quality high: Because BMP is lossless, 85-90% JPG quality gives a result that is hard to tell apart from the original.
- Shrink if needed: If the file is still large, reduce the pixel dimensions or use compress image to reach a target size.
- Going the other way: If an embedded device or legacy program needs BMP, choose BMP as the target in the image converter. Our tools write a standard uncompressed 24-bit BMP; transparent areas are flattened onto the background color you choose.
Our BMP conversion pages run in your browser: the file is not uploaded and never leaves your device.
Frequently Asked Questions
Are BMP and DIB the same thing?
In practice, yes. A DIB is the device-independent bitmap structure Windows uses in memory and on the clipboard; a BMP file is that structure with a 14-byte file header in front.
Is BMP lossless?
Yes. Uncompressed and RLE-compressed BMP files keep pixel values exactly. The only exception is the rare BMP with embedded JPEG data.
Does converting BMP to PNG lose quality?
No. PNG is lossless as well; the image stays identical and only gets smaller because it is compressed.
Can I use BMP on a website?
Browsers display BMP, but the files are needlessly large and slow pages down. Use JPG, PNG, WebP or AVIF for the web.
Does BMP support transparency?
A 32-bit BMP can in theory carry an alpha channel, but software does not support it consistently. PNG is the safer choice whenever you need transparency.


