How to Change a Favicon in Laravel, Including SVG Favicons
Change the favicon in a Laravel app: replace the files in the public folder, reference them in your Blade layout, add an SVG icon with fallbacks, and clear stale browser caches.
Contents
The short answer
Laravel serves static files from the public directory, and a default Laravel project includes a placeholder favicon.ico there. To change the favicon, replace that file with your own icon, or add new icon files such as favicon.svg next to it. Then make sure the head of your main Blade layout points to them with link tags. Browsers request favicon.ico from the site root automatically, so replacing that one file can be enough for a basic change. Explicit link tags give you control over SVG icons, fallbacks and cache-busting.
Laravel does not have a favicon setting. Changing the favicon means managing the files in public and the markup in your layout. Below, the asset under discussion is the small site icon shown in browser tabs, bookmarks and home-screen shortcuts, with attention to supplying it as an SVG file made from vector logo artwork.
Step 1: Prepare the icon files
A practical modern set has three files. The first is an SVG favicon for browsers that support it. The second is a favicon.ico fallback for older browsers and for the automatic root request. The third is a PNG apple-touch-icon for iOS home-screen shortcuts. Browser support for SVG favicons has expanded but has not been universal, particularly in Safari historically. Keep the ICO and PNG fallbacks rather than relying on the SVG alone.
- favicon.svg: the vector version, scalable to any size
- favicon.ico: the fallback, which can contain several small raster sizes
- apple-touch-icon.png: the raster icon used by Apple devices for home-screen shortcuts
Put all three files directly in the public directory. Files there are served as-is from the web root, so public/favicon.svg is available at /favicon.svg.
Step 2: Reference the icons in your Blade layout
Open the layout that renders your HTML head. Its location depends on how the project was set up. Common places are resources/views/layouts/app.blade.php, resources/views/app.blade.php in Inertia-based projects, or resources/views/welcome.blade.php in a fresh install. Some newer starter kits already include favicon link tags and SVG placeholder files. In that case, replace the files and edit the existing tags instead of adding duplicates. Inside the head element, add or update these tags:
<link rel="icon" href="{{ asset('favicon.ico') }}" sizes="any">
<link rel="icon" href="{{ asset('favicon.svg') }}" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png') }}">
The asset helper builds the URL from your application's configured base URL, so the paths resolve correctly when the app runs in a subdirectory or behind a configured asset URL. Browsers that support SVG favicons generally prefer the SVG link. Other browsers use the ICO.
Step 3: Force browsers to pick up the new icon
Browsers cache favicons aggressively, and this is the most common reason a change seems not to work. A simple fix is to add a version query string to the icon URLs and change it whenever the icon changes:
<link rel="icon" href="{{ asset('favicon.svg') }}?v=2" type="image/svg+xml">
Blade recompiles views automatically when their source changes. If your deployment caches compiled views, run the view cache command again after editing the layout. A hard refresh or a private browsing window is also a quick way to confirm the new icon is being served.
What makes a good SVG favicon
An SVG favicon is only as scalable as its contents. A file with an .svg extension is not necessarily vector artwork. An SVG can wrap an embedded raster image, such as a PNG or JPEG stored inside an image element, and that image will blur or pixelate like any bitmap. Before using a logo file as a favicon, open it in a vector editor or a text editor. Confirm that the shapes are paths and other vector elements, not an embedded bitmap. Neither the filename nor the extension proves that the paths are editable.
- Simplify the mark: a full logo with a wordmark rarely reads at tab size, so a symbol, monogram or cropped detail usually works better.
- Set a square viewBox so the icon is not distorted or padded unevenly.
- Convert text to outlines, or avoid text entirely. A favicon cannot rely on fonts being installed, and live text renders unpredictably.
- Remove editor metadata, hidden layers and unused definitions to keep the file small.
- Optionally, use a prefers-color-scheme media query inside the SVG's style block to switch colors for dark browser themes, in browsers that honor it.
The ICO and apple-touch-icon fallbacks are raster files. Export them from the vector master rather than from a screenshot or a low-resolution preview, so that every size starts from clean artwork.
Rights to the artwork
If the favicon comes from a logo you did not create, being able to download the file does not mean you may modify it or use it as your site icon. The artwork, any fonts in it and the trademark it represents can each carry separate terms. For your own brand, this is rarely an issue. For client work or third-party marks, confirm that you have permission to adapt and display the logo.
Limits of this guide
No project-specific evidence was supplied, such as a Laravel version, starter kit, front-end stack or browser support target. Layout file locations and any favicon tags already in place vary by version and setup, so check your own project before editing. Browser support for SVG favicons and color-scheme switching also changes over time. Test the result in the browsers your audience uses rather than assuming uniform behavior.