Browser-based game and web asset tool · no upload

Sprite Sheet Generator

Drop in icons or animation frames and get one PNG sheet, a TexturePacker-style JSON atlas in hash and array flavours, and ready-made CSS sprite classes. Packing, trimming and extrusion all happen in this tab.

Sprites

0 added · up to 500, each at most 2048 px

Drop frames here or click to choose

PNG, JPG, WEBP or GIF (first frame). Order is kept for the JSON.

Packing

Layout

Sprites are never rotated, so every frame in the JSON has rotated: false.

Sheet

Add sprites to see the packed sheet

Sprite Sheet Generator

Operator: Abdulla Al Fahad. How tools are built and checked

A sprite sheet puts many small pictures into one image so a game or a web page loads a single file instead of dozens, and so a graphics card can draw them without switching textures. What makes the sheet usable is the second file, the atlas, which says where each picture sits. This page builds both from the frames you drop in: one PNG, a JSON atlas in the two layouts that TexturePacker writes, and a stylesheet with a CSS class per frame.

The packing is done by code that runs in your browser tab, and there is no free-tier watermark or frame limit beyond the sizes listed below.

Key features

  • MaxRects (best short side fit) and equal-cell grid layouts
  • Padding 0 to 32 px and extrusion 0 to 8 px, with the atlas frame excluding the extruded border
  • Trim transparent edges with an adjustable alpha limit, recording spriteSourceSize and sourceSize
  • Power-of-two sheets or exact-fit sheets, maximum 512, 1024, 2048 or 4096 px
  • JSON in both TexturePacker layouts: hash (keyed by name) and array (with filename)
  • CSS with a .sprite base class and one class per frame, plus a ZIP of everything
  • Move frames up or down, remove them, and hover or tap the preview to read a frame's rectangle

Packing modes, extrusion and the atlas fields

Input is PNG, JPG, WEBP or GIF. A GIF is read at its first frame only. Up to 500 sprites can be added, each at most 2048 pixels on either side, and together they may not exceed 64 megapixels; a file that would break a limit is skipped with a message that names it. Files are recognised from their header bytes, so a renamed file is judged by what it contains.

Two layouts are offered. MaxRects sorts sprites by their longest side and places each into the free rectangle where the smaller leftover gap is smallest (the best-short-side-fit rule), then splits and prunes the free space. Grid puts every sprite in an equal cell, sorted by file name with numbers compared as numbers, so frame-2 comes before frame-10. The cell is the largest sprite unless you type a cell width and height, and columns are chosen to waste the least area unless you set them. Sprites are never rotated, so every frame in the JSON says rotated: false.

Padding (0 to 32 pixels) leaves empty space between neighbours. It is added to the right and below each sprite, and the space after the last row or column is not counted, so a sheet is not enlarged for padding that touches nothing. Extrusion (0 to 8 pixels) copies each sprite's outermost row and column outward, including the corners, which stops texture filtering from pulling in a neighbour's colour at the edge. The frame rectangle in the atlas excludes the extruded border, and the packer reserves room for it.

Trimming removes fully clear borders from each sprite before packing. The alpha limit slider decides what counts as clear: at 0 only alpha 0 is empty, and raising it to, say, 8 ignores nearly invisible glow or compression noise. A trimmed frame records where its pixels sat in the original through spriteSourceSize and the original size through sourceSize, the same fields TexturePacker writes, so an engine can restore the original placement. A frame that is entirely transparent is kept as a 1 by 1 pixel frame so its name still exists in the atlas.

The sheet size is searched, not fixed. With power-of-two on, every width and height pair from 16 up to the maximum (512, 1024, 2048 or 4096) that could hold the total area is tried from smallest area upward; with it off, square sizes are tried in small steps and the finished sheet is cut down to the used bounds. If nothing fits at the maximum, the message says how many sprites did fit. Frame names keep their extension by default, as TexturePacker does; untick the box to get walk-1 instead of walk-1.png. Duplicate names get -2, -3 suffixes.

How it works

Each sprite is first drawn to its own canvas so its pixels can be read. When trimming is on, the code scans every row for the first and last pixel whose alpha is above the limit and keeps that box. The result is cached per threshold, so moving the slider back to an earlier value does not rescan.

MaxRects keeps a list of free rectangles, starting with one that covers the whole sheet. For each sprite it scores every free rectangle by min(free width minus sprite width, free height minus sprite height), breaks ties by the larger leftover, and takes the lowest. The placed sprite then cuts every free rectangle it overlaps into up to four smaller ones, and any free rectangle lying entirely inside another is discarded. Sorting big sprites first keeps the small ones free to fill the holes.

The sheet is drawn once from the final placements. Extruded borders are made by stretching a one-pixel strip of the sprite with smoothing switched off, so the copied pixels are exact rather than blended. The atlas and CSS are plain text built from the same placements, so the numbers always match the PNG that is saved.

Typical uses

  • Packing the frames of a character animation for a Phaser or PixiJS game and loading the array JSON, or for Godot through a TexturePacker import plugin
  • Combining thirty interface icons into one CSS sprite so a landing page makes a single image request
  • Preparing a tile set with extruded edges so a tilemap does not show seams between tiles when the camera scrolls
  • Making an equal-cell grid sheet for an engine that slices by cell size instead of reading an atlas

Building one

  1. Drop your frames onto the box, or click it and select them all. Use the arrows beside a frame to change its order in the JSON.
  2. Choose MaxRects for the smallest sheet, or Grid when your engine wants equal cells such as 32 by 32.
  3. Set padding and extrusion. Use 1 px of extrusion if the sprites are drawn scaled or filtered, and 0 for pixel art drawn with nearest-neighbour sampling.
  4. Decide whether to keep power-of-two sizes and trimming, and set the maximum sheet size.
  5. Check the preview. Hover a frame to see its name and rectangle, and fix any error message that says frames did not fit.
  6. Download the PNG and the format you need, or take the ZIP that holds the PNG, both JSON files and the stylesheet.

Example

Five frames, MaxRects, padding 2 px, extrusion 1 px, power-of-two on

walk-1.png 30 x 40
walk-2.png 30 x 40
walk-3.png 28 x 40
coin.png 16 x 16
key.png 12 x 20

Frame positions the packer gives

sheet 64 x 128 (the same set, power-of-two off: 84 x 86)
walk-1.png  x 1   y 1   30 x 40
walk-2.png  x 1   y 45  30 x 40
walk-3.png  x 35  y 1   28 x 40
key.png     x 35  y 45  12 x 20
coin.png    x 35  y 69  16 x 16
Each slot is its sprite plus 1 px of extrusion on every side plus 2 px of padding, so walk-1 occupies 34 x 44 and the next frame below starts at y 45.

Tips for best results

  • Pixel art that is drawn at integer scale with no smoothing does not need extrusion, but a game that zooms or rotates sprites does. One pixel is usually enough.
  • Name frames so that sorting by name gives playback order, such as run-01 to run-12, because grid mode and many engines follow the name order.
  • If the sheet comes out larger than expected, turn on trimming first. Transparent margins around art are the most common waste.
  • Keep padding at 2 px or more when the sheet will be mipmapped, because mip levels blend pixels across wider distances.
  • Use JSON (Hash) when you look sprites up by name, and JSON (Array) when you need frames in animation order.

Things to check before you rely on it

Rotation is not supported. Tools that rotate frames by 90 degrees can pack slightly tighter, and an engine importing this atlas will find rotated: false throughout.

A trimmed frame is smaller than the original sprite. Engines that ignore spriteSourceSize will draw it at the wrong offset, so check that your loader honours trim data, or turn trimming off.

A sprite over 2048 px, or a set over 64 megapixels in total, is refused. A very large background belongs in its own texture, not in an atlas.

In grid mode a single large sprite sets the cell size for all of them, so a mix of 16 px icons and one 256 px banner wastes most of the sheet. Pack mixed sizes with MaxRects.

The CSS classes use the trimmed rectangle. If you trimmed a sprite, the element is the trimmed size, and the comment above its class gives the offset to the original sprite box.

GIFs contribute only their first frame; this tool does not split an animated GIF into frames.

Best practices

  • Keep the sprite folder in source control and regenerate the sheet whenever frames change, rather than editing the PNG by hand.
  • Open the JSON once and check one frame against the preview rectangle before wiring the atlas into an engine.
  • Choose the smallest maximum sheet size your target hardware handles; 2048 is safe on almost every device, 4096 is not on old phones.

Reading the two JSON layouts

Both files carry the same data. In the hash layout, frames is an object whose keys are the frame names, so atlas.frames["coin.png"] gives the rectangle directly. In the array layout, frames is a list and each entry has a filename field, which keeps the order you set. Every entry holds frame (x, y, w, h on the sheet), rotated, trimmed, spriteSourceSize (the trimmed box inside the original), sourceSize (the original width and height) and a pivot at the centre. The meta block names the PNG, its size, the RGBA8888 format and a scale of 1.

These are the field names TexturePacker's generic JSON exporters use, so loaders written for them read the files without changes. This tool does not write the engine-specific formats such as Unity .tpsheet or Cocos plist.

Why extrusion helps and when it hurts

When a sprite is drawn at a fractional position or scale, the graphics card samples between pixels and can reach a texel just outside the sprite's rectangle. Without extrusion that texel belongs to the neighbouring sprite, and a thin line of the wrong colour shows up. Copying the edge pixels outward makes the neighbour's colour irrelevant.

Extrusion costs sheet area: each sprite grows by twice the extrusion in both directions, so 1 px on 16 px icons is a 27 percent bigger slot. For crisp pixel art drawn at whole-number scales with nearest-neighbour filtering the edge never bleeds, and 0 is the right setting.

Frequently asked questions

Is there a limit on how many sprites or a watermark on the sheet?

The limits are 500 sprites, 2048 px per sprite and 64 megapixels in total. The PNG and the data files contain only your artwork and its coordinates, with no watermark.

Can I load the atlas in Phaser or PixiJS?

Both read the hash and array JSON layouts. Use the file with the PNG's name in its meta.image field, and keep the two files together.

Why did my sheet come out bigger than the sum of my sprites?

Padding, extrusion and power-of-two rounding all add area, and a grid sheet uses the largest sprite for every cell. Trim edges, switch to MaxRects or turn off power-of-two to reduce it.