How to build an SVG sprite
- 1Set a Sprite Filename, which is used for the downloaded file and in the usage snippets.
- 2Drag SVG files onto the Drop Images area. PNG, JPG, WebP, GIF and BMP are accepted too; under Raster Encoding, choose Original (lossless) to embed them untouched or WebP (smaller) to re-encode them.
- 3In the Icons list, edit each symbol ID. Names are converted to lowercase kebab-case so they're valid IDs.
- 4Use the Preview tab to check every icon on a checker, light or dark background, then open Sprite XML, HTML usage or React usage and click Copy.
- 5Click Download Sprite to save the .svg file, or Save to Library to keep it in this browser for later.
How SVG sprites work
An SVG sprite is one SVG file that holds many icons, each wrapped in a <symbol> element with its own id and viewBox. This is often called an SVG symbol sprite, to set it apart from the older CSS technique of positioning one big image with background-position. A symbol is never drawn by itself. It's a template, and you render it wherever you need it with <svg><use href="sprite.svg#icon-name"/></svg>. The viewBox stored on each symbol means icons with different native sizes all scale cleanly to whatever width and height you give the outer svg. The SVG <use>/<symbol> pattern works in every current browser.
Compared with one file per icon, a sprite turns dozens of requests into one cacheable file. Compared with an icon font, it keeps real vector shapes, multi-color icons and proper accessibility, and avoids the blurry rendering and odd baseline alignment that fonts bring. Compared with inlining every icon into your components, it keeps markup out of your JavaScript bundle.
Styling works through inheritance. Elements inside a <use> live in a shadow tree that CSS selectors can't reach, but inherited properties such as fill and color pass through. Set fill="currentColor" in your icons and they'll follow the text color of their container; any hard-coded fill in the source SVG will override that. When referencing an external sprite file, keep it on the same origin as the page, because browsers block cross-origin <use> references.
This generator strips XML declarations, comments, <title> and <desc> elements and extra whitespace from each SVG, keeps its viewBox (or derives one from width and height), and hides the sprite root with display:none so it can also be pasted inline at the top of a page. Raster images are embedded as base64 inside an <image> element in their own symbol.
When developers reach for it
Building an icon system
Bundle a project's icons into one SVG icon sprite and render them with a small typed React Icon component.
Replacing an icon font
Move from a font-based icon set to crisp, accessible SVG symbols that are styled with currentColor.
Static sites and server templates
Reference icons with a plain <use> tag in HTML, with no JavaScript or bundler needed.
Mixing logos and raster badges
Include PNG or JPG images alongside vector icons, embedded as-is or re-encoded to WebP to keep the sprite small.
Frequently asked questions
How do I combine SVG files into one?
+
Drop all the SVG files onto the Drop Images area at once. Each becomes a <symbol> inside a single sprite, with its ID taken from the filename, and Download Sprite saves the combined .svg.
How do I use an SVG sprite in HTML?
+
Host the downloaded file, then write <svg class="icon"><use href="/my-sprite.svg#icon-id"/></svg> wherever you want an icon. The HTML usage tab generates this line for every symbol.
How do I change the color of sprite icons?
+
Make sure the icon paths use fill="currentColor" instead of a fixed color, then set color or fill on the outer svg with CSS. Hard-coded fills in the source SVG can't be overridden from outside.
Can I use the sprite in React?
+
Yes. The React usage tab gives you an Icon component with a typed IconId union of every symbol in your sprite, which renders the matching <use> reference.
Why doesn't my sprite load from a CDN?
+
Browsers don't allow <use> to reference an SVG on a different origin. Serve the sprite from the same domain as your page, or paste it inline in the HTML.
Where is the library stored?
+
Saved sprites live in your browser's localStorage, up to 20 entries. Nothing is uploaded, and clearing site data removes them.
Related tools
SVG to PNG
Rasterize SVGs to PNG, JPEG, or WebP at any resolution. Paste source or drop a file, set the export dimensions, and download — ideal for @2x / @3x asset pipelines.
Image to Base64
Encode any image as a base64 data URL. Copy as raw string, CSS background, HTML img tag, or Markdown — perfect for inlining icons and small assets.
Image Converter — WebP, PNG & JPG
Convert PNG, JPG, WebP, GIF, and BMP images to WebP, JPEG, or PNG with an adjustable quality slider. Batch-convert multiple files at once with live size comparison. Everything runs in your browser — no uploads, no size limits.
Image Compressor
Shrink JPEG, PNG and WebP images in bulk. Auto mode turns heavy PNGs into WebP for real savings, with a quality slider and a before/after size for every file — all client-side.