How to Pack a Sprite Sheet (Texture Atlas + JSON)

To pack individual sprites into a texture atlas, open the Sprite Sheet Packer, select all your sprite images with Upload Sprites, press Pack the sprites, and save both spritesheet.png and spritesheet.json. The packer arranges sprites edge to edge in rows up to 1024 pixels wide and outputs a JSON Hash map ready for Phaser 3, PixiJS, CSS sprites, or manual slicing in Unity and Godot 4.

Loading forty separate PNG icons or animation frames means forty HTTP requests on the web and repeated texture switches on the GPU. Combining those assets into a single image lets a browser fetch one file and lets a 2D renderer draw many sprites from one texture in memory.

Sprite Sheet vs. Texture Atlas

A sprite sheet is one large image that holds multiple smaller images (frames, tiles, or icons) arranged inside a single canvas. Classic character sheets often place every frame inside an identical grid cell, such as 64 by 64 pixels per cell.

A texture atlas goes one step further: it pairs the combined image with a coordinate map (here, a JSON file) listing the exact x, y, w (width), and h (height) rectangle for every named sprite. Because the coordinates are stored explicitly, you can pack a 64 by 96 character next to a 32 by 32 coin and a 128 by 24 health bar without wasting grid space.

Name Your Frames Before Packing

The packer builds each key in the JSON frames object straight from the uploaded file's name. If you upload hero_idle_01.png and coin.png, those exact strings become the frame names you pass to Phaser or PixiJS.

What if you drag files from two folders that happen to share a name, such as two copies of icon.png? The packer tracks names as they load and appends a counter before the file extension on duplicates, turning the second file into icon_2.png (or appending _2 at the end if there is no extension) so nothing is silently overwritten. Even so, giving every file a clear, lowercase name like walk_01.png before you open the tool keeps your game code clean.

Tip before you start: Use PNG files with transparent backgrounds whenever possible. JPG and WebP files also load, and the packed output is always saved as a transparent PNG.

How to Pack a Sprite Sheet in 3 Steps

Step 1Name your files and click Upload Sprites

Open the Sprite Sheet Packer and click Upload Sprites (or drag and drop your images onto the upload box). Select all the sprite images you want in the atlas at once; the tool filters for image files and reports how many loaded.

Sprite Sheet Packer after choosing eight sprite files, showing the Upload Sprites button and the message 8 images loaded

Step 2Press Pack the sprites

Click Pack the sprites. The tool runs its shelf layout pass, draws every image onto a single canvas, and fills the JSON output box next to the preview. Inspect the preview canvas to confirm none of your sprites are missing.

Step 3Click Download Image and Download JSON

Click Download Image to save spritesheet.png and Download JSON to save spritesheet.json. Place both files in the same directory in your project (such as assets/), because the JSON meta.image field references "spritesheet.png" directly.

Packed sprite sheet preview with the JSON frame map beside it and the Pack the sprites, Download Image and Download JSON buttons

Pack your sprites into an atlas

Open Sprite Sheet Packer

How the Packer Lays Sprites Out

Understanding the exact layout rules prevents surprises when you open the sheet in an engine or image editor:

Because sprites sit edge to edge with zero gap, linear texture filtering or mipmapping in a game engine can sample a pixel from a neighbouring sprite along a shared border. If you use smooth scaling rather than nearest-neighbour pixel rendering, add a 1 px or 2 px transparent margin inside each source PNG before packing.

Loading the Atlas in Phaser 3, PixiJS, Unity, Godot 4, and CSS

Phaser 3

The exported spritesheet.json uses the JSON Hash format that Phaser's this.load.atlas expects natively. Load both files in preload(), then reference frames by their file names:

function preload() {
  this.load.atlas('ui', 'assets/spritesheet.png', 'assets/spritesheet.json');
}

function create() {
  this.add.sprite(160, 120, 'ui', 'hero.png');
}

PixiJS

PixiJS reads TexturePacker-style JSON Hash files through its Assets loader. Because meta.image in the JSON already says "spritesheet.png", loading the JSON fetches the PNG from the same folder automatically:

import { Assets, Sprite } from 'pixi.js';

const sheet = await Assets.load('assets/spritesheet.json');
const hero = new Sprite(sheet.textures['hero.png']);

Unity

Unity does not parse TexturePacker JSON Hash files out of the box without a third-party importer or a short custom editor script. You still have two straightforward paths:

Godot 4

Godot 4 also does not import generic TexturePacker JSON Hash files without an importer plugin, so slicing is manual unless you write a small editor script. Import spritesheet.png, create an AtlasTexture resource for each frame, assign spritesheet.png as its Atlas, and enter the JSON frame's x, y, w, and h into Region. Attach those AtlasTexture resources to a Sprite2D or a SpriteFrames list on an AnimatedSprite2D. For pixel art, set the CanvasItem texture filter to Nearest so edges stay sharp.

CSS Sprites

On a regular web page, you can turn any frame in spritesheet.json into a CSS class with zero JavaScript. Suppose your JSON contains these two entries:

"hero.png": { "frame": { "x": 0, "y": 0, "w": 64, "h": 96 } }
"star.png": { "frame": { "x": 64, "y": 0, "w": 32, "h": 32 } }

Set each class's width and height to w and h, and set background-position to the negative of x and y so the sheet shifts up and left into the element window:

.sprite {
  display: inline-block;
  background-image: url('spritesheet.png');
  background-repeat: no-repeat;
}
.sprite-hero { width: 64px; height: 96px; background-position: 0 0; }
.sprite-star { width: 32px; height: 32px; background-position: -64px 0; }

Engine Quick-Reference Table

Engine What to load Notes
Phaser 3 spritesheet.png + spritesheet.json Direct support via this.load.atlas(); frame keys match uploaded filenames.
PixiJS spritesheet.json (with PNG beside it) Assets.load() reads meta.image to fetch spritesheet.png automatically.
Unity spritesheet.png Does not read the JSON natively; slice in Sprite Editor (Automatic if padded, manual/scripted if touching).
Godot 4 spritesheet.png + JSON coordinates Manual AtlasTexture regions using JSON x, y, w, h (or use an importer plugin); set Nearest filter for pixel art.
CSS Sprites spritesheet.png Copy w, h, -x, and -y from spritesheet.json into CSS classes.

Common Mistakes and How to Fix Them

Nothing Is Uploaded

The Sprite Sheet Packer reads your image files, runs the shelf-packing algorithm, draws the combined canvas, and generates the JSON file inside your browser tab. Unreleased game art, character animations, and UI kits never leave your device, and you can verify zero network uploads in your browser's DevTools Network tab.

Frequently Asked Questions

What is the difference between a sprite sheet and a texture atlas?

A sprite sheet is the combined image file containing all your smaller graphics. A texture atlas pairs that combined image with a data file (such as JSON) recording the exact x, y, width, and height rectangle for every frame, even when sprites have different dimensions.

How are frame names chosen in the JSON output?

Each frame key in the JSON frames object is taken directly from the uploaded file name, such as hero.png. If you upload two files with the same name, the packer appends a counter before the extension (so the second icon.png becomes icon_2.png) to avoid overwriting.

Does the packer add padding, trim transparency, or rotate sprites?

No. Every sprite is placed edge to edge at its full original dimensions with no padding, no trimming of transparent pixels, and no rotation. Every JSON frame has rotated set to false and trimmed set to false.

What happens if one of my sprites is wider than 1024 pixels?

The shelf packer wraps rows at 1024 pixels wide, so a sprite wider than 1024 pixels is placed at the start of its own row and expands the final sheet width to match that sprite.

Can Unity or Godot 4 load spritesheet.json automatically?

Not out of the box without a plugin or custom editor script. For Unity, import spritesheet.png with Sprite Mode set to Multiple and slice in the Sprite Editor; for Godot 4, create AtlasTexture resources using the x, y, w, and h values from spritesheet.json.

Do I need to rename spritesheet.png before loading in Phaser or PixiJS?

Keep the image named spritesheet.png unless you also edit the image field inside the meta block of spritesheet.json. PixiJS uses that field to locate the PNG automatically when you load the JSON.

Ready to build your texture atlas?

Open Sprite Sheet Packer
← All How-To Guides