Skip to content

CSS Animation Generator

Pick one of 12 CSS keyframe animations, set duration, delay, easing, iterations and direction, preview it, and copy the @keyframes CSS or a Tailwind class.

Presets
Iterations
CSS
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    animation: fadeIn 400ms ease-out 0ms 1 normal both;
  }
}
Tailwind
motion-safe:animate-[fadeIn_400ms_ease-out_0ms_1_normal_both]

The Tailwind class refers to the keyframes by name, so add the @keyframes fadeIn block above to your CSS as well.

01 · Definition

What is a CSS keyframe animation?

A CSS keyframe animation changes an element's styles over time without JavaScript. An @keyframes rule names the animation and lists the styles at points such as from, 50% and to. The animation property then applies it to an element with a duration, a timing function, a delay, an iteration count and a direction.

02 · Overview

How the CSS Animation Generator works

This CSS animation generator is built on 12 presets: fade in, fade in up, fade in down, slide in from left or right, scale in, bounce, spin, pulse, ping, shake and wobble. Set the duration, delay, easing, iteration count and direction, name the keyframes and the class, and watch the preview. The output is a @keyframes block plus a class, optionally wrapped in a prefers-reduced-motion media query, or a Tailwind arbitrary-value class. The keyframe steps themselves are fixed per preset. Everything runs in your browser.

03 · Guide

The 12 animation presets and their default timing

Each preset is a fixed set of keyframes that animates only opacity and transform. Picking one loads the duration, easing and repeat count in the table, which you can then change. The delay starts at 0ms and the direction at normal.

The generated class uses the animation shorthand in this order: name, duration, timing function, delay, iteration count, direction, fill mode. For Fade in up at its defaults that is animation: fadeInUp 400ms ease-out 0ms 1 normal both.

PresetAnimatesDurationEasing and repeat
Fade inopacity 0 to 1400msease-out, once
Fade in upopacity, translateY(12px) to 0400msease-out, once
Fade in downopacity, translateY(-12px) to 0400msease-out, once
Slide in (left)opacity, translateX(-24px) to 0350msease-out, once
Slide in (right)opacity, translateX(24px) to 0350msease-out, once
Scale inopacity, scale(0.92) to 1300mscubic-bezier(0.34, 1.56, 0.64, 1), once
BouncetranslateY(0) to -12px and back800msease-in-out, infinite
Spinrotate(0deg) to 360deg1200mslinear, infinite
Pulseopacity 1 to 0.55 and back1600msease-in-out, infinite
Pingscale(2) and opacity 0 from 75%1000mscubic-bezier(0, 0, 0.2, 1), infinite
ShaketranslateX between -6px and 6px600msease-in-out, once
WobbletranslateX and rotate, settling to 0900msease-in-out, once
Presets, what they animate and their defaults

04 · Use cases

When to use the CSS Animation Generator

  1. 01

    Add a fade-in to a hero section without writing keyframes by hand

  2. 02

    Compare easing curves on the same animation before choosing one

  3. 03

    Get a bounce, shake or pulse as plain CSS instead of adding an animation library

  4. 04

    Generate an animation that is already wrapped in a reduced-motion media query

05 · Examples

CSS Animation Generator examples

Preset: Fade in up, 400ms, ease-out

ex 01

@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

A common entrance animation: fade while rising 12px.

Preset: Pulse, 1600ms, ease-in-out, infinite, reduced-motion wrapper unticked

ex 02

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } } .pulse { animation: pulse 1600ms ease-in-out 0ms infinite normal both; }

A live-indicator pulse that repeats forever.

Preset: Slide in (left), 350ms, ease-out

ex 03

@keyframes slideInLeft { from { transform: translateX(-24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

Only transform and opacity change, so the browser can run it on the compositor.

Fade in up with the reduced-motion wrapper ticked

ex 04

@media (prefers-reduced-motion: no-preference) { .fade-in-up { animation: fadeInUp 400ms ease-out 0ms 1 normal both; } }

The animation only applies when the user hasn't asked for less motion.

Tailwind output for the same animation

ex 05

motion-safe:animate-[fadeInUp_400ms_ease-out_0ms_1_normal_both]

An arbitrary value. It refers to the keyframes by name, so the @keyframes block still has to be in your CSS.

06 · FAQ

Animation: frequently asked questions

How long should a UI animation last?

Most UI interactions sit between 150ms and 350ms. Anything under 100ms feels instant and is easy to miss; anything over 500ms starts to feel sluggish. Entrance and decorative effects can go longer. The duration slider runs from 50ms to 3000ms in 50ms steps and the delay slider from 0 to 2000ms.

Which easing should I use?

Use ease-out for things that enter the screen, because it decelerates into place, and ease-in for things that leave. Use ease-in-out for loops, and linear only for continuous motion such as a spinner. The tool offers those five keywords plus three cubic-bezier curves, including an overshoot.

Can I design my own keyframes?

No. The keyframe steps come from the 12 presets and are not editable in the tool. What you can change is the timing (duration, delay, easing, iterations, direction), the keyframes name and the class name. To go further, copy the CSS and edit the @keyframes block by hand.

Can I rename the keyframes and the class?

Yes. Both names are editable and must be plain CSS identifiers: letters, digits, hyphens and underscores, not starting with a digit. An invalid name shows an error and the output keeps the preset's name until it is fixed. The fill mode is always both.

Which properties are cheap to animate?

The cheap ones are transform and opacity. The compositor can handle both, so they don't trigger layout or paint on every frame. Animating width, height, top, or margin forces a layout pass on every frame, which is where janky animations come from. Every preset here animates only transform and opacity.

How do I respect prefers-reduced-motion?

Wrap the animation in @media (prefers-reduced-motion: no-preference), so motion is opt-in rather than opt-out. The tool does this by default: leave Wrap in a reduced-motion query ticked and the class is emitted inside that media query, and the Tailwind class gets the motion-safe: variant. The preview follows the same rule. If your system asks for reduced motion it stays still until you press Play.

Why doesn't my animation run when the element appears?

A CSS animation starts when the element is rendered with the animation applied. If you add the class to an element that was already there, it runs immediately; if the element is inserted by a framework, it runs on mount. The usual culprit is a display: none parent, because animations don't run on elements that aren't rendered.

07 · Reference

Specs and further reading

These are the primary sources this tool follows. Where a specification defines the behaviour, we link the specification, not a summary of it.

08 · More

Tools that pair with Animation

Last updated .