If your Blazor app works but its tab shows a generic document icon, the cause is usually a missing static file or head link. A reliable Blazor favicon needs both: an asset served by the app and a rel='icon' link in the document head. The same approach works across Blazor's common hosting models.

Prerequisites

You need an existing Blazor project, its .NET SDK, and a square logo. If your source is PNG, use Mzu favicondl to create SVG, ICO, and PNG variants.

1. Identify the template and its head file

Open the file named above and inspect its head. In a Blazor Web App, edit Components/App.razor; in standalone WebAssembly, edit wwwroot/index.html. In hosted WebAssembly, edit the client index, but verify that the deployed server serves its assets. If an older template uses Pages/_Host.cshtml, edit that document instead. Keep the global icon out of ordinary page components, where it may apply to only one route.

2. Prepare a small icon set

Create one folder for every variant:

wwwroot/
└── favicon/
    ├── favicon.svg
    ├── favicon.ico
    └── apple-touch-icon.png

Place these files under wwwroot so they publish as static web assets. We recommend a scalable SVG, an ICO containing 16, 32, and 48 px images, and an optional 180×180 PNG for touch shortcuts. Use square artwork with padding and remove tiny text; it disappears at 16 px. Convert or package the files with Mzu favicondl.

3. Add the Blazor favicon links to the document head

Add the global links inside the same head that contains the base URL and stylesheet links:

<head>
  <base href='/' />

  <link rel='icon' href='favicon/favicon.ico'
        sizes='16x16 32x32 48x48' />
  <link rel='icon' type='image/svg+xml'
        href='favicon/favicon.svg' />
  <link rel='apple-touch-icon' sizes='180x180'
        href='favicon/apple-touch-icon.png' />
</head>

These relative URLs follow the app's base path instead of assuming the domain root. The HTML Standard's rel='icon' definition describes an external resource icon; type and sizes describe the file. Keep the ICO link as a fallback, and define one global set rather than repeating it in every component.

4. Update WebAssembly projects

For standalone WebAssembly, paste the same links into the head of wwwroot/index.html. For hosted WebAssembly, add them to the client index, publish the solution, and inspect the server output:

dotnet publish -c Release

Confirm the published wwwroot contains the favicon folder. If not, copy it into the host's wwwroot or adjust static-asset publishing. The client index can work while an icon still returns 404.

5. Check static-file serving

If a direct icon request returns 404, inspect Program.cs for app.UseStaticFiles() or an existing static-assets endpoint mapping. If neither exists, insert this before routing and endpoint registration:

app.UseStaticFiles();

Do not replace the pipeline or duplicate existing static-asset handling. Pages can render while /favicon/favicon.ico fails when this step is missing. Standalone WebAssembly does not need ASP.NET Core middleware because its published output is a static site.

6. Verify the file and the browser tab

Run the project with dotnet run, replace 5000 below with the printed port, and request both files directly:

curl -I http://localhost:5000/favicon/favicon.ico
curl -I http://localhost:5000/favicon/favicon.svg

Each response should return 200 and an image content type. View the page source and confirm the link elements are in the head. If the HTML is correct but the tab shows the old icon, open a new tab or private window and inspect the Network panel. A normal hard refresh may not replace an already cached icon.

Repeat the check on the deployed URL. Localhost success does not prove production uses the same base path or serves the same files.

Common pitfalls

Conclusion

Match the hosting model to the head file, put assets under wwwroot, and declare relative global URLs. Test the files directly before debugging the tab. For nonstandard server setup, see the broader ASP.NET Core favicon setup reference.