CSS animation and keyframes generator

Pick a ready animation (fade, slide, zoom, bounce, pulse, shake, wobble, spin, flip), set duration, delay, easing, repeats, direction and fill, watch

loading CSS animation and keyframes generator
About this tool

What is a CSS animation generator?

A CSS animation is a set of @keyframes (what changes) plus the animation property (how long, how fast, how many times). Writing both by hand means remembering the shorthand order, the units and the vendor quirks. This generator does the bookkeeping: you pick a ready animation, adjust a few controls, watch a square play it live and copy the finished CSS.

There are 13 starting points: fade in, fade out, slide up, slide down, slide from the left, slide from the right, zoom in, bounce, pulse, shake, wobble, spin and flip. Each one writes real keyframes, so the result is plain CSS you can paste into any stylesheet, with no library and no JavaScript. The preview uses the Web Animations API in your browser, so nothing is sent anywhere and no stylesheet is injected into the page.

The output has three parts: the @keyframes block, a class with the animation shorthand, and, when the option is on, a prefers-reduced-motion rule that turns the animation off for people who asked their system for less motion.

How to generate a CSS animation

  1. In "Animations", press the preset you want, for example "Slide up". The preview plays at once and the CSS appears below.
  2. For slides, bounce and shake, set "Distance" (4 to 200 px). Other presets hide this control because they do not travel.
  3. Set "Duration" (100 to 5000 ms) and "Delay" (0 to 3000 ms).
  4. Choose the "Easing": ease, ease-in, ease-out, ease-in-out or linear. For a custom curve, type a cubic-bezier(...) in "Or your own easing". An invalid value shows an error and the last valid easing stays.
  5. Choose "Repeats" (1 to 20) or tick "Repeat forever". Then pick the "Direction" and the "Fill mode".
  6. Change "Animation name" and "Class name" if you want your own names. Invalid characters become hyphens.
  7. Keep the reduced motion checkbox on, press "Play" to replay, and copy the result with "Copy CSS".

Examples

The default: slide up

With "Slide up" and the default values (24 px, 600 ms, ease-out, once, fill both), the output is:

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animated {
  animation: slide-up 600ms ease-out 0ms 1 normal both;
}

@media (prefers-reduced-motion: reduce) {
  .animated {
    animation: none;
  }
}

Add class="animated" to any element and it slides up 24 px while it fades in.

A heartbeat with "Pulse"

Pulse scales the element to 1.08 and back. Frames that share the same values are written together:

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

Tick "Repeat forever" and the shorthand ends in infinite, for example pulse 600ms ease-out 0ms infinite normal both.

A spinner with "Spin"

Choosing "Spin" sets the easing to linear and turns on "Repeat forever", because a loader that eases at every turn looks broken. The keyframes go from rotate(0deg) to rotate(360deg) and the shorthand is spin 600ms linear 0ms infinite normal both. Raise the duration to 1000 ms for a calmer spinner.

A springy entrance

Type cubic-bezier(0.34, 1.56, 0.64, 1) in "Or your own easing". The curve overshoots, so a slide or zoom ends with a small bounce. The shorthand then contains that curve in the easing slot. Draw your own curve in the cubic-bezier generator.

Common mistakes

  • Forgetting the fill mode. With "none", the element jumps back to its original style when the animation ends. Use "forwards" or "both" to keep the last frame, and "both" or "backwards" so a delayed element does not show before it starts.
  • Animating layout properties. The presets use transform and opacity on purpose, because browsers can animate them without recalculating layout. Do the same in your own keyframes.
  • Looping an entrance. A fade in that repeats forever is distracting. Reserve infinite loops for spinners and subtle pulses.
  • Ignoring reduced motion. Some users get dizzy from large movement. Leave the reduced motion rule on, or design a calmer version for those users.
  • Typing an easing with x outside 0 and 1. cubic-bezier(1.5, 0, 0.5, 1) is invalid CSS. Only y can go beyond the range.
  • Reusing a name. If two @keyframes share a name, the last one wins. Give each animation its own name.

Frequently asked questions

What is the difference between a CSS transition and an animation?

A transition goes from one state to another when something changes, such as a hover. An animation runs on its own through keyframes and can repeat, alternate and have several steps. For a single hover effect, a transition is enough.

Why does the shorthand have so many values?

The generator always writes the full form: name, duration, easing, delay, iteration count, direction and fill mode. It is longer but explicit, and the order of the two times matters: the first is the duration, the second is the delay.

Does the CSS work in React or Tailwind?

The CSS works anywhere. In React, convert the declarations with the CSS to React style converter and keep the @keyframes in a stylesheet, since inline styles cannot define keyframes.

Is anything uploaded?

No. The tool runs in your browser and the preview uses your own browser engine.

Report a problem