Favicon and ICO Generator
Operator: Abdulla Al Fahad. How tools are built and checked
A site needs its icon in more than one place: the browser tab, the bookmarks bar, a phone's home screen and Android's app switcher all ask for different sizes, and older tools and search crawlers still look for a file called favicon.ico at the root of the domain. Making each size by hand in an image editor is tedious, and exporting a real multi-image ICO file is something many editors cannot do at all.
Favicon and ICO Generator takes one square image and produces the whole set in a ZIP: favicon.ico holding 16, 32 and 48 px icons, favicon-16x16.png, favicon-32x32.png, a 180 px apple-touch-icon.png, and android-chrome-192x192.png and android-chrome-512x512.png. It also prints the link tags and a manifest fragment to paste into your site, adjusted for the folder you serve the icons from.
Key features
- favicon.ico with 16, 32 and 48 px images, written with its own ICONDIR and ICONDIRENTRY headers
- 32-bit BMP icon entries with an alpha channel and a 1-bit AND mask
- PNG files at 16, 32, 180, 192 and 512 px
- Centre crop or transparent padding for images that are not square
- Optional solid background for the Apple touch icon only
- Copyable link tags and manifest fragment for the folder you choose, with the folder text escaped
Inside the favicon.ico this tool writes
An ICO file is a small directory followed by images. It starts with a 6-byte ICONDIR (reserved zero, type 1 for icons, and the number of images), then one 16-byte ICONDIRENTRY per image giving its width, height, bit depth, byte length and offset. This tool writes those headers itself rather than relying on a library, and the directory in every favicon.ico it makes reads count 3 with entries of 16, 32 and 48 px.
Each entry can hold either PNG data or a headerless BMP. Current browsers read PNG entries, but some older Windows components and site-icon crawlers only understand the BMP form, so the three icons here are stored as BMP: a 40-byte BITMAPINFOHEADER whose height field is doubled, 32-bit pixels in blue-green-red-alpha order with the bottom row first, then a 1-bit AND mask. The alpha channel carries the real transparency; the mask marks pixels under 50% opacity as transparent for readers that ignore alpha.
Because BMP entries are uncompressed, the file size is fixed by the sizes alone: 1,128 bytes for the 16 px image (header, 1,024 bytes of pixels, 64 bytes of mask), 4,264 bytes for 32 px and 9,640 bytes for 48 px. With the 54 bytes of directory, every favicon.ico from this tool is exactly 15,086 bytes whatever the picture.
How it works
Once the logo is accepted, its width and height are compared. If they differ, the crop-or-pad choice appears and centre crop is used until you change it: crop keeps the middle square of the shorter side, pad centres the whole image on a transparent square of the longer side. Either way, that square is drawn onto a working canvas of up to 2048 px, and every file in the ZIP is cut from it.
Each output size is made from that square by halving it repeatedly until it is less than twice the target, then drawing it at the final size. Stepping down in halves keeps thin strokes from breaking up the way a single large reduction can. The square is scaled the same amount in both directions, so a 512 px source becomes a 180 px Apple icon without any stretching.
For the ICO, the 16, 32 and 48 px canvases are read back as raw pixels and rewritten as BMP icon data, then the directory headers and offsets are computed and the three images appended. The PNG files are encoded by the canvas, and all seven files go into one ZIP built with JSZip in the page.
Typical uses
- A freelancer finishing a client's small business site turns the client's 1000 × 1000 PNG logo into the full set and drops the files into the site's public folder.
- A developer replaces the default framework favicon in a new project before the first deploy, using the snippet with the folder set to /icons/.
- A blogger whose logo is a wide wordmark crops the centre letter mark from it so the tab icon is still readable at 16 px.
- A team building an internal dashboard pads a rectangular logo with transparency instead of cropping it, because cutting off the edges would remove part of the name.
- A maintainer of an open-source documentation site regenerates the icon set after a small logo colour change and replaces the files in one go.
Building one
- Drop a square logo or icon onto the upload area, or click to choose one.
- If the image is not square, choose Crop the centre or Pad with transparency.
- Optionally give apple-touch-icon.png a solid background colour.
- Check the previews in the file list, then click Download ZIP.
- Set the folder your site will serve the files from and copy the HTML and manifest snippets.
Example
Input: logo.png, 1200 × 800 px, not square
Crop the centre → middle 800 × 800 square (x 200 to 1000)
Pad with transparency → 1200 × 1200, 200 px transparent bars above and belowOutput: favicons.zip with seven files
favicon.ico 15,086 bytes (16, 32, 48 px, 32-bit BMP)
favicon-16x16.png 16 × 16
favicon-32x32.png 32 × 32
apple-touch-icon.png 180 × 180
android-chrome-192x192.png 192 × 192
android-chrome-512x512.png 512 × 512Tips for best results
- Start from at least 512 × 512 px. Every output is then a reduction, and the 512 px Android icon avoids being enlarged only when the source square is 512 px or bigger.
- Simplify the artwork for the small sizes. A full logo with a tagline turns into grey noise at 16 px; a single letter or symbol on a solid shape survives.
- Look at the 16 px preview at its true size in the file list. If you cannot tell what it is there, neither will someone scanning a row of tabs.
- Give the Apple touch icon a solid background colour if your logo is on transparency. The option fills only that one file and leaves the others transparent.
- Serve the files from the site root when you can. Some crawlers and older browsers request /favicon.ico directly without reading your link tags.
Things to check before you rely on it
iOS shows transparent pixels in apple-touch-icon.png as black on the home screen. A dark logo on transparency becomes a dark shape on black. Tick the background option and pick a colour before downloading.
Centre crop removes whatever lies outside the middle square. A 1200 × 800 logo loses 200 px from each side, so a wordmark spelled across the full width will lose its first and last letters. Switch to Pad with transparency, or crop the source yourself around the part you want.
Pad mode keeps the whole image but makes it smaller inside the square. The same 1200 × 800 logo padded to 1200 × 1200 fills only two thirds of the height, which at 16 px may leave a thin, hard-to-read strip.
The ICO contains only 16, 32 and 48 px. Windows can show a larger icon for a pinned site or desktop shortcut and will enlarge the 48 px image for it, which looks soft. Sizes such as 64 or 256 are not included.
The tool does not write site.webmanifest. The Android icons are only picked up when your manifest lists them, which is why a ready-to-paste icons fragment is shown under the HTML snippet.
Common errors and how to fix them
- A warning says the square is smaller than 512 px and some icons will be enlarged.
- The source, after cropping or padding, is smaller than the largest output. The set still works, but the 512 px and possibly the 192 and 180 px icons will be soft. Use a larger export of the logo, or an SVG rendered to a large PNG first.
- The browser tab still shows the old icon after uploading the new files.
- Browsers cache favicons aggressively. Open the icon URL directly and refresh it, or add a version query such as ?v=2 to the href values in your link tags.
- An existing favicon.ico or an SVG logo cannot be used as the source.
- The generator only reads bitmap logos in PNG, JPG or WEBP. Open the SVG in your design tool and export a PNG of 512 px or more. Don't feed an old favicon.ico back in: its largest image is usually 48 px, too small for the 180, 192 and 512 px outputs. The new ZIP replaces it anyway, with favicon.ico, favicon-16x16.png, favicon-32x32.png, apple-touch-icon.png, android-chrome-192x192.png and android-chrome-512x512.png.
- The home-screen icon on an iPhone has a black background.
- Your logo has transparent areas. Regenerate the set with the solid background option for the Apple touch icon switched on, and replace apple-touch-icon.png on your server.
Best practices
- Keep the master logo as a large PNG or vector file and regenerate the whole set from it, rather than resizing one of the small outputs.
- Leave a little margin around the mark. Some launchers show icons inside circles or rounded squares, which clips anything that touches the edge.
- Commit the icons to your site's repository with the rest of the static files so the set stays in step with the code that links to it.
- Test the result in a light and a dark browser theme; a black logo on transparency vanishes on a dark tab strip.
Why the ICO uses BMP entries instead of PNG
Since Windows Vista, an ICO entry may simply contain a complete PNG file, and browsers handle that well. The catch is the long tail of other readers: older Windows shell code, some feed readers and some site-icon fetchers still expect the original BMP layout and show nothing for a PNG entry. At 16, 32 and 48 px the size cost of BMP is small, so this tool takes the compatible route for those three images and leaves PNG for the separate files, where it is the expected format.
The BMP form has one quirk worth knowing if you inspect the file: the height in the bitmap header is twice the real height, because the colour pixels and the transparency mask are counted as two stacked images. A 32 px entry therefore says 32 × 64 inside, while its directory entry says 32 × 32.
What the snippet does with the folder you type
The folder box adds a leading and trailing slash, so icons becomes /icons/ and an empty box means the site root. A full https:// address is kept as typed, with a slash added at the end. The value is escaped before it is placed inside the href attributes, so a quote or angle bracket in the box cannot break out of the tag you paste, and in the manifest fragment it is escaped as a JSON string.
The ICO link tag declares sizes="48x48" for its largest image. Browsers that read the sizes attribute can choose between the ICO and the 16 and 32 px PNGs for the tab, and software that ignores the tags still finds /favicon.ico if the files sit at the root.
Frequently asked questions
Which sizes are inside favicon.ico?
Three: 16 × 16, 32 × 32 and 48 × 48, each as a 32-bit image with transparency. The directory at the start of the file lists them in that order.
Do I need both favicon.ico and the PNG files?
Modern browsers are happy with the PNGs and the link tags. The ICO is for anything that asks for /favicon.ico by name without reading the page, which still includes some crawlers and older software. It is small, so most sites keep both.
Can I use a JPG logo?
Yes, but a JPG has no transparency, so its white or coloured background becomes part of every icon. If the logo needs to sit cleanly on tabs of any colour, start from a PNG with a transparent background.
Why is the ZIP not much smaller than the files inside it?
The files are stored without extra compression. PNG data is already compressed, and the ICO is only about 15 KB, so recompressing would save little.