Back to blog
Jan 04, 2025
2 min read

How to get website icon

如何获取一个网站的icon?

A favicon, short for “favorite icon,” is a small, typically 16x16 pixel icon that represents a website or webpage. It’s usually displayed on browser tabs, in bookmark lists, and in other places where a website needs to be visually identified. Here’s how you can get a website’s favicon:

  1. Check the root directory:
  • Many websites store their favicon as a file named favicon.ico in their root directory.
  • To access it, simply add /favicon.ico to the end of the website’s URL (e.g., www.example.com/favicon.ico). If the file exists, your browser should download or display it.
  1. Inspect the page’s HTML source code:
  • Most websites declare the location of their favicon in the <head> section of their HTML code.
  • To view the source code, right-click anywhere on the webpage and select “View Page Source” or “Inspect.”
  • Search (Ctrl + F) for <link rel="shortcut icon" or <link rel="icon". This tag usually contains the URL of the favicon in the href attribute.
  • Copy the URL from the href attribute and paste it into your browser to access the favicon image.
  • Some websites may use .png or other image extensions for their favicon file.
  1. Use browser tools:
  • Firefox: Right-click on the website, select “View Page Info,” and go to the “Media” tab. You should see all the images used on the site, including the favicon.
  • Chrome: In the address bar, enter chrome://favicon/ followed by the website’s URL. This should load and display the favicon.
  • Chrome Extension: Look for “Get Favicon” extensions in the Chrome Web Store to download the favicon.
  1. Online Favicon Extractor Tools:
  • There are a variety of online tools designed to extract favicons. These tools typically work by having you input a website’s URL, and then they locate and display the Favicon for you to download.
  • Examples include webutility.io and realfavicongenerator.net.
  1. Google’s Favicon Service:
  • Google provides a service that helps you get a favicon by using the following syntax: https://www.google.com/s2/favicons?domain=[website URL], replacing [website URL] with the desired website such as https://www.google.com/s2/favicons?domain=github.com
  1. Other Methods:
  • Some websites may store the favicon in a different location or use different file types.
  • There are also browser extensions you can download that will help you save favicon files from websites.

In summary, there are multiple ways to get a website icon including checking the root directory, inspecting the page’s HTML, using browser tools, using an online favicon extractor tool and using Google’s favicon service.

https://www.wix.com/blog/what-is-favicon-how-to-make

https://www.favicon-generator.org/

https://stackoverflow.com/questions/1378260/how-can-i-retrieve-a-website-icon

https://stackoverflow.com/questions/5119041/how-can-i-get-a-web-sites-favicon

https://superuser.com/questions/532616/grab-favicon-ico-using-google-chrome-dev-tools

https://webutility.io/favicon-extractor

https://stackoverflow.com/questions/46370623/web-development-how-to-get-favicon