DevTools Pro · All tools · About

CSS Animation Generator

About the CSS Animation Generator

This CSS animation generator writes a complete @keyframes block plus the matching animation-* properties while you watch the result on a live preview element. Start from Fade In, Slide In Left, Bounce or Rotate, edit the keyframes by hand, and copy CSS that runs in any modern browser without JavaScript.

How CSS animations work

A CSS animation has two parts. The @keyframes rule describes what changes at each point, from 0% (or from) to 100% (or to). The animation-* properties on an element decide how long it runs, how it eases and how often it repeats.

The name links the two: animation-name: fade-in; plays @keyframes fade-in { ... }. The generator keeps the name a valid identifier by replacing spaces and symbols with hyphens.

Animation properties explained

animation-duration is the length of one cycle, such as 1s or 400ms. animation-delay waits before starting and can be negative to begin partway through. animation-iteration-count takes a number or infinite.

animation-direction controls playback order: normal, reverse, alternate (forward then back) or alternate-reverse. animation-fill-mode: forwards keeps the last keyframe applied after the animation ends, while backwards applies the first keyframe during the delay and both does both.

Timing functions: ease vs linear vs ease-in-out

ease (the default) starts quickly and slows down at the end. linear keeps a constant speed, which suits spinners and continuous rotation. ease-in starts slow and speeds up, good for elements leaving the screen, and ease-out starts fast and settles, good for elements entering.

ease-in-out is slow at both ends. For anything more custom, CSS also accepts cubic-bezier() and steps(); this tool offers the five keyword functions.

Smooth and accessible animations

Animate transform and opacity where you can. Browsers can run them on the compositor, while animating width, height, top or margin forces layout on every frame and can stutter.

Some people get dizzy from motion. Wrap large movements in @media (prefers-reduced-motion: reduce) and turn them off or replace them with a simple fade.

How to Use the CSS Animation Generator

  1. Under Keyframes, click a preset (Fade In, Slide In Left, Bounce or Rotate) or type your own rules in Custom Keyframes.
  2. In Animation Controls, set the Animation Name, Animation Duration and Animation Delay, for example 1s and 0.2s.
  3. Pick a Timing Function, Animation Direction and Animation Fill Mode, and enter an Iteration Count such as 3 or infinite.
  4. Change the preview element's Width, Height and Background Color, then press Play. Use Reset to restart from the first frame.
  5. Copy the result from the CSS Code box with Copy CSS.

Frequently Asked Questions

Why does my element jump back after the animation ends?
Without a fill mode the element returns to its normal styles. Set Animation Fill Mode to forwards (or both) to keep the final keyframe.
How do I make an animation loop forever?
Enter infinite as the Iteration Count. Combine it with alternate direction for a smooth back-and-forth loop.
Why is the preview not moving?
The preview starts paused, so press Play. Choosing a preset starts it automatically, and Reset rewinds it to the first frame.
Can I use cubic-bezier easing?
The Timing Function menu offers the five keywords. You can replace the value in the copied CSS with any cubic-bezier() or steps() function.
CSS animation or transition: which should I use?
Use a transition for a simple change between two states, such as a hover color. Use an animation when you need more than two steps, a loop, or motion that starts on its own.
Is my CSS uploaded anywhere?
No. The CSS is generated in your browser and nothing is sent to a server.

Related tools