JPEG, the standard's name, not the extension
- Input
- .jpg, .jpeg, .jpe
- Expected output
- image/jpeg
Every extension variant resolves to the same registered type; "image/jpg" simply does not exist in the IANA registry.
image mime types web webp avif
Five types cover most images on the web today: image/jpeg, image/png, image/webp, image/avif and image/svg+xml. Each name looks obvious until you notice none of them is simply the format's popular name: JPEG diverges from the more common .jpg extension, and SVG, being the only vector format on the list, behaves in a way the other four do not, because the file can contain code, not just pixels or vectors.
Every extension variant resolves to the same registered type; "image/jpg" simply does not exist in the IANA registry.
Despite competing for the same use, more efficient image compression than JPEG, the two have their own MIME types, neither one a subtype or variant of the other.
The same svg file with a <script> inside would run that code if opened directly in a browser tab or embedded via <object>, because the loading context changes what is allowed to run.
A MIME type (or media type) is a two-part identifier, type/subtype, that tells the receiver what format a piece of data is in. Originally created for email (Multipurpose Internet Mail Extensions, RFC 2045), it is now ubiquitous in HTTP, where the Content-Type header defines how the browser interprets content.
Because the MIME type was registered using the standard's name, JPEG (Joint Photographic Experts Group), with none of the character limit that forced the file extension to become .jpg on old DOS/FAT systems. The IANA registration never needed to shorten the name, so it stayed image/jpeg from the start, and no "image/jpg" was ever registered afterwards.
In most modern browsers, no: the <img> tag loads the SVG in a static-image context, which ignores <script> tags and event attributes. The risk appears when the same file is opened directly, embedded via <object> or <iframe>, or inserted as HTML inside the page, contexts where the SVG is treated as a document, not as an inert image.
No, and similar purpose does not imply a shared type: image/avif and image/webp are independent IANA registrations, each specific to its own container and codec, AV1 for AVIF and VP8 for WebP. A decoder that only recognises one of the two will not open the other, even if both are photos of the same subject.
Search by file extension or full MIME type