SVG sprite generator
Merge a set of SVG icons into one sprite file. Each icon becomes a <symbol> with an id from its file name — in kebab-case, camelCase or snake_case, with an optional prefix, or renamed by hand — and internal ids are namespaced so gradients and clip paths from different icons can't collide. Make the set follow the text colour with currentColor, shrink it with SVGO, and get the code to use it: <use> snippets for an inline or external sprite, a typed React <Icon name> component and a JSON manifest.
How to use it
- 1
Drop the SVG icons you want in the sprite, or a whole folder.
- 2
Choose how symbol ids are written, inline or external sprite, currentColor and SVGO; rename any icon on its tile.
- 3
Download sprite.svg, or a ZIP with the sprite, its manifest and the HTML and React usage.
Questions
Why use a sprite instead of separate files?
One request loads every icon, the browser caches it once, and each icon can still be styled and sized individually where it's used.
What about icons that share ids?
Every internal id (gradients, clip paths, masks) is prefixed with its symbol's id, and references to it are rewritten, so icons can't break each other.
How do I use an icon from the sprite?
Inline the sprite once in your page (or reference the file), then write <svg><use href="#icon-id" /></svg> wherever the icon should appear.
Inline or external sprite?
Inline: paste the sprite into each page — no extra request, works anywhere. External: serve sprite.svg as a file and reference icons as /sprite.svg#id — cached once for every page, but it must come from the same origin as the page, because browsers block <use> across sites.
Why don't my gradient icons show in a sprite?
A sprite hidden with display:none stops browsers from rendering gradients, clip paths and masks defined inside it. This generator hides the sprite with zero size instead, so those icons keep their fills.
How do I change an icon's color from CSS?
Turn on Use currentColor: fills and strokes become currentColor, so each icon follows the color of the element it's in (color: red, or a text-color class). Gradients keep their colors.
More free SVG tools
Need more than one change?
The Splice editor edits SVGs visually — shapes, text, colors, layers — across many files at once, with the code in sync.
Open the editor