Ad Below header placement
Ad Promote your brand here

Favicon generator API

Developer API documentation for generating favicons programmatically.

Open this page in a browser for documentation. Send POST requests to the generate endpoint to create favicon packages, then download the returned ZIP, ICO, PNG, manifest or HTML tag files.

Parameters

text: string
image: file
sizes[]: 16
sizes[]: 32
sizes[]: 48
sizes[]: 64
sizes[]: 192
sizes[]: 512
background: #2563eb
background_type: solid|linear-gradient
gradient_start: #2563eb
gradient_end: #7c3aed
font: arial|roboto|opensans|montserrat
font_size: 260
text_color: #ffffff
crop_mode: cover|contain|exact
theme_color: #2563eb
site_name: My Website
short_name: MySite
Ad API documentation placement

Tutorial

  1. Send a POST request to the generate endpoint with multipart form data.
  2. Send either text or an image file. Text generation is best for initials and simple brand marks.
  3. Include sizes[] values for every icon size you want in the package.
  4. Check that the JSON response contains ok:true and copy the returned token.
  5. Download the ZIP package or individual generated files using the token.

cURL

curl -X POST "/api/generate" \
  -F "text=HN" \
  -F "sizes[]=16" \
  -F "sizes[]=32" \
  -F "sizes[]=192" \
  -F "sizes[]=512" \
  -F "background=#2563eb" \
  -F "text_color=#ffffff" \
  -F "font=arial"

JavaScript fetch

const formData = new FormData();
formData.append('text', 'HN');
formData.append('sizes[]', '16');
formData.append('sizes[]', '32');
formData.append('sizes[]', '192');
formData.append('sizes[]', '512');
formData.append('background', '#2563eb');
formData.append('text_color', '#ffffff');

const response = await fetch('/api/generate', {
    method: 'POST',
    body: formData
});

const result = await response.json();

if (!result.ok) {
    throw new Error(result.error);
}

window.location.href = '/public/download.php?token=' + encodeURIComponent(result.token) + '&file=favicon-pack.zip';

PHP example

$endpoint = '/api/generate';
$download = '/public/download.php';

$fields = [
    'text' => 'HN',
    'sizes[]' => ['16', '32', '192', '512'],
    'background' => '#2563eb',
    'text_color' => '#ffffff',
    'font' => 'arial',
];

$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

$response = curl_exec($ch);
$result = json_decode($response, true);
curl_close($ch);

if (!empty($result['ok'])) {
    header('Location: ' . $download . '?token=' . urlencode($result['token']) . '&file=favicon-pack.zip');
    exit;
}

echo htmlspecialchars($result['error'] ?? 'Generation failed', ENT_QUOTES, 'UTF-8');

API tips

For web favicons include 16, 32, 192 and 512. Add 48 or 64 when you need larger browser or shortcut icons.

For text favicons, keep the custom text to one to four characters for the best small-size readability.

For image uploads, use a clear square source image. The API accepts JPEG, PNG, GIF, BMP and SVG up to 2 MB.

Always check the JSON response before downloading. If ok is false, show the error message to the user.

For production, require an API key, validate the origin, increase rate-limit controls and clean old generated folders.

Troubleshooting

Method not allowed: Use POST /api/generate. GET /api is the documentation page.

Invalid image: Use a supported image format under 2 MB and no larger than 4096 pixels.

Too many requests: Wait a moment or increase the server-side rate limit for your own deployment.

For production, add API keys, stronger rate limits and authentication before exposing this endpoint publicly.