SVG to TTF, WOFF and WOFF2

Icon Font Generator

Drop SVG icons to get an icon font with CSS classes, private-use code points from U+E000 and optional ligature names.

Icons

Up to 400, each under 500.0 KB

Drop SVG icons here or click to choose

Filled shapes work; strokes are not outlined.

Font settings

U+E000. The Private Use Area runs U+E000 to U+F8FF.

Glyphs

Add SVG icons to see the glyphs.

Download

Icon Font Generator

Operator: Abdulla Al Fahad. How tools are built and checked

An icon font packs many small pictures into one file that the browser downloads once and colours with ordinary CSS. The catch is that a font holds filled outlines on a fixed grid, so every SVG has to be flattened to plain shapes, scaled into an em box and given a code point.

This page does that conversion for the icons you drop in. It reads each file's shapes, scales them into a 1000-unit em, assigns code points from U+E000 in the Private Use Area, and writes a TrueType font plus WOFF, WOFF2, a stylesheet, a demo page and a JSON map.

Key features

  • Reads path, rect, circle, ellipse, polygon and polyline shapes, including nested transforms, arcs and relative path commands
  • Scales by each file's viewBox (relative sizes survive) or by the drawn artwork (every icon fills the box), with 0 to 25% padding
  • Square 1000-unit glyphs or glyphs whose width follows the icon
  • Code points from any start between U+E000 and U+F8FF, so a set can sit beside another font
  • Optional ligatures: typing an icon's file name as text shows the icon
  • Writes TTF, WOFF (zlib) and WOFF2 (Brotli), a CSS file with one class per icon, demo.html and a JSON name-to-code-point map

How an SVG becomes a glyph

A glyph in this font is a TrueType outline: straight lines plus quadratic curves. SVG paths use cubic curves, so each cubic is split into as many quadratics as it needs to stay within half a font unit of the original, up to 16 per curve. Coordinates are rounded to whole units of a 1000-unit em, which is the precision TrueType stores.

The em box runs from -150 (descender) to 850 (ascender), and the SVG's top-left origin is flipped to the font's bottom-left one. The baseline sits at 0, so the icon occupies the whole line height and a font-size of 1em gives an icon 1em tall.

Fonts fill outlines with the non-zero winding rule. A shape that relies on fill-rule="evenodd" for its holes (a ring drawn as two same-direction circles) would fill solid, so for even-odd shapes the page measures how deeply each contour is nested and reverses alternate ones. Shapes drawn with the default non-zero rule are left alone.

How it works

Every SVG is parsed with an allowlist: only path, rect, circle, ellipse, polygon, polyline, g, a and svg elements are read, namespace prefixes are stripped before the check, and scripts, styles, images, text, use and foreign content are never looked at. Because the result is only numbers, the font cannot carry anything from the file except its outlines.

The font is written table by table: head, hhea, maxp, OS/2, hmtx, cmap (format 4), loca, glyf, name, post and, for ligatures, a GSUB table with one liga lookup. Each ligature is a sequence of helper glyphs for the characters in the file name that substitutes the icon glyph; longer names are tried before shorter ones that start the same way, so home-alt wins over home.

The preview above the download button is drawn from the same outlines, and the Try the font box loads the generated TTF into the page so you can see ligatures work before you ship it.

Typical uses

  • A design system keeps 120 icons as SVGs exported from Figma. Dropping the folder produces one font whose .icon-* classes replace 120 inline SVG requests, with the JSON map checked into the repo so code points stay stable.
  • A small agency's CMS editor strips inline SVG from article bodies but allows plain text and CSS classes. A 9-icon set with ligatures lets an editor type the name, such as arrow-right, and get the icon without touching code or remembering U+E004.

Building one

  1. Drop the SVG files; files that cannot be used are listed with the reason.
  2. Set the font name and the class prefix; the prefix becomes the CSS class stem, so icon- gives .icon-home.
  3. Choose how icons are scaled and whether to write ligatures, and check the glyph grid.
  4. Press Build font files, then download the ZIP or any single file.

Example

Three 24 × 24 icons, font name app-icons, defaults

home.svg (a path), ring.svg (an even-odd ring), star.svg (a polygon)

Files in the ZIP

app-icons.ttf 1,556 B, app-icons.woff 1,120 B, app-icons.woff2 724 B, app-icons.css, demo.html, app-icons-map.json
.icon-home::before { content: "\e000"; }
.icon-ring::before { content: "\e001"; }
.icon-star::before { content: "\e002"; }
15 glyphs: .notdef, 11 helper glyphs for the letters in the three names, and 3 icons

Things to check before you rely on it

Colour is lost: a font is one colour, set by the text colour in CSS. Gradients are replaced by a solid fill, and the result notes the substitution. Multicolour icons are better kept as SVG symbols in a sprite, which the SVG sprite generator on this site builds.

Ligatures need a browser that applies the liga feature, which every current browser does by default; the helper glyphs for the letters have no width, so the file name shows nothing if ligatures are switched off in the page's own CSS.

A self-crossing outline that relies on the even-odd rule within one contour (a five-point star drawn as one pentagram path) cannot be fixed by reversing contours and may fill its centre; draw it as an outline instead.

  • Export icons with every shape as a fill and no clip paths; a stroke width of 2 on a 24 px icon is better outlined in the editor so the corners stay square in the font.
  • Keep file names stable between builds, because the order of the files sets the code points; renaming or reordering changes which glyph sits at U+E000.

Common errors and how to fix them

"No filled shapes were found"
The file has only strokes, text or images. Convert strokes to outlines and text to paths in your editor.
"The first code point must be in the Private Use Area"
Pick a start between U+E000 and U+F8FF; standard letters and symbols are not used for icons.
"The icon has more than 60,000 path segments"
Simplify the artwork; photographic traces are too heavy for a glyph.

Best practices

  • Choose the artwork scale for a set of stand-alone logos, and the viewBox scale for a family drawn on one grid, so that a small dot stays smaller than a big circle.

Outlining strokes before import

A shape with fill="none" and a stroke is skipped and counted in a warning, because outlining a stroke means offsetting the curve. Do that in your vector editor first, using its outline-stroke command, and the result drops straight in. Artwork that sits far outside the viewBox is also left out of the font, with a warning, rather than being stored in coordinates the TrueType format cannot hold.

Frequently asked questions

Is the file name the ligature?

Yes, after cleaning: the name is lowercased, anything outside a-z, 0-9, hyphen and underscore becomes a hyphen, and it is cut at 40 characters. Two files that clean to the same name get -2, -3 and so on.

Why is an icon missing a part, or the whole icon, in the font?

Only filled shapes become glyphs. Strokes, text, images and clip paths are skipped, and contours that sit far outside the viewBox are left out so they cannot wrap around in the font's 16-bit coordinates. Each case is listed as a warning on that icon's card, so check there before assuming the font is wrong.