SVG Sprite Builder

This SVG sprite builder combines icons into a single sprite file. Drop SVG files or a whole icon folder, set an id prefix, and choose whether colours become currentColor so icons inherit the text colour. It cleans each icon, keeps its viewBox, prefixes internal ids so gradients don't clash, and shows every icon with its id. Download sprite.svg, or a ZIP with a demo page listing every icon and how to use it. It runs in your browser.

File name to symbol id (prefix icon-)

FileSymbol id
home.svgicon-home
Arrow Left.svgicon-arrow-left
24px_star.svgicon-24px_star
home.svg (second copy)icon-home-2

When to use it

  1. Bundle an icon set for a website.
  2. Replace an icon font with an SVG sprite.
  3. Make icons recolour with CSS.
  4. Clean exported icons from a design tool.
  5. Document an icon library with a demo page.

How to Use

  1. Drop SVG icons or a folder.
  2. Set the id prefix and colour option.
  3. Check the icon grid and ids.
  4. Download the sprite or the ZIP.

Features

  1. Folder of icons to one sprite
  2. Clean ids from file names
  3. Prefixed internal ids
  4. currentColor option
  5. Demo page in ZIP
  6. 100% client-side

FAQs

How do I use an SVG sprite?

Include the sprite once (inline or as a file) and reference icons with <svg><use href="sprite.svg#icon-home"/></svg>.

Why use currentColor?

Icons then take the CSS color of their parent, so one icon works in any colour or theme.

Why are ids prefixed?

Gradients and clip paths share one document in a sprite; prefixing stops one icon's gradient overriding another's.

Can I reference the sprite from another domain?

Browsers block cross-origin <use> references; serve the sprite from the same origin or inline it.

Is anything uploaded?

No. Everything runs in your browser.

Technical Details

Each SVG file is parsed; its viewBox is kept (or built from width and height), and width, height, scripts, event handlers, foreign objects and metadata are removed. Internal ids such as gradients and clip paths are prefixed with the symbol id and their url(#…) references updated so icons can't collide. Fill and stroke colours can be replaced with currentColor so icons take the text colour. Symbols get ids from the file names with an optional prefix, duplicates are numbered, and invalid files are reported.

Web & CSS Tools

Web & CSS Tools

  • Font Subsetter and WOFF2 Converter
  • Viewport Meta Tag Generator
  • Web App Manifest Generator
  • CSS Button Generator
  • CSS Text Shadow Generator
  • Glassmorphism Generator
  • Neumorphism Generator
  • CSS Filter Generator