DevToolsmith

WEBP MIME Type

image/webp is the MIME type for WebP images. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
image/webp
Extensions
.webp
Content-Type header
image/webp
Registered
Yes, with IANA
Compress with gzip
No, it is already compressed
Category
Images

About WebP image files

Supported by every current browser, usually 25–35% smaller than JPEG at similar quality, with transparency and animation. Serve it with <picture> and a JPEG or PNG fallback if you still support very old Safari versions (before 14).

File signature

WEBP files start with "RIFF", then "WEBP" at byte 8. 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 .webp with the right Content-Type

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

Set the type in code

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

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

Accept .webp uploads

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

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

  • .avif (image/avif): AVIF image
  • .jpg (image/jpeg): JPEG image
  • .png (image/png): PNG image
  • .gif (image/gif): GIF image

More images

.heic , .ico , .bmp , .tiff . 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 .webp files?

image/webp. The full header is "Content-Type: image/webp".

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

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .webp 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 WEBP?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. WEBP files start with "RIFF", then "WEBP" at byte 8. The MIME type lookup on this site reads them for you when you drop a file on it.