How to download favicon from website?

126

19

When you browse a website, the "favicon" icon shows up in the tab or next to the URL (or next to the bookmark).

If I want that graphic, is there a way to download it directly from the site? I'd prefer to download it directly from the web, but if all else fails, I'll dig it out of wherever it is stored on my computer (Windows 7, Firefox 3.6.6).

Robert Cartaino

Posted 2010-06-29T02:16:45.830

Reputation: 6 444

Answers

164

Studiohack has the "thorough" approach but heres a short hack:

  1. Enter the domain name like https://superuser.com/(must end with '/')
  2. Add favicon.ico to the end
  3. Press enter (this should be in the URL: https://superuser.com/favicon.ico)
  4. Right click on the image and click "save image as"

wag2639

Posted 2010-06-29T02:16:45.830

Reputation: 5 568

The other answers are all awesome. I learned a lot, thank you. But, for my specific purposes, this is what I was looking for. Accepted. – Robert Cartaino – 2010-06-30T02:44:22.810

2Well, except for sites like Wikia. – Hello71 – 2010-07-04T22:14:07.137

Genius, really. I even could get a dead linked website's favicon from Internet Wayback Machine. See my example here https://web.archive.org/web/20190615152329/http://www.ubuntubuzz.com/favicon.ico, it is an orange box with white "ub!" text written. Thanks a lot!

– Ade Malsasa Akbar – 2020-02-21T07:13:34.580

10So simple yet genius. – Raffi Khatchadourian – 2012-11-23T19:28:45.633

48

by reading http://en.wikipedia.org/wiki/Favicon you can also find that:

The following format is cross-browser compatible and is supported by Internet Explorer, Firefox, Chrome, and Opera.[3]

<link rel="shortcut icon" href="http://www.example.com/myicon.ico" />

Additionally the following is also acceptable:

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

The following shows the supported format of link tags, using examples, for HTML and XHTML.

HTML:

<link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico"> <link rel="icon" type="image/png" href="http://example.com/image.png"> <link rel="icon" type="image/gif" href="http://example.com/image.gif">

So, the common practice is indeed to put a file called 'favicon.ico' on the root folder, but to be sure, you have to lookup the source code of the served file and see if and what is defined there.

eg, for http://superuser.com it is

<link rel="shortcut icon" href="http://sstatic.net/su/favicon.ico"> 

akira

Posted 2010-06-29T02:16:45.830

Reputation: 52 754

opening inspect element on a page and searching ico should find it. – Qwertie – 2017-06-27T04:13:23.927

This worked for me as well when looking for a client's icon on their public site to add to their SFTP server's HTTPS interface. – Dacid Salin – 2019-07-17T17:00:34.730

1I have found sites that don't store favicon.ico in the root folder, particularly on Wikia. But the above worked. – D Coetzee – 2012-12-28T18:19:09.667

29

You can't always add /favicon.ico (eg. https://superuser.com/favicon.ico)
All of the answers are more complicated than necessary.

All you do is what is written here: http://www.itechcolumn.com/4-way-download-favicon-website/

  1. Go to the target site.
  2. View the page source (Right click on the page and click on "View Page source") - using firefox, may be slightly different in other browsers.
  3. Search (Ctrl+F) for "shortcut icon"
  4. You should see something like this:

    link rel="shortcut icon" href="http://www.sitename.com/images/thenameofthefavicon.ico"/>

  5. Right click on the link http://www.sitename.com/images/favicon.ico and save the icon. Or, open the page using the URL and save the page.

nittyjee

Posted 2010-06-29T02:16:45.830

Reputation: 391

1this worked when the /favicon.ico didn't. Thanks. – Joshua Dance – 2016-03-08T22:16:08.210

4good advice! But not all sites specify it directly in the HTML, it can be inferred.. – Jeff Atwood – 2013-05-31T18:59:17.657

26

Vamshi Kurra

Posted 2010-06-29T02:16:45.830

Reputation: 361

great tool and faster than navigating to the specific favico url – Luca Steeb – 2015-10-29T21:07:36.197

This is the only way worked for me. – Anixx – 2016-10-05T08:40:54.307

THIS actually needs to be the answer! Because the accepted answer above assumes that the favicon file is always in the root directory, is always named "favicon" and is always in .ico format, which it is not always the case!. Someone mentioned somewhere that the request in the link @vamshi posted makes Google's S2 library to actually pull the favicon from the target website instead of displaying the cached one. But I would test it to be sure. – lightproof – 2018-12-06T11:46:13.863

1Nope, that does not work if the domain name is not google-reachable, which could be true inside private networks. – Andrew Savinykh – 2019-05-07T23:25:45.270

14

None of the previous answers worked for me as the site I needed the icon from was an internal site, did not expose it in the source, and did not allow appending /favicon.ico so I dug a bit more.

Chrome can reliably pull the favicon using this solution:

  1. Visit the site you want the favicon for
  2. Add 'chrome://favicon/' before the sites url.
  3. Right click on image
  4. Save image as...

J.D.

Posted 2010-06-29T02:16:45.830

Reputation: 241

5

In Firefox 3: Click the favicon, a popup appears, and you can click "more information"...in the window that pops up, go to the "Media" tab. Highlight the specific media item that you want (it shows a preview in the large, white space in the bottom of the window), then click "Save As". Give it a name, pick a location, and you're done! :)

Some sites may not have a favicon listed, but some will...hit or miss...try this on Super User...SU has a favicon listed...

studiohack

Posted 2010-06-29T02:16:45.830

Reputation: 13 125

1This works the same in Firefox latest (ver 21) however, if the favicon is in the root of the site ala the IE default, it won't show up as media there! Because it is not specified directly in the HTML, it's implied. – Jeff Atwood – 2013-05-31T18:58:12.387

5

If you have JavaScript enabled, you could run this in the console :

(function() {
    var i=0;
    var arrLink = [];
    var found = 0;
    arrLink = document.getElementsByTagName('link');
    if (arrLink.length > 0) {
        for (i=0; i < arrLink.length; i++) {
            if (typeof arrLink[i].rel !== 'undefined' && arrLink[i].rel.indexOf('icon') > -1) {
                found = 1;
                window.open(arrLink[i].href);
            }
        }
        if (found === 0) {
            alert('favico Not Found');
        }
    } else {
        alert('favico Not Found');
    }
})();

Alternatively use the below code as a bookmark / paste in the URL :

javascript:(function(){var a=0,b=[],c=0,b=document.getElementsByTagName("link");if(0<b.length){for(a=0;a<b.length;a++)"undefined"!==typeof b[a].rel&&-1<b[a].rel.indexOf("icon")&&(c=1,window.open(b[a].href));0===c&&alert("favico Not Found")}else alert("favico Not Found")})();

Pranav 웃

Posted 2010-06-29T02:16:45.830

Reputation: 153

2

No need for all that PHP crap.

All you need to do in Firefox is click the ico image in the URL, click "More Information", then click the "Media" button. Favicon.ico is usually the first one in the list and already highlighted, but if it isn't, scroll down and then click the "Save As" button.

By the way, since Firefox 16, ico images don't display in the URL field anymore, but do in each tab and can be grabbed in the same way.

Xircal

Posted 2010-06-29T02:16:45.830

Reputation: 37

This appears to not be true any more. The favicon only appears on the tab. The URL box icon is a globe that only gives information about site security and permissions – chronometric – 2017-02-16T11:03:05.707

1

Try this bit of PHP which grabs the favicon and saves it as an .ico file. You could probably use this to grab almost any file. Note the use of the 'b' for 'binary' flag.

<?php
    echo '<p>Fetching Favicon.ico.</p>';
    $in = fopen('http://targetdomain.com/favicon.ico', 'rb');
    $contents = '';
    while (!feof($in)) {
        $contents .= fread($in, 8192);
        }
    fclose($in);
    $len = strlen($contents);
    echo '<p>Read ' . $len . ' bytes.</p>';

    $out = fopen('favicon.ico', 'wb');
    fwrite($out, $contents, $len);
    fclose($out);
    echo '<p>Written Favicon.ico.</p>';
?>

PHP Hacker

Posted 2010-06-29T02:16:45.830

Reputation: 19

1This might be work but its pretty overkill and doesn't match the OP's request for downloading it from Windows/Firefox. If you're going to use PHP, you might as well search for the link reference within the source code. – wag2639 – 2014-10-04T23:10:26.067

0

The favicon url maybe different from www.example.com/favicon.ico.

Simply right click on page and click on View Page Source, then you can find the favicon link in head tag!

e.g. :

<link href="/MyFavicon.ico" type="image/x-icon" rel="shortcut icon"/>

Ahmad Mobaraki

Posted 2010-06-29T02:16:45.830

Reputation: 111

0

just copy the url from the address bar and take the website and right-click and select view source or on the address bar type:view-source:website address.If you want to get the icon of facebook,just type, view-source:http://www.facebook.com and just press Ctrl and F together and type .ico and you will see a link.In that there will be a text with .ico highlighted with green color.Press that link.You will see the icon.Right click > Save Image As and then give name and save it.

Blestin V Bency

Posted 2010-06-29T02:16:45.830

Reputation: 1