DevToolsmith

BMP MIME Type

image/bmp is the MIME type for BMP (Windows bitmap) images. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
image/bmp
Extensions
.bmp, .dib
Content-Type header
image/bmp
Registered
Yes, with IANA
Compress with gzip
Yes, it is text or uncompressed
Category
Images

About BMP image files

Usually uncompressed, so a screenshot as BMP can be ten times the size of the same PNG. Browsers display it, but there is no reason to serve BMP on the web; convert it to PNG.

Other types seen for these files: image/x-ms-bmp . Accept them when reading uploads, but send image/bmp yourself.

File signature

BMP files start with 42 4D ("BM"). The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .bmp with the right Content-Type

Response header
Content-Type: image/bmp
nginx (a line in the types { } block of mime.types)
image/bmp bmp dib;
Apache (.htaccess or server config)
AddType image/bmp .bmp .dib
Caddy
@bmp path *.bmp *.dib
header @bmp Content-Type "image/bmp"
Check what a server sends
curl -sI https://example.com/file.bmp | grep -i '^content-type'
# Content-Type: image/bmp

Set the type in code

Node.js (Express)
res.set('Content-Type', 'image/bmp');
// Or make the browser download it:
res.attachment('file.bmp');
Python
import mimetypes

mimetypes.add_type('image/bmp', '.bmp')  # if your system doesn't know it
mimetypes.guess_type('file.bmp')[0]  # 'image/bmp'
Go
mime.AddExtensionType(".bmp", "image/bmp")
w.Header().Set("Content-Type", "image/bmp")

Accept .bmp uploads

HTML
<input type="file" accept=".bmp,.dib,image/bmp">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .png (image/png): PNG image
  • .jpg (image/jpeg): JPEG image
  • .tiff (image/tiff): TIFF image

More images

.gif , .webp , .avif , .heic , .ico . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .bmp files?

image/bmp. You may also see image/x-ms-bmp, which is older or unofficial; send image/bmp. The full header is "Content-Type: image/bmp".

Why does my server send the wrong Content-Type for .bmp?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .bmp is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is BMP?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. BMP files start with 42 4D ("BM"). The MIME type lookup on this site reads them for you when you drop a file on it.