rankato

Pack many icons into one SVG sprite

Drop your icon SVGs, normalize their viewBoxes, and export as a single <symbol>-based sprite for CSS <use> references — or as individual React/Vue components.

Shipping 40 individual icon files means 40 HTTP requests and 40 cache entries. Shipping one SVG sprite with 40 <symbol> children means one request, one cache entry, and simple <use href="#icon-name"> references anywhere in your HTML. The Rankato SVG Icon Generator does the packing for you: normalize varying icon viewBoxes to a common size, strip inline colors to enable CSS theming via currentColor, run each icon through SVGO, and output either a sprite file or a set of framework-native components (React, Vue, Svelte).

Sprite vs. individual icons — the case for packing

An SVG sprite is a single file that contains multiple icons, each wrapped in a <symbol id="icon-name">. To render an icon in your page, you use <svg><use href="#icon-name"/></svg>. Benefits: one HTTP request for the entire icon set, browser cache stays warm across pages, easy CSS-based color theming with currentColor, and dead simple integration (no build step needed). The main tradeoff is that all icons load whether or not you use them all — for >100 icons, tree-shakable per-icon React components may be a better fit.

Normalizing viewBoxes

Icons exported from different sources come with different viewBoxes — Font Awesome uses 0 0 512 512, Feather uses 0 0 24 24, Heroicons uses 0 0 20 20 or 0 0 24 24, Lucide uses 0 0 24 24. If you use them together, they'll appear at wildly different sizes unless you normalize. The generator scales every icon to a common target (default 24×24) with padding preserved, and reports the ones it had to shrink or grow significantly (a warning appears when the scale factor is more than 2× — that's usually a sign of a mistake).

Stripping inline colors for theming

Icons with hard-coded fills can't be themed via CSS. The generator strips fill and stroke attributes from every path (opt-in), replacing them with currentColor so the icon inherits from its CSS color property. That means <svg style="color: red"><use href="#icon-check" /></svg> just works — no per-icon color prop, no runtime style injection.

Framework component export

Beyond the sprite file, the generator can output per-icon components for React (both function-component and forwardRef flavors), Vue 3 (Composition API), and Svelte (Svelte 5). Each component takes standard SVG props plus a size and color shortcut. Together with a barrel export (export { IconCheck, IconClose, … }), you get a tree-shakable icon library from a folder of SVG files in seconds.

Naming and slugification

Icon IDs and component names come from filenames — arrow-right.svg becomes id icon-arrow-right and component IconArrowRight. The generator sanitizes weird characters, strips extensions, and warns on duplicates. Override any name via the file table before export if the default isn't what you want.

Tool FAQs

Everything you need to know about using SVG Icon Generator.

How many icons can a sprite hold?+

Practically unlimited, but performance-wise: up to ~100 icons per sprite is fine; beyond that consider splitting into thematic sprites or switching to per-icon React components with tree-shaking.

Do <use> sprites work in email or old browsers?+

Modern browsers (2020+): perfect. IE11: needs a polyfill (svgxuse) because it doesn't handle external <use> references. Email: don't rely on sprites — email clients strip <svg> altogether. Ship inline PNG for email.

Can I use the sprite from a CDN?+

Yes with a caveat: cross-origin <use> references need CORS headers on the SVG. Serve the sprite with Access-Control-Allow-Origin: * and you're set.

Does the generator handle multi-color icons?+

Yes — leave Strip inline colors off. Multi-color icons stay full-color; single-color ones get the currentColor treatment based on whether their paths all share the same fill.

Is there a max sprite file size?+

No hard cap, but 500 KB is a soft limit — beyond that the sprite delays your first paint. Optimize each icon aggressively before adding it to the sprite.