Google API to Fetch Favicons for any domain

Use this unknown Google API to fetch the favicon image for any domain/subdomain with the ability to specify a custom size as well!

https://www.google.com/s2/favicons?domain=<domain_name>&sz=<size>

Do not forget or remo…


This content originally appeared on DEV Community and was authored by Simplr

Use this unknown Google API to fetch the favicon image for any domain/subdomain with the ability to specify a custom size as well!

https://www.google.com/s2/favicons?domain=<domain_name>&sz=<size>

Do not forget or remove the www part, the API doesn't work without it.

  1. Replace the <domain_name> with the domain/subdomain URL you wish to get the Favicon for.
  2. Replace the <size with a number in pixels you would like the image to be returned in.

By default the Favicon image returned is 16x16 pixels, the same applies if the specified size is not found or incorrect.

The API redirects you to a cached URL and response which make using it very fast as it is backed by Google's own world-leading CDN infrastructure.

For Example:

https://www.google.com/s2/favicons?domain=jsdelivr.com&sz=64

Redirects you to the URL https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://jsdelivr.com&size=64 which displays the following Favicon image

jsDelivr Favicon

If a favicon for the domain is not found, it returns a weird image probably not suitable to be displayed or used anywhere so someway of finding a fallback path would be nice.

Favicon Not Found image:
Image description


This content originally appeared on DEV Community and was authored by Simplr


Print Share Comment Cite Upload Translate Updates
APA

Simplr | Sciencx (2025-01-11T16:00:24+00:00) Google API to Fetch Favicons for any domain. Retrieved from https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/

MLA
" » Google API to Fetch Favicons for any domain." Simplr | Sciencx - Saturday January 11, 2025, https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/
HARVARD
Simplr | Sciencx Saturday January 11, 2025 » Google API to Fetch Favicons for any domain., viewed ,<https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/>
VANCOUVER
Simplr | Sciencx - » Google API to Fetch Favicons for any domain. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/
CHICAGO
" » Google API to Fetch Favicons for any domain." Simplr | Sciencx - Accessed . https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/
IEEE
" » Google API to Fetch Favicons for any domain." Simplr | Sciencx [Online]. Available: https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/. [Accessed: ]
rf:citation
» Google API to Fetch Favicons for any domain | Simplr | Sciencx | https://www.scien.cx/2025/01/11/google-api-to-fetch-favicons-for-any-domain/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.