Most clients use the favicon if it is named favicon.ico and placed in the root path of a website.

Is it possible to use an image format other than .ico?


It's true that by default the browser only checks the /favicon.ico path, however we can use an HTML meta tag to tell it explicitly where the favicon is if it's at a different path or in a different image format than .ico.

In addition to .ico, you can use the .gif and .png file formats in all modern browsers as long as you use an HTML meta tag on your page to specify their path:

<link rel="shortcut icon" type="image/png" href="image/favicon.png">

There are some other file formats that can be used for favicons, but only .ico, .gif and .png are widely supported.

To address your comment, the /favicon.ico path is the only path that browsers will check without being prompted by an HTML meta tag. If you want to serve up a favicon of a different file type without using an HTML meta tag, you can always 30X-redirect the /favicon.ico path to the path of a .png or .gif file.

|improve this answer|||||
  • My question was not about icons mentioned in html tags. – buhtz May 26 '19 at 22:31
  • If you want to use a different format, you can mention it in an HTML tag. Then what you mention will be used instead of the default .ico format – Stephen Ostermiller May 26 '19 at 22:48
  • @buhtz Just addressed this in my edit. – Maximillian Laumeister May 26 '19 at 23:31
  • 1
    I redirect favicon.ico to favicon.png and that seems to work. – Stephen Ostermiller May 27 '19 at 0:15
  • 1
    @StephenOstermiller I think you are right - i.e. a redirect is fine. According to this source the W3C says that in the case of the link HTML meta tag, the type attribute is considered "non-authoritative", which tells me that there probably isn't any special file-type trickery here. The client just reads the MIME type from the content-type header from the server, like with any other resource. I included this info in my answer. Thanks! – Maximillian Laumeister May 27 '19 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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