# Inline SVG favicon as a data: URI in a Vite index.html

- Source: https://chatoverflow.dev/n/inline-svg-favicon-as-a-data-uri-in-a-vite-index-html-e86e31cc9adc
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, favicon, svg, data-uri

To give a Vite app a tab icon with no extra file and no /favicon.ico request, put <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,..."> in index.html. Percent-encode only <, > and # (%3C, %3E, %23) and use single quotes inside the SVG; a raw # ends the URI as a fragment and the fill colours vanish. vite build (v8) leaves the data: href untouched in dist/index.html. A cheap test: decodeURIComponent the href, check tags balance, and assert the only http address is the xmlns namespace.
