Merge separate icon files into one file of symbol elements, then show any icon with a use tag and its ID.
This tool runs entirely in your browser. What you enter is never sent anywhere.Your input is never sent anywhere.
DetailsAdd SVG files to see your icons here
What is an SVG sprite?
An SVG sprite is a single SVG file or snippet that holds many icons as symbol elements, each with its own ID. Instead of loading or pasting every icon separately, you define them once and display each one with <svg><use href="#icon-id" /></svg>. This tool reads the SVG files you add, wraps each one in a symbol, and gives you the finished sprite as copyable code or a downloadable sprite.svg.
When to combine icons into one file
Fewer requests for an icon set
Dozens of small icon files means dozens of requests. One sprite file is a single request, and the browser can cache it. With HTTP/2 the saving is smaller than it used to be, but you still get one file to version and deploy.
A shared icon library
Keep your project's icons in one place and refer to them by ID. Designers and developers can agree on names like icon-search or icon-arrow-left.
A shared Icon component in React or Next.js
Write one component that renders a use tag, instead of a separate component for every icon. Place the sprite in your public folder and point the component at it.
Icons that follow your text color
Icons drawn with currentColor take the CSS color of the element around them, so hover and dark mode styles need no extra icon files.
How to combine your icon files
- Drop your SVG files onto the upload area, or click it to choose several files at once.
- Check the previews and the ID under each icon. Change the ID prefix or rename files if you want different IDs, and remove any icon you do not need.
- Choose Inline HTML to paste the sprite into a page, or sprite.svg file to save it as a separate file, then copy the code or download it.
- Show an icon with a use tag that points to its ID, for example href="#icon-search" for inline or href="/sprite.svg#icon-search" for a file.
Note: Files are read and combined in your browser. Nothing is sent to a server.
What to know before you export
- IDs come from file names. Names are lowercased and anything other than letters and numbers becomes a hyphen. Duplicates get -2, -3, and so on.
- The tool keeps each file's viewBox. If a file has none, it uses numeric width and height, and then falls back to 0 0 24 24.
- Fill, stroke, and similar attributes set on the root svg element are copied to the symbol, so icons drawn that way keep their look. Attributes on paths inside the icon are left as they are.
- Script elements, on* event attributes, and javascript: links are removed. The tool does not minify or otherwise optimize your SVG code.
- A style block inside an SVG applies to the whole page once it is inline. Icons that contain one are marked with a warning. Convert those rules to attributes before combining.
Sprite vs. inline SVG vs. img tag vs. icon font
How the common ways of putting icons on a page compare. Pick based on how many icons you use and whether they need to change color.
| Method | Strengths | Trade-offs |
|---|---|---|
| SVG sprite | One definition for many icons. A separate sprite file can be cached. Icons can use currentColor and be styled with CSS. | An external sprite must come from the same origin as the page. A large sprite is downloaded in full even if a page uses a few icons. |
| Inline SVG per icon | No extra request. Full control from CSS and JavaScript. | The icon markup is repeated wherever it is used and adds to every page's HTML. In React it also ends up in your JavaScript bundle. |
| img tag | Simplest to write, and the file is cached like any image. | CSS on the page cannot reach inside the image, so you cannot recolor it with fill or currentColor. |
| Icon font | Icons behave like text and are sized with font-size. | Normally one color per glyph. The font must finish loading before icons appear, and screen readers can announce the glyph characters. |
Basic use tag examples
<!-- sprite pasted into the page --> <svg width="24" height="24" aria-hidden="true"> <use href="#icon-search" /> </svg> <!-- sprite saved as /sprite.svg --> <svg width="24" height="24" aria-hidden="true"> <use href="/sprite.svg#icon-search" /> </svg>
In Next.js, put the file at public/sprite.svg and use <use href="/sprite.svg#icon-search" /> inside a shared Icon component. Add a title or aria-label when the icon is the only thing that names a button or link.
Typed icon names, same-origin hosting, and multicolor icons
Three points that matter once a sprite is used by a team or across a larger site.
Catch icon name typos with a TypeScript type
If an Icon component accepts any string, a misspelled ID just shows nothing. Use the Copy TypeScript type button to get a union of your IDs, then type the component's name prop with it. A wrong name then fails at compile time instead of rendering an empty box. Regenerate the type whenever you add or remove icons.
Serve an external sprite from your own domain
Browsers generally refuse to use an external sprite from a different origin, so <use href="https://cdn.example.com/sprite.svg#id"> can fail even if the file loads fine on its own. Host sprite.svg on the same origin as your pages (in Next.js, the public folder), proxy it through your own domain, or paste the sprite inline instead.
Mix multicolor and recolorable icons
Do not strip every color from your source files if some icons, such as a logo, need fixed brand colors. Use fill="currentColor" on paths that should follow the CSS color, and leave an explicit value like fill="#FF5722" on paths that should not change. The tool leaves attributes on inner elements untouched, so both can live in the same sprite.
Icons not showing or not changing color: common causes
The icon ignores your CSS color
Files exported from Illustrator or Figma often have fixed values like fill="#000000" on each path. Those values override the color you set in CSS, so hover and dark mode styles do nothing.
💡 See the solution▼
The icon looks cropped, stretched, or tiny
A file without a viewBox gives the browser no coordinate system to scale from. The tool then guesses from width and height, or falls back to 0 0 24 24, which suits 24 px icons and no others.
💡 See the solution▼
The use tag shows nothing because the ID does not match
The ID in your markup has to match the generated one exactly. File names with capital letters, spaces, or non-Latin characters are rewritten, and a prefix change alters every ID.
💡 See the solution▼
Gradients or clips break when icons are combined
Two files that both define an inner id such as gradient-1 or clip-a end up with the same id in one document, and one icon can pick up the other's gradient or clip path. The tool does not rename IDs inside an icon.
💡 See the solution▼
An external sprite works locally but not in production
Pointing use at a sprite hosted on another domain or CDN is blocked by most browsers, even when the file itself downloads fine.
💡 See the solution▼
SVG sprite questions about IDs, privacy, and viewBox
Q.Are my SVG files uploaded to a server?
A. No. Your browser reads each file and builds the sprite on the page. Nothing is sent to the site's server, and the icon list is cleared when you close or reload the tab.
Q.How are icon IDs created?
A. Each ID is the ID prefix (icon- by default) plus the file name. The file name is lowercased and every run of characters other than letters and numbers becomes a hyphen, so Search Icon.svg becomes icon-search-icon. A name with no Latin letters or numbers becomes icon. You can change the prefix in the tool.
Q.What happens if two files have the same name?
A. The second one gets -2 added to its ID, the third gets -3, and so on, so every ID in the sprite is unique. The ID shown under each icon is the one used in the code.
Q.What if an SVG has no viewBox?
A. The tool uses the viewBox attribute when there is one. If not, it builds one from numeric width and height values. If neither is available, it falls back to 0 0 24 24, which can crop an icon drawn at a different size. Add a viewBox to the source file if the preview looks cut off.
Q.What is the difference between Inline HTML and sprite.svg file?
A. Inline HTML adds a zero-size, hidden svg wrapper so you can paste the sprite into your page markup and reference icons with href="#icon-name". The sprite.svg file format is a plain svg with only the symbols, meant to be saved as a file and referenced with href="/sprite.svg#icon-name".
Q.How do I change an icon's color with CSS?
A. Set fill="currentColor" (or stroke="currentColor") in the source SVG instead of a fixed color, then set the CSS color property on the svg or its parent. Fixed colors left on the paths stay as they are.
Your feedback
makes this tool better.
Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.