Favicon HTML Code Generator
Choose your file set and generate precise, copy-ready icon markup.
Root-relative paths keep the same icon URLs on nested pages.

Generate one accurate favicon declaration stack
The generator assembles standards-based link elements for the files you actually ship. Each line describes a separate candidate or surface: scalable browser artwork, raster browser fallback, conventional ICO, Apple touch icon, or web app manifest. Removing unused lines is safer than publishing a long contradictory stack.
Choose the base path by deployment
Use / when files live at the hostname root. Use /assets/icons/ for a stable public directory, a repository prefix for a subpath deployment, or an absolute HTTPS origin when a CDN owns the files. Confirm the generated URL from a deeply nested page.
Keep attributes honest
type must match the response format, and sizes must match the image dimensions. SVG uses sizes="any" because it scales; the Apple line names its dedicated 180×180 image; the manifest link points to JSON rather than an icon.
Install in shared document metadata
Paste the snippet inside the shared head used by every indexable page. Avoid adding the same candidates from a framework convention, plugin, theme, and manual template at once—inspect final rendered HTML for duplicates.
Common path failures the snippet cannot hide
A relative path without a leading slash can resolve below the current page, so an icon may work on / and fail on /products/example. A root-relative path can fail when the whole application is intentionally hosted below /project/. A hard-coded HTTP URL can be blocked on an HTTPS page. Select a base path that describes production, not the source directory on your computer.
Markup also cannot create missing files. After deployment, request every generated href directly and verify status, final URL, Content-Type, dimensions, and cache headers. Check the manifest and each manifest icon independently.
A lean modern output matrix
Use SVG as the crisp browser candidate when available, a 48×48 PNG and multi-frame root ICO as raster and compatibility fallbacks, a 180×180 Apple touch icon, and a manifest containing ordinary and maskable 192×192 and 512×512 PNGs. Add historical standalone sizes only for a documented client requirement.
Read the full HTML reference →From favicon idea to verified deployment
Follow one clear path through creation, inspection, installation, and troubleshooting.