BMP MIME Type – Free, Online, Private
image/bmp is the registered type for a Windows bitmap. The file starts with BM.
What .bmp is
A BMP file starts with the ASCII letters BM. A file header follows, then a DIB header whose size field tells you which header variant you have: 40 bytes for BITMAPINFOHEADER, larger values for the later versions. Pixel rows are padded to four bytes and, in the common bottom-up layout, stored from the bottom of the image. BMP is usually uncompressed, which is why a screenshot in BMP is enormous compared with PNG. RFC 7903 registers image/bmp. image/x-ms-bmp is an unofficial alias.
IANA registers image/bmp in RFC 7903. The media type is image/bmp. Extensions that use it on this page: .bmp. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.
What sends image/bmp
What sends image/bmp: Send image/bmp if you must deliver a bitmap to a tool that rejects every other container. On the web, convert to PNG for a lossless screenshot or to JPEG, WebP, or AVIF for a photograph, and send that type instead. If an API accepts a BMP upload, detect BM before you store it, and consider converting at the edge so you do not serve uncompressed bitmaps from a public URL. Do not add a charset. The palette, when present, is binary. The file on disk is still .bmp. Once the response exists, a client trusts image/bmp, not the filename. The honest use of this type on a modern site is an upload or a download for a desktop tool, not a content image. When you convert, change the extension, the type, and the magic together. A .bmp URL that returns a PNG with image/png is fine if you intend the conversion and you do not claim the bytes are a bitmap.
Content-Type for .bmp
Send image/bmp and do not add a charset parameter. The body is binary. A charset tells a text decoder to reinterpret bytes that are not text, which corrupts a download and does not help a browser sniff the format.
Content-TypeContent-Type: image/bmp
nginx, Apache, and Express
These snippets map .bmp to image/bmp. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .bmp so a stale mime database in the framework cannot disagree with the type on this page.
nginx# /etc/nginx/mime.types, inside the types { } block
image/bmp bmp;
ApacheAddType image/bmp .bmp
Expressimport express from "express";
const app = express();
app.use(express.static("public", {
setHeaders(res, filePath) {
if (filePath.endsWith(".bmp")) {
res.setHeader("Content-Type", "image/bmp");
}
},
}));
Pitfalls for image/bmp
Pitfalls that show up for image/bmp, and not for a neighboring type with a similar extension: Some servers map .bmp to image/x-ms-bmp. Browsers often still show it. A client that allow-lists image/bmp will not. Standardize on the registered type. Another trap is a top-down BMP, signaled by a negative height, which a naive reader flips. A third is trusting the file-size field in the header over the actual body length. Truncated uploads parse as a successful type check and then crash the decoder. Compare the two lengths.
- OS/2 bitmaps use a smaller info header. They are still BMP if they start with BM, and they still use image/bmp.
- RLE compression is uncommon and easy to get wrong. If you do not need it, convert to PNG.
- A file that starts with BA, CI, or CP is not a device-independent bitmap this page is describing.
- Opening a BMP in a browser works. Serving thousands of them as page images will waste bandwidth. Convert.
Frequently asked questions
What does a BMP start with?
The two bytes 42 4D, which are BM, followed by the file size as a little-endian dword.
Is image/x-ms-bmp registered?
No. RFC 7903 registers image/bmp. Prefer that.
Should a website serve BMP?
Almost never for display. PNG is smaller and lossless. Keep BMP for tools that require it.
Is there a charset?
No. The header and pixels are binary.