Pretty simple question but can't seem to find it anywhere online. I'm trying to make a program that depending on the file type will give me the extension.
-
14AFAIK there is only the type "image/jpeg" http://www.freeformatter.com/mime-types-list.html#mime-types-list – Dale Nov 13 '15 at 12:34
-
http://stackoverflow.com/questions/23424399/jpg-vs-jpeg-image-formats – Danil Gudz Nov 13 '15 at 12:35
-
Must be late night confusion then. I'm going to just give it a try with "image/jpeg". – Joe Scotto Nov 13 '15 at 12:36
-
Try also this read: https://www.keycdn.com/support/difference-between-jpg-and-jpeg – Jeffz Dec 30 '20 at 08:30
4 Answers
No, image/jpg
is not the same as image/jpeg
.
You should use image/jpeg
. Only image/jpeg
is recognised as the actual mime type for JPEG files.
See https://www.rfc-editor.org/rfc/rfc3745, https://www.w3.org/Graphics/JPEG/ .
Serving the incorrect Content-Type of image/jpg
to IE can cause issues, see http://www.bennadel.com/blog/2609-internet-explorer-aborts-images-with-the-wrong-mime-type.htm.

- 1
- 1

- 9,297
- 1
- 26
- 22
-
2THE principal problem caused by this is that Safari will open an image link in Preview instead of in the browser window because it thinks it's an unknown image type (which technically, it is). – Peter Flynn Apr 30 '19 at 22:23
-
1If you develop iOS apps using WkWebview, the image will display as text on iOS 15 if you use image/jpg for the MIME type. Using image/jpeg resolves the issue. – Gjchoza Sep 26 '21 at 18:04
-
Worth to mention than `.jpg` and `.jpeg` are extensions for same format type: JPEG. The reason `.jpg` exists is that earlier versions of Windows require three letter extension. For MIME there is no such limitation, so there is only one mime type for JPEG images: `image/jpeg`. This mime does not exists: `image/jpg`. – Eugen Konkov Nov 20 '22 at 21:30
tl;dr There is no MIME type image/jpg
; there is image/jpeg
. However, there is much variation in official documented mappings between files with file name extension .jpg
and MIME types. But in practice, nearly all software handles image files named *.jpg
in an expected manner
This particular topic is confusing because the varying association of file name extension associated to a MIME type depends which organization created the table of file name extensions to MIME types. In other words, file name extension .jpg
could be many different things, "officially" (but in practice is always a JPEG image).
For example, here are three "complete lists" and one RFC that with varying JPEG Image format file name extensions and the associated MIME types.
- sitepoint.com The Complete List of MIME Types archived
.jfif
,.jfif-tbnl
,.jpe
,.jpeg
,.jpg
→image/jpeg
.jfif
,.jpe
,.jpeg
,.jpg
→image/pjpeg
- freeformatter.com MIME Types List archived
.jpeg
,.jpg
→image/jpeg
.jpeg
,.jpg
→image/x-citrix-jpeg
.pjpeg
→image/pjpeg
- IANA Media Types archived
(this document uses phrase "Media Types" instead of "MIME Types")
(this document lists "names", not "file name extensions")jpg
not mentionedjpeg
→ see RFC 2045 (no mention), see RFC 2046 →image/jpeg
13JPEG
→video/JPEG
jpeg2000
→video/jpeg2000
jpm
→image/jpm
(JPEG 2000)jpx
→image/jpx
(JPEG 2000)vnd.sealedmedia.softseal.jpg
→image/vnd.sealedmedia.softseal.jpg
- RFC 3745 MIME Type Registrations for JPEG 2000 (ISO/IEC 15444) **
These "complete lists" and RFC do not have MIME type image/jpg
! But for MIME type image/jpeg
some lists do have varying file name extensions (.jpeg
, .jpg
, …). Other lists do not mention MIME type image/jpeg
.
Also, there are different types of JPEG Image formats (e.g. Progressive JPEG Image format, JPEG 2000, etcetera) and "JPEG Extensions" that may or may not overlap in file name extension and declared MIME type.
Another confusing thing is RFC 3745 does not appear to match IANA Media Types yet the same RFC is supposed to inform the IANA Media Types document. For example, in RFC 3745 .jpf
is preferred file extension for image/jpx
but in IANA Media Types the name jpf
is not present (and that IANA document references RFC 3745!).
Another confusing thing is IANA Media Types lists "names" but does not list "file name extensions". This is on purpose, but confuses the endeavor of mapping file name extensions to MIME types.
Another confusing thing: is it "mime", or "MIME", or "MIME type", or "mime type", or "mime/type", or "media type"⁉
The most official seeming document by IANA is surprisingly inadequate. No MIME type is registered for file extension .jpg
yet there exists the odd vnd.sealedmedia.softseal.jpg
. File extension.JPEG
is only known as a video
type while file extension .jpeg
is an image type (when did lowercase and uppercase letters start mattering!?). At the same time, jpeg2000
is type video
yet RFC 3745 considers JPEG 2000 an image
type! The IANA list seems to cater to company-specific jpeg formats (e.g. vnd.sealedmedia.softseal.jpg
).
In summary...
Because of the prior confusions, it is difficult to find an industry-accepted canonical document that maps file name extensions to MIME types (and vice-versa), particularly for the JPEG Image File Format.
** RFC 3745 reads
This document is not related to the definition of the MIME sub-type image/jpeg, which is partly defined by [ISO-JPEG-1], and partly by the file format specification defined in [JFIF].
- Specification
JFIF
(JPEG File Interchange Format) does not mention any MIME types or file name extensions. - Specification
ISO-JPEG-1
(ISO/IEC 10918-1:1994) requires a fair amount of money to view.
Related question "List of ALL MimeTypes on the Planet, mapped to File Extensions?".

- 6,169
- 7
- 37
- 63
-
2usually there is only ONE source describing the regarding standard, not 4 (!). RFC is a good entry point! – simUser May 11 '20 at 07:46
The important thing to note here is that the mime type is not the same as the file extension. Sometimes, however, they have the same value.
https://www.iana.org/assignments/media-types/media-types.xhtml includes a list of registered Mime types, though there is nothing stopping you from making up your own, as long as you are at both the sending and the receiving end. Here is where Microsoft comes in to the picture.
Where there is a lot of confusion is the fact that operating systems have their own way of identifying file types by using the tail end of the file name, referred to as the extension. In modern operating systems, the whole name is one long string, but in more primitive operating systems, it is treated as a separate attribute.
The OS which caused the confusion is MSDOS, which had limited the extension to 3 characters. This limitation is inherited to this day in devices, such as SD cards, which still store data in the same way.
One side effect of this limitation is that some file extensions, such as .gif
match their Mime Type, image/gif
, while others are compromised. This includes image/jpeg
whose extension is shortened to .jpg
. Even in modern Windows, where the limitation is lifted, Microsoft never let the past go, and so the file extension is still the shortened version.
Given that that:
- File Extensions are not File Types
- Historically, some operating systems had serious file name limitations
- Some operating systems will just go ahead and make up their own rules
The short answer is:
- Technically, there is no such thing as
image/jpg
, so the answer is that it is not the same asimage/jpeg
- That won’t stop some operating systems and software from treating it as if it is the same
While we’re at it …
Legacy versions of Internet Explorer took the liberty of uploading jpeg
files with the Mime Type of image/pjpeg
, which, of course, just means more work for everybody else. They also uploaded png
files as image/x-png
.

- 14,066
- 10
- 88
- 110