Sprite Sheet Generator
Drop a batch of images and the generator arranges them on a uniform grid and draws one PNG sprite sheet in your browser, then outputs CSS with a background-position offset per sprite. Everything runs locally on the canvas, so nothing is uploaded to a server. Useful for icon sets, retro game frames, and UI states where you want a single file instead of many separate images. You control the number of columns, the tile size, the padding between cells, and the background (transparent, white, or black).
How the sprite sheet is built
-
1
Drop your images
Add PNG, JPG or WebP files. Reorder them with the up/down controls or remove any frame; the sheet rebuilds instantly.
-
2
Set the grid
Choose the number of columns; the rows follow from how many images you added. Each image is scaled to fit one square tile, keeping its aspect ratio and centred.
-
3
Tune tile size and padding
Pick the tile size in pixels and add padding between cells to stop neighbouring sprites bleeding when the sheet is scaled.
-
4
Download PNG + copy CSS
Save the sprite sheet as a single PNG and copy the generated CSS classes, one `.spr-name` rule per image with its width, height and background-position.
How the layout works
The generator uses a single, predictable layout: a uniform grid. You set the number of columns, and the number of rows is ceil(images / columns). Every cell is the same square size (the tile size you pick), so each image is scaled to fit inside its tile while keeping its aspect ratio, then centred. Mixed-size images all end up in equal cells, which is exactly what CSS background-position sprites expect.
| Control | Range | Effect |
|---|---|---|
| Columns | 1 to 16 | How many sprites per row; rows follow automatically |
| Tile size | 32 to 512 px | The square cell each image is fitted into |
| Padding | 0 to 64 px | Transparent gap between cells to prevent bleed when scaled |
| Background | Transparent / White / Black | Fill behind the sprites in the output PNG |
Output CSS shape
Each image becomes one class named after its file (.spr-<filename>), sized to the tile and offset to its cell. With four columns, a tile size of 128 px and no padding, the sheet looks like this:
.spr-idle { width: 128px; height: 128px; background: url(spritesheet.png) -0px -0px; }
.spr-walk { width: 128px; height: 128px; background: url(spritesheet.png) -128px -0px; }
.spr-run { width: 128px; height: 128px; background: url(spritesheet.png) -256px -0px; }
.spr-jump { width: 128px; height: 128px; background: url(spritesheet.png) -384px -0px; }
.spr-fall { width: 128px; height: 128px; background: url(spritesheet.png) -0px -128px; }
The offset moves in two dimensions: sprites fill each row left to right, then wrap to the next row. Save the PNG as spritesheet.png next to your CSS (or edit the url(...) to match your path).
Padding and bleed
Sprites packed edge-to-edge can bleed into each other when the browser scales the sheet (non-integer device pixel ratios, CSS transforms). Add 2 to 4 pixels of padding between cells to keep neighbouring pixels from leaking in.
High-DPI (retina) displays
There is no automatic 2x export, but you can make a sharper sheet the simple way: pick a larger tile size (for example 256 px instead of 128 px) so each sprite carries more pixels, then display it at half the CSS size. That gives crisp sprites on high-density screens without a separate pass.
When to use sprite sheets vs alternatives
- Sprite sheets: classic icon sets in CSS, HTML5 game frames, and pages that benefit from bundling many small images into one file.
- SVG sprites (symbol): better for modern UI icons, scale cleanly, accept CSS
fill, nobackground-positionjuggling. - Icon fonts: limited but still used for tiny single-color icons.
- Individual files with HTTP/2 or HTTP/3: multiplexing makes request count less of a concern than it once was.
Frequently Asked Questions
No. The sheet is drawn on an HTML canvas in your browser and the PNG is generated locally, so your images never leave your device. In the multi-step flow, the selected files and layout stay temporarily in this browser for up to 30 minutes so the next step can restore them; neither is sent to a server or added to the URL.
Yes, but inline SVGs or SVG <symbol> sprites are usually a better fit for component frameworks. CSS sprite sheets shine when many images are shown simultaneously on static pages.
Set the number of columns to your frame count so every frame sits in one row, then drive it with CSS animation-timing-function: steps(N) and a background-position that jumps cell by cell. Works well for short looping animations (loaders, idle states).
Every cell in the grid is the same square size (the tile size you chose), so each image is scaled to fit inside its tile and centred. If your sprites are already identical squares, set the tile size to match them and they pass through unchanged.
Related Tools
Image Resizer
Resize images to pixel-exact dimensions or percentages while preserving aspect ratio. Batch-friendly, no upload.
QR Code Generator
Generate a browser-local QR code from a plain text or URL payload. Adjust size, colours and error correction, then download PNG.
Meme Generator
Add fixed top and bottom captions to a JPG, PNG, or WebP image in your browser. Set font, size, colors, and stroke, then download a PNG.
Barcode Generator
Create a 1D barcode in your browser in Code 128, EAN, UPC, ITF-14 and other supported formats. Download the rendered result as SVG or PNG.
Image Compressor
Compress JPG, PNG and WebP images to reduce file size while preserving visual quality. Entirely in your browser, no upload.
GIF Maker
Turn a sequence of images into an animated GIF. Set frame rate, quality and dimensions before exporting.