Design tools

Sprite Sheet Generator

Sprite Sheet Generator

Pack images into one PNG sprite sheet with CSS classes and a JSON atlas.

About this tool

About Sprite Sheet Generator

A sprite sheet puts many small images into one file, so a web page loads one image instead of dozens and a game engine can draw frames from a single texture. Add your PNG, SVG, JPG, WebP or GIF files and choose how they are arranged: Packed fits mixed sizes tightly into a near-square sheet, Grid gives every image an equal cell (ideal for animation frames, with a column count you can set), and Row or Column lines them up in one strip. Set the padding between sprites to stop neighbouring edges bleeding when scaled. The generator writes a CSS file with one class per image, using background-position offsets and safe class names taken from the file names, and a JSON atlas in the common TexturePacker hash format that Phaser, PixiJS and many other engines read. If your images are @2x, tick the retina option and the CSS halves every size and adds background-size, so icons stay sharp on high-density screens. Download the PNG alone or a ZIP with PNG, CSS and JSON. Images are packed in your browser and never uploaded.

Built and maintained by Abhi JainUpdated

How to Make a Sprite Sheet

  1. 1

    Add images

    Choose or drop your images. Remove any you don't want from the list.

  2. 2

    Choose a layout

    Pick Packed, Grid, Row or Column and set the padding (and columns for Grid).

  3. 3

    Set names

    Enter the class prefix and sheet file name, and tick the @2x option for retina images.

  4. 4

    Download

    Download the PNG, or the ZIP with PNG, CSS and JSON, and copy the CSS from the code panel.

Sprite Sheet Generator: questions and answers

How do I use a CSS sprite?

Link the CSS file and add two classes to an element, for example <span class="icon icon-home"></span>. The base class sets the sheet as the background and the second sets the size and background-position of that image.

Are CSS sprites still worth it with HTTP/2?

Less than they used to be, because HTTP/2 makes many small requests cheap. Sprites still help for large icon sets, for hover states that must not flicker, and in games and canvas apps where one texture is faster to draw from.

Which layout should I choose?

Use Grid for animation frames of the same size, because each frame sits at a predictable position. Use Packed for icons of different sizes to get the smallest sheet. Row and Column are easiest to read by eye.

What JSON format is the atlas?

It uses the TexturePacker JSON hash format: a frames object keyed by file name with x, y, w and h for each image, plus meta with the image name and sheet size. Phaser, PixiJS, Cocos and many other tools load it directly.

Why add padding between sprites?

When a sprite is scaled or drawn at a fractional position, the browser or GPU can sample pixels from its neighbour. One or two pixels of transparent padding prevents those coloured edges.