100

How can I create and use a favicon for my website?

peterretief
  • 2,049
  • 1
  • 15
  • 16
  • 1
    Possible duplicate of [How to add a browser tab icon (favicon) for a website?](http://stackoverflow.com/questions/4888377/how-to-add-a-browser-tab-icon-favicon-for-a-website) – Michał Perłakowski Mar 19 '16 at 13:38
  • @Gothdo This is not a duplicate! The one you point to IS! This one preceded that one by a year and a half! – Dov Miller Jul 20 '16 at 10:04
  • 5
    I'm voting to close this question as off-topic because this is not about programming but web design. – Kyll Dec 21 '16 at 15:09
  • @DovMiller The better question with the better answers is the one that should remain open. – mbomb007 Jan 03 '20 at 19:58

10 Answers10

109

Searching about favicons, I discovered I needed more than 10 kinds of files to work in all browsers and devices :(

I got pissed and created my own favicon generator, that creates all these files and the correct HTML header for each one of them: faviconit.com

Hope you enjoy it.

Community
  • 1
  • 1
Eduardo Russo
  • 4,121
  • 2
  • 22
  • 38
43

If you already have a logo image that you want to transform into a favicon, then you can convert it using http://www.favicomatic.com/. It creates crisp favicons, and I haven't had to edit them after creating them. It will generate favicons at 16x16 and 32x32 and to quote them: "Every damn size, sir!". The site also supports/preserves transparency present in some pngs. Also, their site looks cool and is easy to use.

For example here is a stackoverflow logo: enter image description here

Here are some of the generated favicons:

enter image description here enter image description here enter image description here enter image description here enter image description here

They also generate the needed html:

<link rel="apple-touch-icon-precomposed" sizes="57x57" href="apple-touch-icon-57x57.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon-precomposed" sizes="60x60" href="apple-touch-icon-60x60.png" />
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="apple-touch-icon-152x152.png" />
<link rel="icon" type="image/png" href="favicon-196x196.png" sizes="196x196" />
<link rel="icon" type="image/png" href="favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/png" href="favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png" sizes="16x16" />
<link rel="icon" type="image/png" href="favicon-128.png" sizes="128x128" />
<meta name="application-name" content="&nbsp;"/>
<meta name="msapplication-TileColor" content="#FFFFFF" />
<meta name="msapplication-TileImage" content="mstile-144x144.png" />
<meta name="msapplication-square70x70logo" content="mstile-70x70.png" />
<meta name="msapplication-square150x150logo" content="mstile-150x150.png" />
<meta name="msapplication-wide310x150logo" content="mstile-310x150.png" />
<meta name="msapplication-square310x310logo" content="mstile-310x310.png" />

I looked at the first 20 or so google results, and this was by far the best.

Jared Menard
  • 2,654
  • 1
  • 21
  • 22
  • 1
    How can I improve this answer to avoid further downvotes? – Jared Menard May 01 '15 at 14:53
  • 4
    I don't know. Your answer made this a five minute job for me. Thanks. – andyb Sep 21 '15 at 08:28
  • 1
    some people just like to downvote for no reason. SO needs to have policy against it. Btw, do we really need many different size or we 16x16 and 32x32 are just enough as website generates – Emil Feb 12 '18 at 09:45
  • I personally don't know what the best practice is here. On my site I think we just use one. These could be helpful for chrome progressive web apps when combined with a manifest.json. – Jared Menard Feb 12 '18 at 17:05
  • I found this resource on http://www.favicomatic.com/, it's called the "Favicon Cheat Sheet" https://github.com/audreyr/favicon-cheat-sheet – Jared Menard Feb 12 '18 at 17:06
20

GIMP is a good program for that. Just save the image as PNG, then add

 <link rel="SHORTCUT ICON" HREF="/favicon.png">

on the <HEAD>section of your page.

Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
9

You create a icon file that's 16x16 or 32x32 or 64x64. Name it favicon.ico and place it in the root of your website public folder.

There are websites that will convert other graphic formats to .ico for you. ie. http://tools.dynamicdrive.com/favicon/

Jim
  • 5,557
  • 1
  • 20
  • 18
5

One of the best online favicon tools is FaviconGenerator.com. Fast, modern design, no fluff.

Matthew S
  • 843
  • 2
  • 12
  • 26
  • 1
    [FaviconGenerator.com](http://www.favicongenerator.com/) also provides access to their API from node/grunt/gulp. – Matt Jul 06 '17 at 00:56
3

I use the open source Paint.net program along with the Icon plugin.

You can then create and save an image in the .ico format with all the different sizes embedded into the .ico file.

Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
3

If you want to create .ico files, you can also use GIMP to create favicons. Modern browsers can use normal image files, but originally I think it was just .ico files. It's an open source image editor similar to Photoshop. Create and edit an image of the right size (say 32 x 32), flatten to one layer (Unless you want multiple icons in the same file), and save as a .ico. It'll format it correctly, then use Stefano's <link rel="SHORTCUT ICON" HREF="/favicon.ico"> to use it in your webpage.

Ry-
  • 218,210
  • 55
  • 464
  • 476
rocketmonkeys
  • 5,473
  • 5
  • 28
  • 21
3

When creating a favicon, you want to take the following factors into account:

  • Supported platforms Ten years ago, you only wanted to support desktop browsers and the solution was to generate the classic favicon.ico picture. Nowadays, you want to support iOS (and iOS Safari) and Android (and Android Chrome). Maybe Windows 10 (and Edge) and the new Mac Book Pro Touch Bar, too (macOS Safari). You cannot just use a single "one size fits all" image anymore.
  • Design As soon as you support multiple platforms, you are facing multiple design guidelines. For example, Google is using transparent icons for its own native apps on Android, while iOS icons cannot be transparent at all. You cannot just use a "single design fits all" approach.
  • Generated icons and HTML code For two or three years, the reference has been to generate as many icons as possible in order to cover all cases. I am afraid I created this trend all by myself :-/ The problem is that you end up with 20-something lines or HTML, which is way too much. In order to have a satisfying technical solution, you need to balance the amount of generated icons/HTML and the supported platforms.

As usual, you can create all these assets manually. Unless you have very, very specific needs and a budget, this is definitely not the way to go.

The right way for most people is to use a favicon generator that lets you decide of the look of all the icons and takes care of all the details. The only one which does this is Real Favicon Generator. Full disclosure: I am the author of this site.

philippe_b
  • 38,730
  • 7
  • 57
  • 59
2

I make my favicons either 16 x 16 or 32 x 32 using Photoshop. I save it as gif then and I use IrfanView to convert the gif to an ico.

Ry-
  • 218,210
  • 55
  • 464
  • 476
Max
  • 15,693
  • 14
  • 81
  • 131
1

And if you are using asp.net try this way to apply favicon to your page :

<link runat="server" rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
<link runat="server" rel="icon" href="~/favicon.ico" type="image/ico" />

but you can find more information here : http://doctype.com/

Tarik
  • 79,711
  • 83
  • 236
  • 349
  • 1
    As a note, doctype.com closed as of February 15, 2013. [Read more about it](http://blog.doctype.com/doctype_is_closing_on_the_14th_1). – Krease Feb 18 '14 at 05:26