.jpg MIME type
JPEG imageimages
image/jpegLossy photographic images. The type is image/jpeg for both .jpg and .jpeg.
| MIME type | image/jpeg |
|---|---|
| Extensions | .jpg, .jpeg, .jpe |
| Content-Type | image/jpeg |
| Compress in transit? | No — already compressed |
| File signature | FF D8 FF (ÿØÿ) |
Good to know
image/jpgis not a registered type. Some software sends it; accept it on upload, but always serveimage/jpeg.- JPEG has no transparency; use PNG, WebP or AVIF if you need it.
Serve .jpg files with the right type
The response header to send:
Content-Type: image/jpeg
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
image/jpeg jpg jpeg jpe;
Apache (.htaccess or server config)
AddType image/jpeg .jpg .jpeg .jpe
Express
res.set("Content-Type", "image/jpeg");Python
import mimetypes
mimetypes.add_type("image/jpeg", ".jpg")
mimetypes.add_type("image/jpeg", ".jpeg")
mimetypes.add_type("image/jpeg", ".jpe")HTML file input
<input type="file" accept=".jpg,.jpeg,.jpe,image/jpeg">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.jpg | grep -i '^content-type:' file --mime-type file.jpg
Frequently asked questions
What is the MIME type for .jpg files?
image/jpeg. The same type covers .jpeg, .jpe.
What Content-Type header should a .jpg file be served with?
Content-Type: image/jpeg. It's already compressed, so servers shouldn't gzip it.
How can I tell if a file is really a .jpg?
Check its bytes rather than the extension: JPG files start with FF D8 FF. On the command line, file --mime-type name.jpg does this for you.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options