What Is a CSS Sprite Sheet Generator?
A CSS sprite sheet combines multiple small images โ icons, UI elements, flags, badges โ into a single image file. The browser loads one file instead of dozens, cutting HTTP requests and improving page speed. Each element is then displayed via CSS background-position offsets that reveal the correct portion of the sheet.
This tool automates the tedious part: upload your individual images, pick a horizontal strip, a vertical strip or a grid, and it places them, calculates the exact offsets, and writes the matching CSS rules in fixed pixels or responsive percentages. Upload SVG icons and it also builds an SVG symbol sprite. Copy the stylesheet, drop the sprite image into your project, and your icons load in a single request.
How to Use This Tool
- Upload your images โ Drag and drop or select the individual icon or element files. The tool accepts PNG, JPG, WebP, and SVG raster exports.
- Arrange the sprite layout โ Choose a horizontal strip, a vertical strip or a grid (grid cells take the size of the largest image, so mixed sizes leave gaps). Add padding between sprites to prevent bleed at fractional zoom levels.
- Preview the generated CSS โ Each image gets a class name derived from its filename. The tool shows the background-position values so you can verify alignment before exporting.
- Download the sprite sheet and CSS โ Export the combined image and copy the generated CSS. Paste both into your project โ the classes are ready to use immediately.
Worked example: nine icons, three layouts
On October 12, 2026 we worked the tool's layout code through a typical icon set (16, 20, 24, 32, 40, 48, 64, 96 and 128 px squares, padding 2 px) and tested its percentage CSS in Chromium on a three-colour test sheet scaled to 1.5ร.
| Layout | Sheet size | Share of the sheet that is icons |
|---|---|---|
| Horizontal | 484 ร 128 px | 58% |
| Vertical | 128 ร 484 px | 58% |
| Grid (3 ร 3) | 388 ร 388 px | 24% |
- Grid wastes space when sizes differ. Every grid cell is as big as the largest icon, so with mixed sizes three quarters of the PNG is empty (it compresses well, but it still has to be decoded to full size in memory). Use grid for same-size icons; for mixed sizes, horizontal or vertical is tighter, and splitting into one sheet per size is tighter still.
- Percentage mode scales cleanly. The % background-size and background-position the tool writes put the right icon in the box at any width; at 1.5ร in Chromium the green test icon showed no colour from its red and blue neighbours, with or without padding. Padding is still cheap insurance for other renderers.
- One PNG at 1ร. The sheet is built at each image's own pixel size, so on a 2ร screen icons are upscaled and soft. Upload 2ร images and display them at half size (the % mode makes that easy: set the element width to half the icon width), or use the SVG sprite.
- File names become class names, without de-duplication. Two uploads called icon.png produce two .sprite-icon rules, and the second wins for both; rename files before adding them. The SVG sprite numbers duplicates (-2, -3) automatically.
- SVG sprite: SVG uploads also produce a <symbol> sheet, with internal ids prefixed per icon so gradients do not clash, optional recolouring to currentColor, and <use href="sprite.svg#id"> markup; serve sprite.svg from the same origin as the page.
- Do you still need a sprite? Over HTTP/2 and HTTP/3 many small files load in parallel on one connection, so sprites mainly help for very many tiny icons; an SVG symbol sheet or inline SVG is usually the better fit for UI icons.
Sources
Checked on .
Frequently Asked Questions
๐ Learn More
Related Article 26 Free CSS Generators & Visual Editors โ Related Article CSS Layout Tools & Generators Guide โBuilt by Derek Giordano ยท Part of Ultimate Design Tools