How to make a favicon from a letter or an emoji
Many sites do not have a logo mark, but they do have an initial. A single bold letter on a colored square makes a clear, recognisable tab icon, and you can write it as a tiny SVG file in a few minutes.
Choose the characters
One character is best. Two can work if they are narrow, such as “JS” or “Ai”. Three or more shrink to an unreadable smudge at 16 pixels. Some tips for picking:
- Uppercase letters are taller and read better than lowercase at tiny sizes.
- Wide letters such as M and W fill a square; narrow ones such as I and J leave gaps, so make them bolder or add a shape behind them.
- Avoid letters that look like others when blurred: O and Q, C and G, l and I.
- An emoji gives instant color and shape, but it looks different on each operating system because each one draws emoji in its own style.
The SVG, line by line
<svg viewBox="0 0 100 100">
<rect width="100" height="100" rx="20" fill="#241f31"/>
<text x="50" y="50" text-anchor="middle" dominant-baseline="central"
font-family="Georgia, serif" font-weight="700" font-size="70"
fill="#ffcc00">S</text>
</svg>
- viewBox 0 0 100 100 makes the arithmetic easy: the centre is (50, 50) and sizes read like percentages.
- rect with rx="20" gives a rounded square background. Leave it out for a letter that floats on the browser’s tab color.
- text-anchor="middle" centres the text horizontally on x = 50.
- dominant-baseline="central" centres it vertically on y = 50, instead of sitting the letter’s baseline there.
- font-size="70" is in viewBox units. A capital letter is usually around two-thirds to three-quarters of the font size tall, depending on the font, so this letter fills roughly half the height.
Save it as favicon.svg. A standalone SVG file also needs the xmlns attribute on its opening tag, as explained in the guide to writing SVG. Then link it from your pages with <link rel="icon" type="image/svg+xml" href="/favicon.svg">.
Check the contrast
The example uses yellow #ffcc00 on a very dark #241f31. A tab icon is tiny, so aim well above the minimums used for body text. You can test any pair with the contrast checker. Also look at the icon on both a light and a dark browser theme: if you skip the background square, a dark letter disappears on a dark tab bar.
The font problem, and the fix
A browser draws an SVG favicon as a separate image, so it cannot use the web fonts loaded by your page. It falls back to fonts installed on the visitor’s device. That is why the example lists a common font with a generic fallback. The result can still differ slightly between systems.
When the exact letter shape matters, convert the text to a path:
- Open the SVG in a vector drawing program that has your font installed.
- Select the text and use its “convert to path” or “create outlines” command.
- Save. The
<text>element is replaced by a<path>that draws the letter as a shape, with no font needed.
Emoji favicons
Swap the letter for an emoji character inside the same <text> element and drop the fill, since emoji carry their own colors. Increase the font size a little, to around 80 to 90, because emoji have built-in padding. Keep in mind that each operating system shows its own emoji artwork, and some systems may show an empty box if they lack the character.
Don’t forget the fallbacks
An SVG favicon covers modern browsers. Older browsers and some tools still look for /favicon.ico, and phones use a 180×180 PNG for home-screen shortcuts. Export those from the same SVG. The favicon sizes guide lists the full set.
Quick checklist
- One or two characters, bold weight.
- Letter centred both ways and filling about half to two-thirds of the square.
- Strong contrast between letter and background.
- Text converted to a path if the font must match exactly.
- ICO and 180×180 PNG fallbacks exported.
- Viewed at real size in a tab, on light and dark themes.
Questions people ask
Why does my letter look off-centre?
Fonts place letters within a box that includes space for accents and descenders. Some letters, such as J or a lowercase g, also hang lower. Nudge the y value by a few units until it looks centred, and trust your eyes over the numbers.
Can I animate a text favicon?
Some browsers run animation inside SVG favicons and some do not. An animated tab icon is also distracting, so a static icon is the safer choice.