How to Convert a GIF to a Sprite Sheet for Games and CSS

To convert a GIF to a sprite sheet, add the animated GIF to the GIF to Sprite Sheet Converter, choose how many frames go in each row and the gap between them, then download the PNG sheet and its JSON coordinates. To use the sheet you only need three numbers: the frame width, the frame height and the number of columns.

A GIF stores an animation as a sequence of frames with delays. Game engines and CSS want the opposite: one image with every frame laid out on a grid, plus a rule for which rectangle to show when. This guide does the conversion, then shows how to play the result in Phaser, Godot, Unity and plain CSS with steps().

What the Converter Produces

Two files. spritesheet.png is a transparent PNG with the frames laid out left to right, top to bottom. spritesheet-coordinates.json lists each frame as frame_0, frame_1 and so on, with its x, y, w and h on the sheet and its duration in milliseconds taken from the GIF. The layout follows the common "JSON hash" atlas format (a frames object plus a meta block with the image name and size), which several engines and atlas loaders read directly.

The size of the sheet is easy to predict. With frame width w, c columns, r rows and a gap of g pixels (the gap is also added around the outside):

For example, 12 frames of 64 × 64 px in 4 columns with a 2 px gap gives 3 rows and a 266 × 200 px sheet.

How to Convert a GIF to a Sprite Sheet in 5 Steps

Step 1Add the animated GIF

Open the GIF to Sprite Sheet Converter and drop in a .gif file. Each frame is decoded at the GIF's full canvas size, the assembled sheet appears in the After pane, and numbered thumbnails of every frame line up beneath it. Frame decoding relies on the browser's ImageDecoder API, so use a Chromium browser such as Chrome or Edge. Nothing is uploaded; the GIF never leaves the tab.

Step 2Set the columns

How many frames per row runs from 1 to 16. The tool picks a starting value from the frame count (all frames in one row for up to 4 frames, 4 columns up to 16 frames, 6 columns beyond that). For CSS, put every frame in one row by setting columns equal to the frame count. For a game engine, a roughly square grid keeps the texture compact; many engines also prefer textures no larger than a few thousand pixels on a side.

Step 3Set the gap between frames

Gap between frames runs from 0 to 20 px and defaults to 2. When a game engine scales or filters a texture, it can sample a pixel or two from the neighbouring frame, which shows up as a flickering line at the edge of the sprite. A 1 to 2 px gap prevents that. For CSS, set it to 0 so the background-position maths stays simple.

Step 4Choose how many frames to keep

How many frames to keep offers All Frames, Every 2nd Frame and Every 3rd Frame. Skipping frames gives a smaller sheet and a choppier animation. The JSON compensates: each kept frame's duration includes the frames skipped after it, so the loop takes the same total time as the original GIF.

Step 5Download the PNG and JSON

Click Download Sprite Sheet (PNG) and Download JSON Coordinates. The status line at the top of the settings panel tells you everything you need, for example "8 frames arranged in 8 cols × 1 rows (512×64px)". Write down the frame size, columns and frame count before you leave the page.

Convert your GIF now

Open GIF to Sprite Sheet Converter

How to Animate a Sprite Sheet with CSS steps()

Say your GIF has 8 frames of 64 × 64 px and you exported them in 8 columns with a 0 px gap, giving a 512 × 64 px sheet. Show one frame-sized box and slide the background left by the full sheet width in 8 jumps:

.sprite {
  width: 64px;
  height: 64px;
  background: url("spritesheet.png") 0 0 no-repeat;
  animation: play 0.8s steps(8) infinite;
}

@keyframes play {
  from { background-position: 0 0; }
  to   { background-position: -512px 0; }
}

steps(8) shows positions 0, -64, -128 and so on up to -448 px, then loops, so the box never lands on the empty position at -512 px. Set the duration to the sum of the frame durations in the JSON: eight frames of 100 ms each is 0.8s. If you want to display pixel art larger, scale the element with transform: scale(3) and add image-rendering: pixelated so the pixels stay sharp.

If you kept a gap of g pixels, the same pattern works with an offset: start at -g and end at -(g + frames × (w + g)). With a 2 px gap and 64 px frames that is -2px to -530px. Multi-row sheets need one animation per row, which is why a single row is the easy choice for CSS.

How to Use the Sprite Sheet in Phaser, Godot or Unity

Tips and Related Workflows

Frequently Asked Questions

What frame size does the sprite sheet use?

The GIF's own canvas size. Every frame is decoded at the full GIF size, so a 64 x 64 GIF gives 64 x 64 frames. The status line and the JSON both list the frame size and the sheet size.

Why does my sprite sheet only have one frame?

Frame-by-frame decoding uses the browser's ImageDecoder API, which Chromium browsers such as Chrome and Edge provide. In a browser without it, only the first frame can be read, so open the tool in Chrome or Edge.

Does skipping frames change the animation speed?

Not in the JSON. When you keep every 2nd or 3rd frame, each kept frame's duration includes the time of the frames skipped after it, so the loop length stays the same. It just looks choppier.

Can I turn a sprite sheet back into separate frames?

Yes. Load it into the Sprite Sheet Cutter, slice by grid count or frame size, set the border and gap to match, and download all frames as a ZIP.

Is the GIF uploaded anywhere?

No. The GIF is decoded and the sheet is drawn on a canvas in your browser tab, so unreleased game art stays on your machine.

Related guide: How to Pack a Sprite Sheet - combine separate sprite files into one atlas with a JSON map.

Ready to build your sheet?

Open GIF to Sprite Sheet Converter
← All How-To Guides