Sprite Sheet CSS Animation Generator
Turn a sprite sheet into a copy-paste CSS steps() animation with a live preview, right in your browser.
Your sprite sheet is read locally in your browser to build the preview and generate CSS; the image is never uploaded and stays on your device.
Tidying up the output? Try the CSS Formatter.
About Sprite Sheet CSS Animation Generator
This sprite sheet CSS animation generator turns a frame strip or grid into a ready-to-paste CSS animation built on @keyframes and the steps() timing function. Drop in a sprite sheet image for a live preview, or just type the frame width, height and count and let the tool do the background-position math for you. It handles both a single horizontal row and a full grid, walking frames row-major across columns and then rows, and pairs the keyframes with background-size so every cell lands exactly. Set the speed by FPS or total duration, name the animation, choose infinite or a fixed iteration count, and pick a direction. You get the full CSS — element sizing, the @keyframes block and the animation shorthand — which you can copy or download as a .css file. Everything runs on your device, so an uploaded sheet is read locally and never leaves your browser.
Features
- Upload a sprite sheet by drag-and-drop or file picker for an instant live preview, or work from dimensions alone
- Single-row mode emits a compact two-stop from/to keyframe stepping background-position across the strip
- Grid mode emits one explicit background-position stop per frame, row-major across columns then rows
- Adds background-size in grid mode so each cell scales to your exact frame dimensions
- Set timing by frames-per-second or by total duration in milliseconds
- Choose infinite looping or a fixed iteration count, plus normal, reverse or alternate direction
- Sanitizes the animation name into a valid CSS identifier automatically
- Copy the full CSS or download it as a .css file with one click
How to use the Sprite Sheet CSS Animation Generator
- Upload a sprite sheet, or skip the upload and just enter your frame dimensions.
- Pick single row or grid, then set frame width, height and count (plus columns and rows for a grid).
- Set the speed with FPS or a total duration, then name the animation and choose iteration and direction.
- Watch the element animate in the live preview to confirm the framing is right.
- Copy the generated CSS or download it as a .css file and drop it into your project.
Example
Input
8 frames, 64×64 each, single row, 12 fps, infinite
Output
.sprite {
width: 64px;
height: 64px;
background-repeat: no-repeat;
animation: sprite 0.667s steps(8) infinite normal;
}
@keyframes sprite {
from { background-position: 0 0; }
to { background-position: -512px 0; }
}
A single-row sheet needs only steps(8) and a two-stop keyframe to play all frames.
Common errors & troubleshooting
- The animation stutters or shows a sliver of the next frame. — Make sure frame width and height match the sheet exactly. If cells are uneven, trim the sheet so every frame is the same size.
- Only the first frame shows and nothing moves. — Check that the frame count is at least 2 and that background-repeat stays no-repeat so the sheet is not tiled.
- A grid sheet plays the wrong frames or drifts diagonally. — Confirm columns and rows match the sheet layout; the tool walks frames left-to-right then top-to-bottom, so the counts must be right.
- The animation runs too fast or too slow. — Switch the timing mode between FPS and total duration. Total duration divided by frame count gives the per-frame time.
Frequently asked questions
- How does steps() animate a sprite sheet?
- steps(n) splits the animation into n equal chunks and jumps between them instead of interpolating, so background-position snaps from one frame to the next. Using steps() equal to your frame count means each frame is shown for one step with no blurry in-between positions.
- Do I need to upload my image?
- No. Uploading a sprite sheet gives you a live preview, but you can generate correct CSS from just the frame width, height and count. Without an image the preview shows a placeholder grid while the math and output stay accurate.
- What is the difference between single-row and grid mode?
- Single-row mode assumes all frames sit on one horizontal strip and emits a compact from/to keyframe. Grid mode handles multi-row sheets by emitting one background-position stop per frame, moving across columns then down rows, and adds background-size so the whole sheet scales correctly.
- Should I set FPS or a total duration?
- Use FPS when you know how many frames should play each second; the tool converts it to a duration by dividing the frame count by the FPS. Use total duration when you want the whole loop to take a specific number of milliseconds regardless of frame count.
- How do I loop the animation forever or only a few times?
- Choose Infinite for a non-stop loop, which maps to animation-iteration-count: infinite. Choose Count and enter a number to play the sequence a fixed number of times, and use the direction option for reverse or alternate playback.
- Is my sprite sheet uploaded anywhere?
- No. The image is read locally with your browser's FileReader to build the preview and it never leaves your device; the generated CSS is computed entirely on your machine.
Related tools
- CSS / SCSS Formatter — Beautify or minify CSS/SCSS/LESS, sort properties and remove duplicates.
- SVG Optimizer — Minify SVG — strip comments, metadata and editor cruft, and collapse whitespace.
- Image Optimizer — Re-encode and shrink images (JPEG/WebP/PNG), optionally resizing.
- Image Format Converter — Convert images between PNG, JPEG and WebP entirely in your browser.
- CSS Unit Converter — Convert between px, rem, em, pt and % live with a configurable root font size.
All ArrayKit tools