Favicon Setup for Next.js — Complete Guide for App Router and Pages Router
Try the workflow
Generate your Next.js favicon files
FreeFaviconGen creates all required favicon sizes for Next.js including 16x16, 32x32, 180x180, 192x192, and 512x512. Download the full pack and follow this guide.
App Router: The favicon.ico Approach
In Next.js App Router (Next.js 13+), the simplest approach is placing a favicon.ico file in your app/ directory. Next.js automatically serves it at /favicon.ico and adds the correct link tag to the HTML head. For additional PNG sizes and the Apple Touch Icon, use the metadata icons API or add link tags in your root layout.tsx.
App Router: Metadata API for All Sizes
For full favicon coverage in App Router, use the metadata icons field in your root layout.tsx. Place all favicon files in your public/ directory. Generate them with FreeFaviconGen first, then reference them in the icons metadata field.
Pages Router: Direct Head Tag Approach
In Next.js Pages Router, add favicon link tags to _document.tsx or use the Head component from next/head in _app.tsx. Copy the HTML snippet from FreeFaviconGen's Code Snippets section directly into your Head component. Place all favicon files in the public/ directory.
PWA Support in Next.js
For PWA support, create a manifest.json (or site.webmanifest) file in your public/ directory and reference it in your HTML head or metadata. FreeFaviconGen generates a complete manifest.json snippet in the Code Snippets section. Customize the name, short_name, theme_color, and background_color values to match your app.
Frequently Asked Questions
Try the workflow
Generate your Next.js favicon files
FreeFaviconGen creates all required favicon sizes for Next.js including 16x16, 32x32, 180x180, 192x192, and 512x512. Download the full pack and follow this guide.