A free, fast, and reliable favicon API service powered by Cloudflare Workers.
π¨π³ δΈζζζ‘£ | π Detailed Docs | π Live Demo
- π Ultra Fast: Global edge deployment with 20-50ms response time
- π Global CDN: 200+ edge nodes worldwide
- β‘ Triple Cache: Browser β Edge β KV Storage (95%+ hit rate)
- π Smart Fallback: Multiple favicon sources ensure 99.9% success rate
- π± Multi-Format: Image, JSON, and redirect response formats
- π‘οΈ CORS Ready: Direct browser integration support
- π° Free Tier: 100K requests/day at no cost
# Get favicon as JSON
curl "https://faviconsnap.com/api/favicon?url=https://github.com"
# Get direct image redirect
curl "https://faviconsnap.com/api/favicon?url=https://github.com&format=redirect"// Fetch favicon data
const response = await fetch('https://faviconsnap.com/api/favicon?url=https://github.com');
const data = await response.json();
if (data.success) {
console.log('Favicon URL:', data.favicon);
}
// Direct image usage
document.getElementById('favicon').src =
'https://faviconsnap.com/api/favicon?url=https://github.com&format=redirect';<!-- Direct image element -->
<img src="https://faviconsnap.com/api/favicon?url=https://github.com&format=redirect"
alt="Site favicon" width="32" height="32">GET https://faviconsnap.com/api/favicon
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
url |
string | β | Target website URL | - |
size |
number | β | Icon size (16/32/64/128) | 32 |
format |
string | β | Response format (json/redirect) | json |
nocache |
boolean | β | Skip cache, force refresh | false |
{
"success": true,
"url": "https://github.com",
"favicon": "https://github.githubassets.com/favicons/favicon.svg",
"size": "32x32",
"source": "html",
"cached": true,
"cacheSource": "kv",
"cachedAt": "2024-01-15T10:30:00Z"
}HTTP/1.1 302 Found
Location: https://github.githubassets.com/favicons/favicon.svg# Clone the repository
git clone https://github.com/websitesnap/faviconsnap.git
cd faviconsnap
# Login to Cloudflare
wrangler auth login
# Smart deployment - automatically detects and configures everything
./deploy.sh# Force reconfigure everything (KV storage, config files)
./deploy.sh --setup
# Deploy only (skip configuration checks)
./deploy.sh --deploy-only
# Skip post-deployment tests
./deploy.sh --skip-tests
# Show all available options
./deploy.sh --help# Manual configuration
cp wrangler.toml.example wrangler.toml
# Edit wrangler.toml with your actual values
wrangler deployπ‘ Smart Deploy: The
deploy.shscript intelligently detects your setup status and automatically initializes configuration or deploys accordingly. SeeDEPLOY_USAGE.mdfor detailed instructions.
The intelligent deployment script automatically:
- Detects Configuration: Checks if wrangler.toml exists and is properly configured
- Creates KV Storage: Automatically creates and configures KV namespaces if needed
- Validates Setup: Performs comprehensive pre-deployment checks
- Tests Deployment: Verifies functionality after deployment
- Provides Feedback: Shows detailed deployment information and troubleshooting tips
π For detailed deployment instructions, see README_ZH.md
User Request β [Browser Cache] β [Edge Cache] β [KV Storage] β Origin Fetch
1-2 hours 1 hour 7 days
- HTML Parsing: Extract favicon links from HTML
<link>tags - Standard Paths: Check common paths (
/favicon.ico,/favicon.png) - Apple Touch Icon: Support for mobile icons
- Third-party Services: Google S2 and Yandex as fallbacks
- Response Time: 20-50ms (cached), <500ms (uncached)
- Cache Hit Rate: 95%+
- Global Coverage: 200+ edge locations
- Uptime: 99.9% availability guarantee
- Website navigation tools
- Bookmark managers
- Link preview features
- Website analytics dashboards
- Browser extensions
- Mobile applications
Cloudflare Workers Free Tier:
- 100K requests/day: Free
- Additional requests: $5/month + $0.30/million requests
KV Storage:
- ~$1.50/month for typical usage
- Significant performance improvement
We welcome contributions! Please see our Contributing Guide.
- Fork the project
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Cloudflare Workers - Serverless edge computing platform
- Google S2 Favicon API - Favicon service
- Yandex Favicon Service - Alternative favicon service
- π¨π³ Complete Chinese Documentation
- β‘ Cache System Guide
- π Deployment Guide
- π§ Configuration Guide
- π§ͺ Testing & Monitoring
Visit https://faviconsnap.com to try the service online! (English interface with automatic favicon loading)
If this project helps you, please consider giving it a β Star!
Made with β€οΈ by the FaviconSnap team