Favicon Generator: how it works and how to build one
Make favicon.ico, Apple touch and PWA icons from one image. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
Turn a logo into favicon.ico (16, 32 and 48 px inside one file), apple-touch-icon.png (180 px) and 192/512 px PWA icons. Add padding, rounded corners or a background, and copy the HTML tags and site.webmanifest.
When to use it
- New websites
- Web apps that can be installed (PWA)
- Updating a brand icon
How to use it
- Choose your logo, ideally square and 512 px or larger.
- Adjust padding, corners and background.
- Download favicon.ico and the PNGs, and paste the HTML into your <head>.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/favicon-generator
How it works
Browsers and phones want several icon sizes: 16 and 32 for tabs, 180 for iPhone home screens, 192 and 512 for Android and PWAs. The generator draws the source image onto a canvas at each size.
favicon.ico is a small container format: a header, one directory entry per image, then the images. Modern ICO files can hold PNG data directly, so the tool writes the header bytes and appends the PNGs.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.
ico.ts (ts)
export function buildIco(pngs: { size: number; data: Uint8Array }[]) {
const header = 6 + 16 * pngs.length;
const total = header + pngs.reduce((s, p) => s + p.data.length, 0);
const buf = new Uint8Array(total), v = new DataView(buf.buffer);
v.setUint16(2, 1, true); v.setUint16(4, pngs.length, true); // type 1 = icon
let offset = header;
pngs.forEach((p, i) => {
const e = 6 + i * 16;
buf[e] = p.size >= 256 ? 0 : p.size; buf[e + 1] = p.size >= 256 ? 0 : p.size;
v.setUint16(e + 4, 1, true); v.setUint16(e + 6, 32, true); // planes, bits per pixel
v.setUint32(e + 8, p.data.length, true); v.setUint32(e + 12, offset, true);
buf.set(p.data, offset); offset += p.data.length;
});
return new Blob([buf], { type: "image/x-icon" });
}
Make it production-ready
- Generate the <link> tags and site.webmanifest alongside the icons.
Questions
Do I still need favicon.ico?
Yes. Some browsers, bookmarks and tools still request /favicon.ico first, so keep it alongside the PNG icons.
Free, runs in your browser, nothing is uploaded.