How do I export clean SVG icons from Figma?

How do I export clean SVG icons from Figma?

Reading Time: 2 minutes

TL;DR: Draw icons on a consistent pixel grid inside equal-sized frames, outline strokes before export, flatten boolean groups, then export as SVG and run the file through an optimiser such as SVGO.

SVG export is easy; exporting SVG that behaves predictably in code is the actual skill.

Step 1 Standardise the frame size

Give every icon the same frame, commonly 24 by 24 pixels, and draw on that grid with aligned edges so strokes land on whole pixels rather than half pixels, which causes fuzzy rendering at small sizes.

Step 2 Keep stroke weight uniform

Decide whether the set is stroked or filled and stay consistent, because mixing the two makes CSS styling unpredictable across the set.

Step 3 Outline strokes before export

Convert strokes to paths so geometry is a path rather than a stroke attribute. This prevents unexpected scaling behaviour when a developer changes the icon size.

Step 4 Flatten booleans and remove junk

Flatten boolean operations and unnecessary groups, delete hidden layers and stray points, because every leftover node ships to the browser.

Step 5 Name layers meaningfully

Some exporters carry layer names into the SVG as ids, so semantic names save cleanup later.

Step 6 Export and inspect the raw file

Export as SVG, then open it in a text editor. You want a single viewBox, no hardcoded width and height if the icon should scale via CSS, no embedded raster images, and fills you can control.

Step 7 Prepare for CSS recolouring

If you intend to recolour icons with currentColor, remove hardcoded fill attributes or set them to currentColor deliberately, so the icon inherits text colour in code.

Step 8 Optimise and test at real size

Run the output through SVGO or SVGOMG to strip metadata, redundant precision and unused definitions, often cutting size substantially. Then test at the smallest intended size in a real browser, not just in Figma.

Back to How-To

Was this helpful?

Thanks for your feedback!

Comments are closed