Everything You Ever Wanted to Know about Favicons

Published Wednesday, October 17, 2007 @ 2:39 pm • 19 Responses

[ Image: Fifty of my Favorite Favicons ]
Fifty Favorite Favicons
If you have a website, you need a favicon. For those who may not know, favicons are the small, square icons that frequently are associated with websites. Favicons appear in many places, including browser toolbars, bookmarks, tabs, and address bars. Favicons provide immediate visual identification of their represented sites, enabling super-easy navigation for Web users. While surfing bookmarks with fifty tabs open, finding and clicking on icons is far more efficient than reading through piles of link text. Yet, beyond making it easier for people to identify and locate their favorite websites, favicons also play a critical role in site branding and product recognition. Popular browsers such as Firefox, Opera, and Internet Explorer are virtually re-branded when favicon-enabled sites are displayed. For example, observe how willingly modern browsers conform to the image of web designer/developer Jonathan Snook:

[ Image: Snook favicon in Firefox ]
Have you seen the new FireSnook browser?

[ Image: Snook favicon in Opera ]
Jonathan Snook rebrands Opera

[ Image: Snook favicon in Internet Explorer ]
Who owns the browser now?

Sure, an incredibly strong page design helps in each of these examples, but for the most part, it is the favicon that brings it all together — visually uniting the various browser components into a well-branded browsing experience. Now to provide contrast, let’s consider a hypothetical bizarro world in which faviconless Snook pages are a common sight:

[ Image: Snook page without a favicon as seen in Opera ]
Oh, that’s an Opera browser..

Pretty scary stuff, especially if you are trying to promote a particular brand, theme, or style. The bottom line is that favicons aren’t just for bookmarks anymore.

During web design, I like to think of a site’s favicon as its crown jewel. The final touch, added after everything else has fallen into place. It’s a symbol of accomplishment, completeness, and significance. There is nothing better than bookmarking a new site in Firefox and watching as its favicon struts into place. Conversely, there is nothing worse than pimping a phat row of browser toolbar shortcuts for your favorite sites, only to discover that a couple of them are sadly missing their representative favicons:

[ Image: Firefox toolbar featuring missing favicons ]

..utterly pathetic, in my humble opinion. Even though I keep those two faceless bookmarks in my favorites toolbar, I cringe with disgust every time I happen to click on one of them. Okay, okay — it’s really not that bad, but you get the idea.. ;) This screenshot further emphasizes the importance of using a favicon to represent your website.

Getting down to business..

So, now that we demonstrated the importance of implementing a favicon on your site, it’s time to get down to business, explaining everything you ever wanted to know about the wonderful world of favicons.

Formatting your favicon

Contrary to popular opinion, favicons are not required to be created in .ico format. Sure, the .ico format may be the most popular favicon file type, but it is by far the only one. In fact, favicons come in a wide variety of file types. Some of the more common formats for favicons include the following:

  • .ico
  • .gif
  • .png
  • .jpg

..and there are many other possibilities as well, depending on your specific needs. Regardless of file type, favicons are square images that typically are seen in sizes of 16×16 and 32×32, as measured in pixels. Although 64×64 and even larger sizes are possible, browser support is inconsistent for anything greater than 16×16. Generally, 16×16 favicons are more than sufficient, however some browsers such as Microsoft’s Internet Explorer may display favicons at 32×32 for sites bookmarked in favorites.

Fortunately, favicons created in .ico format may encapsulate multiple images, including unique instances of 16×16, 32×32, and even larger resolutions. This is beneficial when image-scaling may compromise the readability of your favicon. Whereas .gif and .png formats may scale down without loss of image quality, the converse certainly isn’t true.

My advice for selecting the best size and format? Begin with a square image of any size and use it to generate a 16×16-pixel favicon in .ico format (or any file format of your choice). This is by far the most commonly employed type of favicon, and will serve you (and your site) quite well.

Creating your favicon

Currently, there are several excellent ways to produce top-quality favicons in .ico format:

  • Upload your chosen image to html-kit and generate a complete favicon package automatically.
  • Handcraft a customized favicon by using favicon.cc to create your own pixelated work of art.
  • Install the favicon plugin for Photoshop and gain complete control over your favicon.
  • Download Microangelo and use it to facilitate the entire favicon-creation process.

And of course, to create favicons in other, common formats, such as .gif and .png, simply use your favorite image editor and customize any image to fit 16×16 or 32×32 dimensions. Another option, which I have not tried personally, involves creating a favicon in .gif or .png format and then renaming it to “favicon.ico” (i.e., changing the file extension to .ico). Keep in mind, however, that this method merely disguises the true format and renames it for the sake of ensured browser compatibility. Thus, if you plan on using this trick, remember to serve it as type="image/ico" or certain browsers may not recognize your favicon as intended (see next section for more details).

Serving your favicon

Once you have created the perfect favicon, it is time to upload it and serve it to your visitors. Begin by uploading your favicon to the root directory (www) of your website. Although other locations are theoretically possible, certain browsers such as Internet Explorer and even Firefox may get confused and ignore your favicon entirely. The traditional and perhaps de facto standard location for favicons is easily the site root.

After uploading your favicon, it’s time to place a call for it in each of your web pages. Favicons are called via the <link> element, which is located in the <head> section of (X)HTML web documents. Here is the general format required by the <link> element to call favicons:

<link rel="shortcut icon" type="image/x-icon" href="http://domain.tld/favicon.ico" />

Let’s look at each attribute of this element, and discuss possible variations.

rel="shortcut icon"
The rel attribute tells the browser the purpose of the linked resource. All browsers understand a rel value of “shortcut icon,” but only certain non-IE browsers such as Mozilla and Opera correctly interpret a rel value of “icon.” Thus, using rel="shortcut icon" is optimal.
type="image/x-icon"
The type attribute specifies the MIME type for the linked resource. All browsers understand “image/x-icon,” but this is only correct if referring to an actual .ico-formatted favicon. If your favicon is formatted as .gif, .jpg, or .png, the correct MIME type is “image/ico,” as represented by type="image/ico".
href="http://domain.tld/favicon.ico"
The href indicates the lcoation of the linked resource. It is recommended to locate your favicon in the root directory of your site. If you choose an alternate directory, edit the path of this element to point to the correct location. Keep in mind, however, there is no guarantee that all browsers will recognize favicons located in non-root locations. Also, remember to change the “.ico” file extension given in the example if you are using a different format.

Thus, assuming we are following the suggested “best practices” for favicon implementation, there are two fundamental types of <link> elements used to call favicons:

Adapt this code to call favicons in .ico format:

<link rel="shortcut icon" type="image/x-icon" href="http://domain.tld/favicon.ico" />

Adapt this code to call favicons in any other format:

<link rel="shortcut icon" type="image/ico" href="http://domain.tld/favicon.ico" />

Miscellaneous notes..

  • When deciding on a format for your favicon, remember that our old friend IE does not play well with .png.
  • When checking your favicon in IE, you may have to sacrifice to idols to make it appear.
  • Internet Explorer 5 may only recognize favicons that are named “favicon.ico”.
  • Internet Explorer 6 may only support the .ico format for favicons.
  • In general, favicons are far more flexibile than IE would have you believe. Other browsers support a mucher broader implementation of favicons, including support for alternate file names, different file types, and multiple file sizes. Non-IE browsers even facilitate the easy loading of the favicon into your browser! Wheee! ;)

Dialogue

19 Responses Jump to comment form

1Pinto

December 30, 2007 at 6:00 am

Is this work in FF too?
I use to have a favicon in my wordpress blog but for some reason i have a problem now.
in the dashboard & in my regular website the favicon working good.
the theme that i have on my blog now is in XHTML.
What i can do to make it work in FF too? it’s working in the internet explorer good in my blog.

2Perishable

December 30, 2007 at 9:18 am

Hi Pinto,

I see what you mean.. btw, I was also able to see your favicon at the root URL of your site, even though there is not even an explicit link to it in the source code of that page. Thus, you may want to try experimenting a bit by removing the link in the wp subdirectory, or, you may want to try adding an additional (secondary) link like so:

<link rel="shortcut icon" type="image/ico" href="http://domain.tld/favicon.ico" />

Beyond that, I would try re-creating your favicon from scratch and re-uploading it. Also, you may want to check your server/error logs to check for discrepancies and/or other clues. Finally, if all else fails, you could always upload a secondary copy of your favicon to your site’s subdirectory and link to it directly on non-root pages.

I hope that helps — good luck!

3Pinto

December 30, 2007 at 11:37 am

thanks for the replay
i tried to do like you say but it’s not working….
do u have msn messenger?

4Perishable

December 30, 2007 at 1:54 pm

Yes, follow the “Contact by chat” link in the site menu below and fill in the blanks. I am online for awhile today, so drop an email and I will try to help you.

5Oeroek

March 9, 2008 at 3:46 am

Great article with much usefull information.

It would have saved me some research if I would have found it before I wrote my own article.

Keep up writing the good stuff.

6Perishable

March 9, 2008 at 1:15 pm

Thanks for dropping in, Oeroek. Your article is great — it is an excellent and concise overview of the favicon-creation process. I am glad I found it. Keep up the good work!

7James

March 25, 2008 at 11:41 am

Heh… IF all else fails, read a great tutorial like this one! ;)

I was scratching my head for days, until I read about the code needed in the head document.

I also found out that html-kit generates a readme in the zip files which also contains the line of necessary code. Just cut and paste.

Many thanks for the help PP!

James.

8Perishable

March 25, 2008 at 1:07 pm

Hi James, thanks for the kind words — I am glad you found the article helpful! Also, great tip about the HTML-Kit service — I have used their excellent favicon generator many times, and should have remembered about the ReadMe info included in the .zip file. Thanks for the reminder! ;)

Cheers,
Jeff

9James

March 25, 2008 at 1:26 pm

Hi Again,

Thanks Jeff. Actually, I just noticed a small problem with their readme code. It looks like this:

<link rel="shortcut icon" href="favicon.ico" >

It is better to add a / in front of favicon.ico to make it work in sub-folders, like this:

<link rel="shortcut icon" href="/favicon.ico" >

James.

10Perishable

March 25, 2008 at 2:05 pm

WordPress doesn’t make it easy to leave code in comments, does it? ;) I really dislike that about WP, but I assume that it is for the better. In any case, thanks for sharing your insights regarding the code included in the HTML-Kit .zip file. After looking into it a moment ago, I grabbed a copy of their code and added it to your initial comment. Not only is it smart to include a forward slash before the favicon.ico as you suggest, it is also a good idea to to either remove the empty space from before the closing bracket ( > ) for HTML markup, or else leave the space and precede the closing bracket with a forward slash ( / ) for (X)HTML markup, such that it looks like either of these:

[for HMTL]:
<link rel="shortcut icon" href="/favicon.ico">
[for (X)HTML]:
<link rel="shortcut icon" href="/favicon.ico" />

Also, for the record, it is generally possible to include code in WordPress-powered comments when each line is wrapped in a <code> element. In any case, your feedback is appreciated — thanks for the info! :)

11James

March 25, 2008 at 9:27 pm

Heh, yeah. WP would be nice if it prevented me from posting, rather than posting it minus the code….

Anyway, thanks for cleaning up, and also the tip on deleting the space and using the code tag. :)

Cheers,

James.

12HepCat_

May 27, 2008 at 1:43 pm

Do you know how I would ‘force’ a specific favicon for several text links I have on a single page? The issue I have is that these links are all JavaScript href’s therefore there isn’t a landing page that the browser can see to get the .ico file.

13Perishable

May 28, 2008 at 5:11 am

HepCat_, I am not entirely sure what you mean.. As far as I know, favicons are delivered via a directly associated page using a link element. Text links, or any kind of links for that matter, may be associated with other types of icons, but not favicons. If there isn’t a “landing page”, does that mean that the links are involved in pop-ups or Ajax functionality?

14HepCat_

May 29, 2008 at 11:03 am

They are links that use JavaScript to build the link on the client side. (href=javascript:functions) Due to the fact that the URL isn’t assembled until it gets to the client’s browser I was wondering if there were any other ways to force a favicon on a link.

In this instance I ask the user to drag these links into their bookmarks toolbar. I would like to have an icon on these links but I don’t think there is a way to accomplish this.

Suggestions?

15Perishable

May 31, 2008 at 3:01 pm

Hmmm, I think I understand now..
If the links that the users are adding to their bookmarks toolbar are pointing to actual web pages, I would look into adding the favicons via user/link-specific <link> elements dynamically added to the target page. Otherwise, if you must associate favicons to the links before the page is loaded in the browser, or for links that do not target actual web pages, it may be possible with some custom JavaScript, but that goes beyond my level of expertise.
I hope this helps!

16Amyobus Key

June 23, 2008 at 6:45 am

Something else you can have fun with is the creation of the animated and transparent favicon, which are active in both Netscape and Firefox. Because Internet Explorer want’s the stuffy old static favicon, you have to have an IF construction in your Head Section when calling up the favicon. Check out our link above for complete details and be sure to view our site in both IE and Firefox just to see what happens when a favicon comes to life.

17Perishable

June 23, 2008 at 4:08 pm

@Amyobus Key: very nice tutorial — thank you for sharing it with us! For the record, I am going to post the required <link> attributes and the conditional IE call for easy reference:

<link rel="icon" type="image/gif" href="http://domain.tld/path/filename.gif" />
<!--[if IE]>
<link rel="shortcut icon" href="http://domain.tld/path/favicon.ico" type="image/vnd.microsoft.icon" />
<![endif]-->

..and, for anyone interested in reading the full story of how to implement dynamic favicons on your own site, check out Amyobus Key’s excellent tutorial, Creating the Animated Favicon. Five stars!!

Subscribe to comments on this post


Share your thoughts..

TopRead official comment policy

← Previous post • Next post →

« New Version of Category LiveBookmarks Plus for WordPress 2.3Rocking the Boat »

Contact Perishable Press

  • Contact Jeff via form

Search Perishable Press

About Perishable Press

Perishable Press is the virtual playground of Jeff Starr — visionary, founder and lead developer of Monzilla Media, a small web and graphic design company in the lush desert oasis of Moses Lake, Washington. Perishable Press features articles and tutorials on many aspects of digital design..

Read more..

Perishable on Twitter

mmmm, dark chocolate..

Perishable on Tumblr

Tons of Firewalls

Tuesday, 7 October 2008, 1:45 am

Recently overheard on conservative talk radio (instructing listeners how to obtain a free promotional video from their new website):

“This website has tons and tons of firewalls, so you have to use your real email address to download the video..”

The Quiet Search Revolution

Monday, 6 October 2008, 12:15 pm

Just a thought.. As awesome as Google is these days, it would suck if they ended up owning the entire search-engine business. When they get to the point where all competition is impossible (due to their sheer size, financial resources, media influence, etc.), how many alternate search engines will have the resources for continuous improvement and top-quality search results? When this happens, we will have no choice but to do exactly what Google tells us to do.

As deeply ingrained as it is for everyone to instinctively and unthinkingly turn to Google for their search activity, it is time to leave a few alternate search tabs open for as much use as possible. Instead of using Google just because that’s what you always do, try your search on MSN, Yahoo, Ask, or any of the other independent search engines instead. Sharing traffic with other search engines is a nice, quiet way to keep the competitive spirit alive and well in the search-engine business.

Disappearing WordPress Posts

Wednesday, 1 October 2008, 7:50 pm

Today I experienced difficulties while trying to publish or even save new posts in WordPress. I would compose the post as usual, add all of the keywords, tags, meta tags, and so on, but as soon as I clicked the “Publish” or “Save” button, the post would just disappear from existence.

The weird thing is that during the drafting process, WordPress’ default auto-save feature showed that the post had been saved at expected intervals. Unfortunately, after trying to publish several different posts, WordPress showed absolutely no record of the posts ever being created. They simply vanished into thin air.

Fortunately, a little investigation revealed the culprit. If you should find yourself dealing with this same issue, here are some different things that you should try. First, re-upload fresh copies of your entire WordPress installation. I don’t know why exactly, but apparently various files can either go stale or completely disappear from the server. Overwriting or writing fresh files may do the trick.

If that doesn’t work, check your WordPress database for errors. In my case, a little investigation revealed that something had caused a couple of fatal errors in the wp_posts table. Fortunately, checking and repairing the table solved the issue.

Tumblr Battles

Wednesday, 1 October 2008, 5:30 pm

Please excuse the duplicate Tumbr posts.. seems there is no way to ping Tumblr to refresh/rebuild the RSS feed according to changes in post content. So, to resolve the issue I have discussed now like two or three times regarding paragraph elements and proper feed formatting, I have no choice but to repost a majority of my text posts.

This is necessary for the proper import and display of my Tumblr feed into WordPress. Currently, there are five items displayed at once, each styled according to proper inclusion of paragraph tags. Thus, whenever the Tumblr feed “forgets” to enclose single-paragraph posts with the proper tags, the result is an unstyled post entry displayed on my site.

Assuming that makes sense, you will please excuse my dust while I repost a few older entries in an attempt to reconstruct (the hard way) a properly formatted Tumblr feed.

More Optimization Measures

Wednesday, 1 October 2008, 5:27 pm

Another important step in improving the performance of my recent redesign involves the optimization of both CSS and JavaScript content. During development there were around 15 server requests for these two types of files, 10 JavaScript files and 5 CSS files. This was okay for my own use, but would not work for production purposes.

Optimizing these file types involves consolidation, compression, and caching. Consolidation of 10 JavaScript files into three is huge improvement. Now I deliver one JS file for the functionality of the site, one for Mint, and another for Analytics. Likewise for the stylesheets; after consolidation, a single stylesheet is delivered to all modern browsers. There are two additional stylesheets as well, but they are targeted at IE6 and mobile browsers and will not load elsewhere.

Once the files were consolidated as much as possible, it was time to optimize or “crunch” them. Using the sexy Flumpcakes CSS optimizer, I was able to reduce my stylesheets by around 25%. Likewise for JavaScript, I used xtreeme.com’s optimizer to shave an additional 20% off the size of my JS content.

Finally, once I had consolidated and compressed my JS and CSS files as much as possible, I wanted to further my optimization efforts by ensuring that these files were cached by the browser. By setting far-future Expires headers for everything but the statistical files, my site gains an additional performance boost by eliminating the need to reload preexisting content.

Read more on Tumblr..

Subscribe to Comments Recent Dialogue

  • Nyx: Happy to have helped! Love your site....
  • dockside: Hi i want to use this code on my blog. but not for all post. I want 3 or 4 full posts and then post in double column How?...
  • NZ Beats: Got it working using the following: http://www.nzbeats.com/?feed=rss2&category_name=album-review...
  • Paul: Holy crap, you just saved my A$$! Thank you!...
  • free games: Google have a content distribution network here http://code.google.com/apis/ajaxlibs/documentation/#AjaxLibraries where you ca...
  • free games: Found this (untested) for those that just want https For HTTPS: var pageTracker = _gat._getTracker("UA-XXXX-1"); pageTracker...
  • H5N1: The question is very hard. No way to solve it in only few words :) First of all you need a Linux. OK. But Linux it's only a Kerne...
  • gowers: wow, your theme is so great, I like it...
  • Eric Ferraiuolo: Like some people are commenting, a virtual solution is going to be the easiest to get going with the least number of issues. I would ...
  • Brent Terrazas: Thanks for the mention, I currently am running Ubuntu Server 8.04 on VMWare Fusion beta (it's a free beta download.. check it out fo...

Read more recent comments..