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.
@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;
}
}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.
| Preset | Animates | Duration | Easing and repeat |
|---|---|---|---|
| Fade in | opacity 0 to 1 | 400ms | ease-out, once |
| Fade in up | opacity, translateY(12px) to 0 | 400ms | ease-out, once |
| Fade in down | opacity, translateY(-12px) to 0 | 400ms | ease-out, once |
| Slide in (left) | opacity, translateX(-24px) to 0 | 350ms | ease-out, once |
| Slide in (right) | opacity, translateX(24px) to 0 | 350ms | ease-out, once |
| Scale in | opacity, scale(0.92) to 1 | 300ms | cubic-bezier(0.34, 1.56, 0.64, 1), once |
| Bounce | translateY(0) to -12px and back | 800ms | ease-in-out, infinite |
| Spin | rotate(0deg) to 360deg | 1200ms | linear, infinite |
| Pulse | opacity 1 to 0.55 and back | 1600ms | ease-in-out, infinite |
| Ping | scale(2) and opacity 0 from 75% | 1000ms | cubic-bezier(0, 0, 0.2, 1), infinite |
| Shake | translateX between -6px and 6px | 600ms | ease-in-out, once |
| Wobble | translateX and rotate, settling to 0 | 900ms | ease-in-out, once |
04 · Use cases
When to use the CSS Animation Generator
- 01
Add a fade-in to a hero section without writing keyframes by hand
- 02
Compare easing curves on the same animation before choosing one
- 03
Get a bounce, shake or pulse as plain CSS instead of adding an animation library
- 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 05motion-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?
Which easing should I use?
Can I design my own keyframes?
Can I rename the keyframes and the class?
Which properties are cheap to animate?
How do I respect prefers-reduced-motion?
Why doesn't my animation run when the element appears?
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.
- CSS Animations Level 1
W3C. The specification defining keyframes, timing functions, and animation properties.
- animation
MDN Web Docs. Shorthand reference for the properties this tool emits.
- prefers-reduced-motion
MDN Web Docs. The media query the generated class is wrapped in by default.
- Understanding SC 2.3.3: Animation from Interactions
W3C WAI. The accessibility requirement to offer a way to disable non-essential motion.
08 · More
Tools that pair with Animation
CSS Box Shadow Generator
Build CSS box shadows with sliders for offset, blur, spread, color and opacity. Stack up to 6 layers, preview live, copy as CSS or Tailwind.
CSS Gradient Generator
Build linear, radial and conic CSS gradients with 2 to 8 color stops. Drag the stops or type exact values, then copy the CSS or a Tailwind class.
Glassmorphism Generator
Build a frosted-glass card with sliders for blur, opacity, saturation, border and radius. Preview it over five backdrops and copy the CSS or Tailwind.