Home / SEO and Site Tools / Favicon Generator

Favicon Generator in JavaScript, Free with Live Demo

Free favicon generator in plain JavaScript. Make an icon from a letter or upload an image, preview it in a browser tab, download 16 to 512 pixel PNGs, and copy the HTML and manifest.

Open live demoDownload HTML fileView code on GitHub
Favicon Generator JavaScript project: a tool that makes every favicon size and a web manifest from a letter or an image

Runs on: Canvas 2D. Works in all modern browsers.

What is the Favicon Generator?

A favicon maker. Type one or two letters, choose colours and a shape, or upload a square picture, and see the icon in a pretend browser tab.

It makes six PNG sizes from 16 to 512 pixels for tabs, phones and app installs, and gives you the HTML link tags and a web manifest file.

Good for

  • New websites and landing pages
  • Web apps you want people to install
  • Client projects that need a quick icon
  • Replacing a blurry old favicon

What this project does

How it works

  1. Draw once per sizeEach size is drawn fresh on its own canvas, not scaled down from a big one, so small icons stay crisp.
  2. Shapes with clipA rounded rectangle, circle or square clip is applied before drawing, so letters and photos fit the chosen shape.
  3. Code that goes with itThe tool writes the link tags for the head and a web manifest for phones and app installs.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

function icon(size, letter, bg, fg) {
  const c = document.createElement("canvas");
  c.width = c.height = size;
  const x = c.getContext("2d");
  x.beginPath(); x.roundRect(0, 0, size, size, size * 0.22); x.clip();
  x.fillStyle = bg; x.fillRect(0, 0, size, size);
  x.fillStyle = fg; x.textAlign = "center"; x.textBaseline = "middle";
  x.font = `800 ${size * 0.62}px sans-serif`;
  x.fillText(letter, size / 2, size / 2);
  return c.toDataURL("image/png");
}

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

Do I still need a favicon.ico file?

Most browsers now use PNG icons from link tags. An .ico file in the site root is only a fallback for very old browsers.

Which sizes matter most?

32 pixels for browser tabs, 180 for iPhones and 192 and 512 for Android and installs.

What is a maskable icon?

An icon with extra padding so Android can crop it into circles or other shapes without cutting off the design.

More SEO and Site Tools projects