CSS Animation Generator

Builds a CSS keyframe animation — pulse, spin, bounce, shake, fade, glow or slide-in — with live controls for duration, delay, easing, direction and iteration count, and gives you the @keyframes block and the animation shorthand ready to paste.

Live demo · real result from this tool

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use CSS Animation Generator

  1. Pick a preset animation and watch the live preview.
  2. Adjust duration, delay, easing, direction and iteration count until it feels right.
  3. Copy the generated @keyframes block and the animation shorthand into your stylesheet.
  4. Apply the class to your element — the keyframe name is included in the generated code.
  5. The generated CSS needs no vendor prefixes — unprefixed animation has been supported everywhere for years.
  6. A keyframe name must be unique within the document; rename it if you are generating more than one animation.
  7. Durations under about 150ms read as an abrupt jump rather than a movement; 200–400ms suits most interface transitions.

Animate transform and opacity, not layout

The presets here move things with transform and opacity for a reason: those two properties are composited on the GPU without the browser recalculating layout or repainting. Animating width, height, top, left or margin forces a reflow on every frame, which is what a janky animation on a mid-range phone actually is. If you need something to move, translate it rather than changing its position; if you need it to grow, scale it rather than changing its width.

What the easing choice actually changes

Easing is the curve mapping elapsed time to progress. linear is constant speed and looks mechanical — correct for a spinner, wrong for almost everything else, because nothing in the physical world starts and stops instantly. ease-out starts fast and settles, which suits things arriving on screen. ease-in suits things leaving. ease-in-out is the safe default for anything that loops. You can substitute your own cubic-bezier in the generated code if a preset is close but not quite right.

Iteration count, direction and where the element ends up

infinite is right for a loading indicator and wrong for anything a user has to read past — perpetual movement in peripheral vision is genuinely tiring. alternate runs every second cycle backwards, which turns a one-way keyframe list into a smooth there-and-back without writing the return frames. When an animation runs a fixed number of times the element snaps back to its original styling at the end unless you add animation-fill-mode: forwards, which is the single most common surprise with CSS animation.

Respect reduced motion

Some people get motion sickness from parallax and spin effects, and every operating system has a reduce-motion setting that browsers expose. Wrap decorative animation in a media query — @media (prefers-reduced-motion: reduce) { animation: none; } — and leave functional indicators such as loading spinners alone. It is three lines, and it is the difference between a site somebody can use and one they cannot.

Frequently asked questions

What is a CSS keyframe animation?
An animation defined with @keyframes that specifies styles at certain points in the animation sequence.
What is an easing function?
Controls the speed curve of the animation. ease-in starts slow, ease-out ends slow, cubic-bezier allows custom curves.
Can I loop animations infinitely?
Yes — set animation-iteration-count to infinite.
Why does my element jump back at the end of the animation?
Because an animation only overrides styles while it is running. Add animation-fill-mode: forwards to hold the final keyframe, or set the end state on the element itself and animate from the starting state.
Should I use a CSS animation or a transition?
A transition for a change between two states triggered by something — hover, a class being added, focus. An animation for anything with intermediate steps, that loops, or that should run on its own without a trigger. Transitions are simpler; reach for keyframes when you need more than start and end.
Do CSS animations hurt performance?
Not when they animate transform and opacity, which the compositor handles without touching layout. They do when they animate geometry — width, height, top, left — or box-shadow, which repaints. Many simultaneous animations also cost, particularly on low-end phones.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close