CSS Keyframes Generator

Choose an effect, set the time, speed curve and repeats, and get the @keyframes and animation CSS together with a preview that plays right on the page.

Use the tool

Loading the tool…

About CSS Keyframes Generator

Build a CSS animation with keyframes. Enter a name for the animation, choose an effect such as a fade-in, slide, bounce or shake, and set the distance, duration, speed curve, delay and number of times it repeats. A preview shows the animation, and the CSS is ready to copy.

Worked example

Name the animation "fade-in", choose the fade effect and a duration of 1 second. Copy the CSS into your stylesheet.

Limits

Heavy or constant animation can distract people and can cause discomfort for some visitors. Respect the reduced-motion setting, and keep animations short.

How to use CSS Keyframes Generator

  1. Give the animation a name and pick an effect.
  2. Set the duration, speed curve, delay and repeat count.
  3. Choose direction and fill mode.
  4. Copy the CSS and add the class "animated" to your element.

Good to know

  • The animation shorthand is written as name, duration, timing function, delay, count, direction, fill mode.
  • Fill mode "both" keeps the first frame during the delay and the last frame afterwards.
  • Names cannot be CSS keywords such as none, ease or infinite.
  • For people who prefer less motion, wrap animations in @media (prefers-reduced-motion: reduce) and switch them off.

Frequently asked questions

How do I make an animation repeat forever?

Type infinite in "How many times".

What does alternate do?

It plays forwards, then backwards, then forwards again, so the motion goes back and forth smoothly.

Will the preview match what I see on my site?

It uses the same timing, so it should. Your own element may have other styles that change how the effect looks.