GIFs are a handy way to share animations, but game engines and CSS animations usually prefer sprite sheets: one image that contains every frame arranged in a grid. Converting a GIF to a sprite sheet lets you drop an animation into Unity, Godot, GameMaker or a web page and play it frame by frame with full control over speed.
The process has two parts: extract the frames, then pack them into a grid. In this guide I’ll walk through both, using a free GIF frame extractor for the first step and a couple of free options for the second.
What a Sprite Sheet Needs
- Every frame the same size. Engines slice the sheet into equal cells, so frames must match exactly.
- Complete frames. Optimized GIFs store only changed pixels; each frame must be rebuilt into a full image first.
- Transparency preserved. PNG keeps the transparent background that most game sprites need.
- A known grid. You’ll tell the engine the number of rows and columns, or the cell size.
New to the format? What is a sprite sheet? explains the basics.
Step 1: Extract the GIF Frames
- Upload the GIF to the GIF splitter.
- Keep the grid at 1 × 1 so each frame is exported whole.
- Select all frames, or deselect any you don’t need (for example a duplicate first and last frame that would cause a stutter in a loop).
- Choose PNG frames only and download the ZIP. The frames are rebuilt in full, at the same size, with transparency intact and numbered in order.
- Note the frame delays shown in the preview; you’ll need them to set the animation speed in your engine.
Step 2: Pack the Frames into a Sheet
Option A: ImageMagick (one command)
With ImageMagick installed, run this in the folder containing the frames to create a sheet with 8 frames per row and no gaps:
magick montage frame_*.png -tile 8x -geometry +0+0 -background none spritesheet.png
-tile 8x sets 8 columns (rows are added automatically), -geometry +0+0 removes padding, and -background none keeps transparency.
Option B: A sprite packer tool
Tools such as TexturePacker or free online sprite sheet makers let you drag in the frames and choose the layout visually. Pick a “grid” or “strip” layout with zero padding unless your engine needs spacing.
Option C: Any image editor
Create a canvas exactly (frame width × columns) by (frame height × rows) and place each frame at its grid position. Slow, but no extra software required.
Choosing a Layout
| Frames | Common layouts | Notes |
|---|---|---|
| 8 | 8 × 1 strip, 4 × 2 grid | Strips are easy for engines to read |
| 12 | 4 × 3, 6 × 2 | Keep the sheet roughly square for big frames |
| 16 | 4 × 4, 8 × 2 | Power-of-two sheet sizes suit older engines |
| 24 | 6 × 4, 8 × 3 | Consider splitting into several animations |
Some engines and older GPUs prefer sheets whose width and height are powers of two (256, 512, 1024, 2048). If yours does, pick a layout that lands close to one, or add empty space at the edges.
Step 3: Import the Sheet into Your Engine
- Unity: set the texture’s Sprite Mode to Multiple and use the Sprite Editor’s Grid by Cell Count or Grid by Cell Size slicing. See slicing a sprite sheet in Unity.
- Godot: use the sprite sheet import in SpriteFrames, or set hframes and vframes on a Sprite2D.
- GameMaker: import it as a strip image and set the frame count and size.
- CSS: use the sheet as a background image and step through it with
steps()in a keyframe animation.
Going the Other Way
Already have a sprite sheet and need the individual frames back, to edit one or move to a different engine? The sprite sheet splitter auto-detects the grid and exports every cell as a transparent PNG.
Converting GIF Timing to Frames per Second
Game engines usually ask for frames per second rather than per-frame delays. GIF delays are stored in hundredths of a second, so the conversion is simple: 100 divided by the delay. A delay of 10 means 10 frames per second; a delay of 4 means 25 frames per second; a delay of 8 means 12.5, which most engines round to 12 or 13.
If the delays vary from frame to frame, the animation has deliberate pauses. You can mimic them by duplicating the frames that should hold longer, or, in engines that support it, by setting a custom duration for individual frames.
Common Mistakes
- Including a duplicate loop frame. Many GIFs repeat the first frame at the end for a smooth loop. In a game loop, that frame shows twice and causes a hitch. Deselect it before exporting.
- Scaling the sheet after packing. Resizing a sprite sheet blurs the cell borders and causes bleeding. Scale the frames before packing, if at all.
- Forgetting pixel art filtering. For pixel art, set the texture filter to “point” or “nearest” in your engine so sprites stay crisp.
Frequently Asked Questions
How do I convert a GIF to a sprite sheet?
Extract the GIF frames as PNG with a GIF splitter, then pack them into a grid with ImageMagick montage, a sprite packer or an image editor.
Do the frames need to be the same size?
Yes. Engines slice sprite sheets into equal cells, so every frame must match.
Why do some extracted GIF frames look incomplete?
Optimized GIFs store only changed pixels. Use a splitter that rebuilds full frames.
How do I keep the animation speed?
Note the frame delays from the GIF and set the matching frames per second or frame duration in your engine.
Should the sprite sheet have padding?
Usually no. Use zero padding unless your engine needs spacing to prevent texture bleeding.
From GIF to Game-Ready Sheet
Converting a GIF to a sprite sheet is two steps: extract clean, full PNG frames, then pack them into a grid your engine understands. Start with the free GIF splitter to get perfect frames in seconds.