Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If the image I'm serving has the proper HTTP Content-Type is it also required that I have the image filename extension (JPG/PNG/GIF)?

Or can I just include the image in the page without?

share|improve this question
I'd keep the image file extensions, it'll help Google and others understand what the file is, especially for image search. – Anagio Aug 22 '12 at 22:41
Is there any reason to believe Google is too stupid to understand mime types? – Evan Carroll Aug 23 '12 at 3:33
youtube.com/watch?v=dSG6C33GwsE – Anagio Aug 23 '12 at 5:34

If you're providing the correct MIME or content types, then it shouldn't make any difference. I think aesthetically though, it's better to have extensions so that if a user wishes to download an image, their computer won't have any issues opening it, and the user would know off the bat what kind of image it is. (Sometimes you'd get a "image corrupt" error.)

For older browsers, this may pose a problem if they are for some reason unable to understand the content types, or if a piece of software (PHP and cURL, "Mike's Marvelous Image Downloader", etc.) does an HTTP request to it, it may not have the same logic that browsers do.

Conclusion: stick with extensions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.