Favicon API & URL Guide

Copy-ready favicon URL templates (based on free services).

Overview

Mzu favicondl provides copy-ready favicon URL templates and a favicon extractor UI. By default, it uses a Cloudflare Worker to discover real icons and proxy images for downloads.

Fast

Optimized fetching for quick preview

Free

No signup required

Reliable

Designed for high availability

Authentication

This project uses free Favicon services URL templates, no authentication or API Key is required.

Note: Although we don't require an API Key, please use the service reasonably to avoid excessive requests.

Endpoints

GET FaviconDL Extract API

Find and download a usable favicon for a domain or URL

Base URL:

https://favicondl.com/api/extract

Full Example:

https://favicondl.com/api/extract?url=example.com&size=128

Parameters

Parameter Name Type Required Default Value Description
url string Yes - The target domain or URL, e.g. example.com
size number No 128 The preferred icon size in pixels, clamped to 16-512
format string No redirect Use json for metadata; omit it for a downloadable image redirect

Parameter Details:

url

Supports domains and full website URLs:

  • • example.com
  • • www.example.com
  • • https://example.com/docs
  • • sub.example.com
size

Preferred icon size, from 16 to 512 pixels:

  • • 16 - 16x16
  • • 32 - 32x32
  • • 128 - 128x128
  • • 512 - 512x512 when supported

Responses

Successful Response (JSON format)

JSON Response
{
  "ok": true,
  "domain": "example.com",
  "size": 128,
  "iconUrl": "https://example.com/favicon.svg",
  "proxyUrl": "https://favicondl.com/api/proxy?url=...",
  "source": "html"
}

Error Response

Error Response
{
  "success": false,
  "error": "Domain not found",
  "message": "Unable to find favicon for the specified domain",
  "code": 404,
  "timestamp": "2026-01-15T10:30:00Z"
}

Note: When using format=redirect, the API will directly redirect to the favicon URL without returning a JSON response.

Examples

JavaScript (Fetch)

JavaScript
async function getFavicon(url, size = 128) {
  const endpoint = new URL('https://favicondl.com/api/extract');
  endpoint.searchParams.set('url', url);
  endpoint.searchParams.set('size', String(size));
  const response = await fetch(endpoint);
  if (!response.ok) throw new Error(`Favicon request failed: ${response.status}`);
  return await response.blob();
}

const icon = await getFavicon('example.com', 128);
const imageUrl = URL.createObjectURL(icon);
document.querySelector('#favicon-preview').src = imageUrl;

Python (Requests)

Python
import requests

def get_favicon(url: str, size: int = 128) -> bytes:
    response = requests.get(
        "https://favicondl.com/api/extract",
        params={"url": url, "size": size},
        timeout=15,
    )
    response.raise_for_status()
    return response.content

icon_bytes = get_favicon("example.com", 128)
with open("example-favicon", "wb") as output:
    output.write(icon_bytes)

PHP (cURL)

PHP

HTML Direct Reference

HTML
<!-- 在HTML中直接引用favicon -->
<img src="https://favicondl.com/api/extract?url=example.com&size=32" alt="example.com favicon" width="32" height="32">

<!-- 使用大尺寸图标 -->
<img src="https://favicondl.com/api/extract?url=example.com&size=128" alt="example.com favicon" width="128" height="128">

<!-- 作为网站favicon -->
<link rel="icon" type="image/png" href="https://favicondl.com/api/extract?url=example.com&size=32">

Errors

The API returns the corresponding HTTP status code and error message when an error occurs.

HTTP Status Code Error Code Description Solution
400 invalid_domain Invalid domain format Check the domain format, ensure it is a valid domain
404 domain_not_found Domain not found Confirm the domain is correct and the website is accessible
404 favicon_not_found Favicon not found The website may not have set a favicon
429 rate_limit_exceeded Rate limit exceeded Reduce the request frequency and try again later
500 internal_error Internal server error The service is temporarily unavailable, please try again later

Rate Limits

Free

No registration required, completely free to use all features

Rate Limit

  • • Up to 100 requests per minute
  • • Up to 1000 requests per hour
  • • Up to 10000 requests per day

Commercial Use

Commercial users are recommended to contact us for a higher usage quota and priority support

Copied!