<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://fiiv.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://fiiv.io/" rel="alternate" type="text/html" /><updated>2026-08-05T05:11:43+00:00</updated><id>https://fiiv.io/feed.xml</id><title type="html">Nikita Timofiiv</title><subtitle>Web professional with 16 years of experience.</subtitle><entry><title type="html">Everything you’ve (n)ever wanted to know about favicons</title><link href="https://fiiv.io/blog/everyting-youve-never-wanted-to-know-about-favicons" rel="alternate" type="text/html" title="Everything you’ve (n)ever wanted to know about favicons" /><published>2021-10-27T00:00:00+00:00</published><updated>2021-10-27T00:00:00+00:00</updated><id>https://fiiv.io/blog/everyting-youve-never-wanted-to-know-about-favicons</id><content type="html" xml:base="https://fiiv.io/blog/everyting-youve-never-wanted-to-know-about-favicons"><![CDATA[<p>A favicon is quite simply an <strong>icon</strong>. The idea behind its inception was for browsers to use them to make a quick, easy to identify visual representation of a website in the browser’s UI.</p>

<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydfpdypv6lqmuvirmonk.png" alt="Favicon as it appears in Firefox" /></p>

<h2 id="a-little-bit-of-history">A little bit of history</h2>

<p>The first favicons were implemented in 1999 by Microsoft in their Internet Explorer browser. Since then, they were widely adopted by almost all browsers, and today it is commonplace to find favicons being displayed all over the browser, such as in bookmarks menus, window and tab headings, address bars, history, etc.</p>

<p>Microsoft’s original idea was to load that icon from a specific place relative to a website. If your website’s address was <code class="language-plaintext highlighter-rouge">pokemon.com</code>, Internet Explorer looked for it at <code class="language-plaintext highlighter-rouge">pokemon.com/favicon.ico</code>.</p>

<p>This original implementation worked alright at first. But at the time, lots of websites were hosted with companies like Geocities, Angelfire and Tripod. They would give your website an address like <code class="language-plaintext highlighter-rouge">tripod.com/my-pokemon-website</code>. The problem with this was that the browser would always use Tripod’s favicon located at <code class="language-plaintext highlighter-rouge">tripod.com/favicon.ico</code> and not one that the website’s author might want to show!</p>

<p>Eventually, the people responsible for standardising HTML on the web, the World Wide Web Consortium (W3C), created a specification for how both browsers and website authors should use these icons. In the HTML of the page, an HTML tag would be included, telling the browser where to find that icon.</p>

<p>But, since the original Internet Explorer needed to work because lots of websites had been using it, browsers began supporting them both.</p>

<h2 id="the-advent-of-the-smartphone-and-other-use-cases">The advent of the smartphone (and other use-cases)</h2>

<p>A lot of things changed when the smartphone became mainstream. One notable thing that changed for favicons was that people could save websites to their home screen. But the favicon.ico icons up to this point were all too small – sometimes they were as tiny as 16 pixels! These icons were supposed to be shown next to app icons, which are much more high fidelity images – up to 10 times bigger, in fact!</p>

<p>Android and iOS use different icon sizes. Also, Windows began using yet another icon type for displaying websites in its Metro tile display.</p>

<h2 id="the-chaos-is-real">The chaos is real</h2>

<p>As a result of all these different specifications, there are now a lot of places to look for favicons. And the different icons you can get will vary depending on which one you request. Some sites will have some but not others!</p>

<p>The list includes:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">yoursite.com/favicon.ico</code></li>
  <li>In the site’s HTML code</li>
  <li>In the site’s web manifest file</li>
</ul>

<p>Some sites end up with dozens of different icons. These vary, from the usually tiny favicon.ico to the higher resolution icon used by iOS’s home screen feature. Additionally, a lot can go wrong with fetching these.</p>

<ul>
  <li>There might not be any icons at all.</li>
  <li>The icons are specified but don’t exist (return a 404).</li>
  <li>The icons are the wrong size.</li>
  <li>The icons are the wrong format for where you might want to use them.</li>
  <li>The icons are corrupted or broken.</li>
  <li>The icons specified might not have the one you might want to use.</li>
  <li>The web server could be misconfigured (for example, resulting in redirect loops).</li>
  <li>The web server could be slow to respond with the icons or the files specifying the icons.</li>
</ul>

<p>So, requesting something as simple as a tiny little website icon can be a very complicated task! Clearly there is no one-size-fits-all solution to grab the icons.</p>

<h2 id="how-to-make-sure-your-website-has-all-its-icons">How to make sure your website has all its icons</h2>

<p>So all that being said, how do you make sure your website has all the different icons it should have, and they’re properly referenced in your HTML markup?</p>

<p>Quite simply, the best way to do this is to use a service that generates the markup and icons for you. The best ones I’ve found so far are <a href="https://realfavicongenerator.net/">realfavicongenerator.net</a> and <a href="https://www.websiteplanet.com/webtools/favicon-generator">Website Planet’s Favicon Generator</a>. You can upload an icon image, specify some preferences, and it will generate a ZIP file with your icons properly sized and set up, as well as the HTML to insert into your site’s <code class="language-plaintext highlighter-rouge">&lt;head&gt;</code> section.</p>

<p>If you use Webpack, you could also try out the plugin <a href="https://github.com/jantimon/favicons-webpack-plugin">jantimon/favicons-webpack-plugin</a> that will automatically work its magic to give you favicons.</p>

<h2 id="how-to-use-other-sites-favicons-on-your-site">How to use other sites’ favicons on your site</h2>

<ol>
  <li>You could build your own API or serverless function to fetch a site’s favicons. But, I gotta tell you from experience, there’s a lot of edge cases and weirdness here.</li>
  <li>You could always load <code class="language-plaintext highlighter-rouge">domain.com/favicon.ico</code>, but be prepared for 404s.</li>
  <li>You could use an existing service. <strong>Shameless plug</strong> – I built <a href="https://icon.horse">Icon Horse</a> for this purpose, you can use it free (or upgrade for additional features). Other services also exist, like <a href="https://favicongrabber.com/">Favicon Grabber</a>. Some search engines like Google, Bing and DuckDuckGo also have APIs for this, but since they’re intended for internal use and are undocumented and unsupported, be prepared that they might not work like you want or they might stop working at any moment.</li>
</ol>

<h3 id="other-cool-stuff">Other cool stuff</h3>

<ul>
  <li><strong><a href="https://iconmap.io/">Iconmap.io</a></strong>: a massive map of favicons from all over the web</li>
  <li><strong><a href="https://realfavicongenerator.net/">realfavicongenerator.net</a></strong>: the best tool I’ve found for generating favicons for your website</li>
  <li><strong><a href="https://www.websiteplanet.com/webtools/favicon-generator">Website Planet’s Favicon Generator</a></strong>: another great tool for generating favicons for your site</li>
  <li><strong><a href="https://icon.horse">Icon Horse</a></strong>: my super cool favicon grabber API</li>
  <li>Let me know if you can think of a link for here and I’ll add it</li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[What is a favicon, how did it come about and most importantly, how can you make sure you're doing them correctly?]]></summary></entry><entry><title type="html">How &amp;amp; why I built a favicon fetching service</title><link href="https://fiiv.io/blog/how-why-i-built-a-favicon-fetching-service" rel="alternate" type="text/html" title="How &amp;amp; why I built a favicon fetching service" /><published>2021-09-04T00:00:00+00:00</published><updated>2021-09-04T00:00:00+00:00</updated><id>https://fiiv.io/blog/how-why-i-built-a-favicon-fetching-service</id><content type="html" xml:base="https://fiiv.io/blog/how-why-i-built-a-favicon-fetching-service"><![CDATA[<p>A few days ago, I launched <a href="https://icon.horse">Icon Horse</a>, which is a simple, free API to quickly get the favicon of any website. The launch itself went really well, and I had a lot of fun building it.</p>

<p>But inside the seemingly simple but glamorous life of favicons, there is a lot of complexity. I thought I’d share some of how it works with you all, and some of the hoops I had to hop to build Icon Horse.</p>

<h2 id="what-is-a-favicon-really">What is a favicon, really?</h2>

<p>The year was 1999. Britney Spears and Eminem were at the top of the charts, the world was introduced to Napster for the first time, and the “browser war” was heating up with Microsoft releasing Internet Explorer 5.</p>

<p>One of IE5’s new features was the favicon, or a small icon which was displayed in the “Favourites” menus/bars next to the title of the site someone bookmarked. Things were simple back then, and if the favicon existed, it would be loaded from the site’s root like so:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>https://mysite.com/favicon.ico
</code></pre></div></div>

<p>Since then, a number of new circumstances have come up requiring new types of icons – one example is the advent of the smart phone, which allowed people to save a website shortcut on their home screen. But since favicons tended to be low resolution, a number of diverging standards came about and added these on both Android and iOS.</p>

<p>Now while technically a <em>shortcut icon</em>, they are usually lumped in with favicons in general internet terminology and also during the process to create them.</p>

<p>Today, there are three main places to look for icons:</p>

<ol>
  <li><code class="language-plaintext highlighter-rouge">https://mysite.com/favicon.ico</code></li>
  <li>The HTML of the site in the <code class="language-plaintext highlighter-rouge">&lt;head&gt;</code></li>
  <li>A separate Web App Manifest file which is specified in the <code class="language-plaintext highlighter-rouge">&lt;head&gt;</code></li>
</ol>

<h2 id="so-whats-the-problem">So what’s the problem?</h2>

<p>I’m currently working on a tool called <a href="https://meetingcanary.app">Meeting Canary</a>, from which a note-taking interface is displayed for a given calendar meeting. Many meetings have links to relevant places, such as video conferencing apps (especially since the COVID-19 situation has moved many people to remote work).</p>

<p>I decided it would be nice to render a small icon next to the links, as a way to tease the content to my users:</p>

<p><img src="https://pbs.twimg.com/media/E8pFHL8VIAAsUvH?format=jpg&amp;name=large" alt="A meeting invite often has a link" /></p>

<p>After hunting for a good way to fetch icons for a given link, I found one that was a JSON API endpoint, but I wasn’t very satisfied with this solution – I did <strong>not</strong> want to complicate my life by using it, since I still needed to write code to figure out the <em>best</em> icon to display from the list I got back.</p>

<p>Also, I did not find a single service that provided <strong>fallbacks</strong>, or an icon that would be shown if the site is unreachable or if it had no icons at all.</p>

<p>After all, <a href="https://gravatar.com">Gravatar</a> does this very well for email addresses, and it was strange that no one had done this with favicons yet! So I got to work.</p>

<h2 id="it-was-really-simple-to-make-right">It was really simple to make, right?</h2>

<p>When it comes to standards, the web is pure chaos. When building a product to fetch favicons, you should expect no mercy.</p>

<p><img src="https://4.bp.blogspot.com/-wv1V-55MoaQ/Uc8rNIqugvI/AAAAAAAAaHg/D0wqb-Fn4cc/w1200-h630-p-nu/1012122_592028560863220_1994359073_n.jpg" alt="The web is a hive of scum and villainy" /></p>

<p>Some sites have no icons at all. Some sites have only a few of the icons from the spec. Some sites use strange sizes. Some sites don’t even bother to tell you the size (in pixels) of the icons.</p>

<p>Some sites have completely broken DNS or server issues (like infinite redirect loops). Some send confusing or broken headers. Some sites serve invalid HTML or JSON. Some sites have <code class="language-plaintext highlighter-rouge">404 Not Found</code> errors on their icons. Some sites used weird caching schemes. Some don’t specify a MIME type or a file extension so you have to parse the actual image to know what you’re dealing with.</p>

<p>The list of difficulties goes on – for example one prominent clothing retailer’s icon is simply not loadable because they have a nasty bug in their site’s redirects and headers meaning you cannot simply <code class="language-plaintext highlighter-rouge">redirect: 'follow'</code> your way to the HTML page, but must chain one request after the other manually.</p>

<p>But I persevered through all those.</p>

<p>I knew there was going to be even more edge cases I hadn’t considered in the future, so it was very important to build in functionality for fallback images. I never wanted to serve a broken image or a timeout.</p>

<p>I also had to make some decisions. Since my service was making icons available to all who wanted them, there was no telling the different use cases they would be serving. So I made the assumption that the best icon to serve would be the most high fidelity image. Also, for some use cases (such as React Native), SVG format icons would not work out of the box, and needed something like <a href="https://github.com/react-native-svg/react-native-svg">react-native-svg</a> to get them to load, so I stuck to raster formats only (for the first version at least, I plan to open up SVGs as well in the future via a query parameter).</p>

<p>And finally, pulling all this content is time intensive. Consider that to serve an icon, one needs to:</p>

<ol>
  <li>Load <code class="language-plaintext highlighter-rouge">https://asite.com</code>’s HTML site</li>
  <li>Parse the HTML and do a query lookup to get relevant icons and the manifest file</li>
  <li>Load the manifest file and parse it</li>
  <li>Check for the existence of the <code class="language-plaintext highlighter-rouge">https://asite.com/favicon.ico</code> icon</li>
  <li>Merge all these icons together in a list and sort them based on a <em>best</em> to <em>worst</em> criteria, while also making sure the icons themselves are reachable (and don’t <code class="language-plaintext highlighter-rouge">404 Not Found</code>)</li>
  <li>If all this fails, generate a JPEG file on the fly as a fallback</li>
  <li>Serve the icon to the user</li>
</ol>

<p>So when dealing with a slow server, it’s possible that loading that icon could take quite a long time. To help with that, Icon Horse must cache the resulting list of icons and the resulting chosen icon.</p>

<p>I wanted to keep the functionality super simple, so when someone queried my API to get an icon:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>https://icon.horse/icon/dev.to
</code></pre></div></div>

<p>I ended up with just the icon:</p>

<p><img src="https://icon.horse/icon/dev.to" alt="dev.to icon" /></p>

<h2 id="putting-it-all-together">Putting it all together</h2>

<p>From the very beginning, I knew I wanted to use a serverless approach to this service. The landing page is built out of Next.js and the service itself sits in a lambda function hosted on Amazon.</p>

<p>After struggling a little bit with getting the environment set up (it had to have image processing capability as well as a few other things), I managed to get it working and running properly.</p>

<p>And there you have it. I launched on <a href="https://www.producthunt.com/posts/icon-horse">ProductHunt</a> (among other places) and was surprised by the overwhelming positive reception – I got almost 200 upvotes and almost 1000 unique visitors. What surprised me the most is how a favicon fetcher service I thought would be niche and developer only was actually really well understood by all kinds of people.</p>

<p>I learned a lot about the weird world of favicons and solved my own need, but above all had a lot of fun doing it.</p>

<p>Thanks for reading.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[There's a surprising amount of pain to get that tiny little icon.]]></summary></entry></feed>