What a symbol sprite is
A sprite is one SVG document containing many <symbol> elements, each with its own viewBox.
Instead of inlining a full SVG every time an icon appears, the page references a symbol with
<use href="#icon-name">: one download, many uses, and each instance can still be sized and coloured
with CSS. It is the technique behind most icon systems and it needs no JavaScript.
How the generator works
Drop your icons (or a folder). Each file's root attributes are read for a viewBox — derived from width and
height when missing — and its contents become a symbol whose id is the file name slugified and prefixed
(arrow-right.svg → icon-arrow-right). Ids inside each icon are namespaced so gradients, masks and
clip paths never collide when merged. The preview grid renders every symbol from the actual sprite, so what you see is
what <use> will draw. Everything runs in your browser.
Options
- ID prefix — keeps sprite ids from clashing with ids elsewhere in your page.
iconis conventional. - Strip colours — removes fills and strokes so icons inherit
fill: currentColorand can be coloured with plain CSS. Recommended for UI icons; disable for multi-colour artwork. - Pretty print — readable output for committing to a repository; leave off for the smallest file.
- External file snippets — switches the generated markup to
/sprite.svg#idfor a cached, shared file.
Tips
Run icons through the SVG Optimizer first — editor metadata inside a sprite is multiplied by
every icon. If you use the external-file approach, serve sprite.svg from the same origin with a long cache
lifetime and change the file name when the set changes. For frameworks that prefer components over sprites, see
SVG to React.