JPG MIME Type – Free, Online, Private
image/jpeg is the type for a JPEG image. .jpg is the three-letter spelling of that extension.
What .jpg is
JPEG is a lossy raster format aimed at photographs. The file starts with FF D8 and ends with FF D9. Between those markers, segments hold the quantization tables, the Huffman tables, and the compressed scans. EXIF metadata lives in an APP1 segment and can contain a thumbnail, a camera serial, and a GPS fix. The media type is image/jpeg for every spelling of the extension. image/jpg is not registered. This page is the .jpg spelling, which is what Windows and a lot of cameras write. The .jpeg spelling has its own page because servers that list only one of them create a split cache.
IANA registers image/jpeg in RFC 2046. The conventional extensions are .jpg, .jpeg, and .jpe. The media type is image/jpeg. Extensions that use it on this page: .jpg. 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/jpeg
What sends image/jpeg: Send image/jpeg whenever the signature is FF D8, including when the URL ends in .jpg. A photo CDN should use one canonical extension and redirect the other, or it should map both extensions to the same type and the same cache key. Do not add a charset. Progressive JPEG and baseline JPEG share the type. The difference is the scan structure, which a decoder handles. Set Content-Disposition only when you want a download. An img tag does not need it. The file on disk is still .jpg. Once the response exists, a client trusts image/jpeg, not the filename. The bytes are already compressed. Content-Encoding: gzip on a JPEG usually grows the response and wastes CPU. Leave the type as image/jpeg and skip a second compression layer. If you negotiate WebP or AVIF with Accept, the response type has to change with the bytes. A .jpg URL that returns image/webp will surprise a client that saved the URL and expected JPEG.
Content-Type for .jpg
Send image/jpeg 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/jpeg
nginx, Apache, and Express
These snippets map .jpg to image/jpeg. 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 .jpg 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/jpeg jpg;
ApacheAddType image/jpeg .jpg
Expressimport express from "express";
const app = express();
app.use(express.static("public", {
setHeaders(res, filePath) {
if (filePath.endsWith(".jpg")) {
res.setHeader("Content-Type", "image/jpeg");
}
},
}));
Pitfalls for image/jpeg
Pitfalls that show up for image/jpeg, and not for a neighboring type with a similar extension: Two mappings that disagree are the outage. nginx maps jpg to image/jpeg and a later application map sends image/jpg, and a client that switches on the full string misses the image. Pick image/jpeg. A second trap is stripping EXIF for privacy and leaving the orientation tag's effect unapplied, so the picture renders on its side. Apply the orientation, then drop the GPS if the picture is a user upload. A third is serving a PNG or a WebP under a .jpg URL because a converter failed open. The signature check is cheaper than the support ticket.
- JFIF and EXIF are both JPEG. The type does not change.
- .jpe is a third spelling some mail gateways used. Map it to image/jpeg if you still accept it.
- CMYK JPEG displays dark or inverted in browsers that expect RGB. Convert to RGB before you publish to the web.
- Restart markers and progressive scans are still image/jpeg. Do not invent a subtype for them.
Frequently asked questions
Is image/jpg valid?
No. The registered type is image/jpeg. image/jpg is a common typo and not an IANA type.
Do .jpg and .jpeg differ?
Only in the filename. Both are image/jpeg when the bytes are a JPEG. Keep a single canonical URL if you can.
What are the magic bytes?
FF D8 at the start and FF D9 at the end. A file that does not start with FF D8 is not a JPEG.
Should photographs stay PNG?
PNG is lossless and larger. JPEG, or a newer lossy type such as WebP or AVIF, is the usual choice for a photograph.