SuperDevTools

CSS Animation Generator: Keyframes Online

Presets:

Preview

Space bar: replay the preview.

Animation settings

time → progress →

Drag the two handles or type their coordinates: x between 0 and 1, y can go outside 0 to 1 for an overshoot effect.

Steps @keyframes

CSS code

Some people set their device to reduce motion (dizziness, migraines). This rule turns the animation off for them.

Everything is calculated in your browser: nothing is sent. Your last settings stay on this device.

Animate an element in CSS without writing @keyframes by hand

This CSS animation generator writes the @keyframes rule and the animation property for a common effect: fade in, slide, bounce, pulse, spin, shake or color shift. Start from a preset, adjust the steps and the timing, and the preview replays the animation after every change. Use it to reveal a card as it loads, shake a form field when the input is wrong or keep a loading icon spinning.

How to use it

  1. Pick a preset: “Fade in”, “Slide up”, “Slide in from left”, “Zoom in”, “Bounce”, “Pulse”, “Spin”, “Shake”, “Blink” or “Color shift”.
  2. In “Animation settings”, set the “Duration (s)”, the “Delay (s)”, the “Iterations” (or tick “Infinite”), the “Direction” and the “State before and after”.
  3. Choose a “Timing function”, or drag the two handles of the curve to build your own cubic-bezier.
  4. Under “Steps”, click a percentage and set the offset, scale, rotation, opacity or background color. “Add a step” inserts a new one halfway to the next step.
  5. Click “Replay preview” (or press the space bar), then “Copy code”.

How a CSS animation works

Keyframe steps

An animation comes in two parts. The @keyframes rule describes the element at given points, as a percentage of the duration, and the browser works out everything in between. The “Fade in” preset gives exactly this:

@keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
.animated { animation: fade-in 0.6s ease-out both; }

The animation shorthand reads in order: name, duration, timing function, then delay, iteration count, direction and fill mode whenever you change them from the defaults.

Timing functions and cubic-bezier

The timing function sets the pace. linear moves at a constant speed, while ease-out starts fast and slows down at the end, which suits an element coming into view. Each keyword is a Bézier curve: ease equals cubic-bezier(0.25, 0.1, 0.25, 1) and ease-in-out equals cubic-bezier(0.42, 0, 0.58, 1). When a handle goes above the frame, the animation overshoots its final value and then settles back. The “Zoom in” preset uses cubic-bezier(0.34, 1.56, 0.64, 1) for that springy feel.

Delay, iterations and fill mode

A delay of 0.3s makes the animation wait; a negative delay starts it partway through. animation-fill-mode: both holds the first step during the delay and the last step once it ends. Without it, a fading element shows up for a split second, disappears, then fades back in. alternate plays the animation forwards and then backwards, which pairs well with infinite for a soft pulse.

Animate without slowing the page down

Stick to transform (offset, scale, rotation) and opacity: the browser animates them without recalculating the layout. Animating width or top costs far more. To morph a cut-out shape, the clip-path generator gives you polygons with the same number of points, which blend smoothly from one to the next. For an animated background, start with the CSS gradient generator.

Respect prefers-reduced-motion

Large movements can make some people dizzy. The device setting that asks for less motion is read with @media (prefers-reduced-motion: reduce). Keep “Add the prefers-reduced-motion rule” ticked: the animation is then switched off for those visitors, and the element simply appears in its normal state. The preview on this page follows the same setting: on a device that asks for less motion, it only starts when you click.

Browser support

@keyframes, animation and prefers-reduced-motion work in all current browsers, with no vendor prefix. Before going live, you can minify the CSS.

FAQ

Why won't my animation play again?

An animation does not restart until its value changes. To replay it with JavaScript, remove the class, force the browser to recalculate (void el.offsetWidth), then add the class back.

What duration should I pick?

Between 0.2 and 0.5 seconds for an interface effect such as an entrance or a hover. Beyond 1 second, people notice the wait, except for a loop like a loading spinner.

Animation or transition?

A transition is enough to go from one state to another on hover or click. Use an animation as soon as you need several steps, a loop or a start that runs on its own when the page loads.

Are my settings saved?

Yes, your last settings stay on this device. Nothing is sent: everything is calculated in your browser.