CSS animation keyframes generator

A CSS animation generator creates @keyframes animations from editable stops: set duration, easing, direction, fill mode and the opacity, translate, scale and rotate values at each percentage stop, then copy valid CSS to paste into your stylesheet.

Use this free CSS keyframes generator to build an animation, preview it live and copy valid @keyframes CSS. Set the duration, easing, iteration count, direction, fill mode and editable stops, then paste the result into your stylesheet.

How do you use the keyframes generator?

  1. Set the duration, easing curve, iteration count, direction and fill mode for the animation.
  2. Edit the percentage stops and the opacity, translate, scale and rotate values at each one, or add another stop.
  3. Watch the live preview to check the timing and motion before you ship it.
  4. Click Copy @keyframes CSS and paste the rule and its animation class into your stylesheet.

Animation settings

Iteration count accepts a number or infinite.

Keyframe stops

Stop 1
Stop 2
Stop 3

Live preview

The square runs your keyframes with the chosen timing. Preview pauses when the visitor asks for reduced motion.

Generated CSS

@keyframes custom-animation {
  0% {
    opacity: 1;
    transform: translate(0px, 0px) scale(1) rotate(0deg);
  }
  50% {
    opacity: 0.6;
    transform: translate(0px, -12px) scale(0.9) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(0px, 0px) scale(1) rotate(0deg);
  }
}

.animated-element {
  animation: 1000ms ease-in-out 1 normal both custom-animation;
}

What can you animate with @keyframes?

Any animatable CSS property can change between keyframes. The generator focuses on the properties that cover most interface motion: opacity for fades, translate for entrances and slide-outs, scale for pop and press feedback, and rotate for spinners and attention cues. Combine them at each stop to build a card reveal, a loading indicator, a notification bounce or a button pulse, then copy one clean block of CSS. Need a ready-made loading animation? Use the CSS loader generator.

Which related CSS tools help with motion?

What do people ask about CSS keyframes?

What is @keyframes in CSS?

@keyframes defines the stages of a CSS animation. Each stage is a percentage or from/to selector with the styles that apply at that point. When the animation runs, the browser interpolates between those stages, so a 0% opacity of 0 and a 100% opacity of 1 fades the element in.

How do I write a keyframes animation?

Write the @keyframes rule with a name, add at least the start and end stages, then attach it with the animation shorthand: animation: 1000ms ease-in-out 1 normal both my-animation;. The shorthand order is duration, timing function, iteration count, direction, fill mode and name.

What does animation-fill-mode do?

animation-fill-mode decides which keyframe styles apply outside the animation's active time. forwards keeps the 100% styles after it ends, backwards applies the 0% styles during a delay, both applies both, and none returns the element to its own styles once the animation finishes.

Can a keyframes animation have more than two stops?

Yes. Add as many percentage stops as the motion needs, such as 0%, 25%, 50%, 75% and 100%. Each stop can change opacity, translate, scale and rotate independently. Keep offsets in ascending order for CSS that is easy to read, though the browser applies rules by percentage rather than source order.

How do I respect reduced motion?

Wrap the animation in an @media (prefers-reduced-motion: reduce) block and set animation: none, or reduce the movement to a simple fade. The live preview on this page already pauses when the visitor's operating system asks for reduced motion.

What animation duration should I use for UI motion?

Most interface animations feel right between 150ms and 400ms. Shorter times suit small hover and press feedback, while larger entrances, drawers and page transitions often sit around 300ms to 500ms. Longer durations work for decorative loops, but keep repeated motion subtle.

More CSS generators

Color tools

Image tools

Image & SVG tools

Typography & units

More free tools

All free tools