CSS Animation Generator

Pick a motion — fade, slide, bounce, rotate, scale or pulse — tune its duration, delay and repeats, watch it play on the stage, and copy complete @keyframes CSS.

1Choose an animation
2Tune duration, delay, repeats
3Copy the keyframes CSS
Hold first & last frame (both)
W

Private by design: 100% in your browser — nothing is uploaded, no sign-up. This tool runs entirely on your device.

How to use this CSS animation generator

Choose an animation from the first dropdown and it starts playing on the blue box in the stage immediately. The six presets cover the motions interfaces actually need: fade and slide for entrances, scale for pop-ins and dialogs, bounce for drawing attention to one element, rotate for loaders, and pulse for gentle, living emphasis. Below the animation's name, three controls shape its character — duration makes it brisk or stately, delay holds it back for sequencing, and repeat decides whether it plays once, a few times, or loops forever — while the easing dropdown controls how its speed rises and falls.

Every change restarts the preview from the beginning, so you always judge the animation from its first frame rather than catching it mid-loop. When it feels right, copy the output: a complete package of the @keyframes rule that defines the motion plus a ready class that applies it with your exact settings. Paste both into your stylesheet, add class="animated" to your element, and the motion you tuned here is the motion on your page — no library, no JavaScript required on your site at all.

Restraint is the professional skill this tool cannot give you, so take it as guidance: one animated element per view is emphasis; five is noise. Entrances should be short — most interface motion lives between 0.2 and 0.6 seconds — and infinite loops should be reserved for things that genuinely never finish, like loading indicators. The bounce preset at this page's default 1.2 seconds is deliberately playful; for a production button nudge you would shorten it and set repeat to once.

Example: the default bounce, in full

Open this page untouched and the generator produces this complete, working code:

@keyframes bounce { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-32px); } 55% { transform: translateY(0); } 70% { transform: translateY(-14px); } 85% { transform: translateY(0); } } .animated { animation: bounce 1.2s ease-in-out 0s infinite both; }

The keyframes tell the story of a bounce as percentages of one cycle: on the ground at 0%, up 32 pixels at 30%, back down at 55%, a smaller hop to −14 pixels at 70% — because real bounces lose energy — and settled by 85%, resting until the cycle ends. The class line then directs the performance: run bounce, take 1.2 seconds, ease in and out, start immediately (0s delay), repeat forever, and hold the first and last frames outside the run (both). Change any word in that sentence and the generator's output changes with it — that one line is the whole control panel, written in CSS.

Why these presets only move transform and opacity

Every animation here is built from two properties, transform and opacity, and that is a performance decision, not a lack of imagination. A browser renders a page in stages — layout, paint, composite — and most properties, when animated, force the expensive early stages to rerun on every frame. Transform and opacity skip both: the element is moved or faded as a finished layer by the graphics hardware. The result is a steady 60 frames per second even on a budget phone, while a width or margin animation of the same element stutters visibly. When you extend these presets with your own keyframes, keep the rule: if a motion can be expressed as a transform, express it as a transform.

Motion with manners: accessibility and taste

Animation is the only design material some users physically cannot tolerate. Vestibular disorders can make parallax and bouncing genuinely nauseating, and operating systems expose that preference through the prefers-reduced-motion setting. Honor it with a short media query that stills decorative animation for those visitors: @media (prefers-reduced-motion: reduce) { .animated { animation: none; } } — your content loses nothing and your site stops hurting people. Beyond accessibility lies taste: motion should explain (this came from there, this is loading, this responded to you) rather than decorate for its own sake. An interface where everything that moves has a reason feels calm and expensive; the generator gives you the mechanics, and the reason is your design judgment.

Frequently asked questions

What are CSS keyframes?

Keyframes are the named script of an animation: a @keyframes rule lists the styles an element should pass through, from a starting state (from, or 0%) to an ending state (to, or 100%), with any number of stops in between. The browser interpolates every frame in between automatically, which is why two keyframes are enough for a smooth fade.

How do I use the generated animation in my CSS?

Copy the whole block — the @keyframes rule and the .animated class — into your stylesheet, then add class="animated" to the element you want to move. Rename the class to anything you like as long as it matches in both places. The animation starts when the page loads, or when the class is added by JavaScript.

What do duration, delay and iterations mean?

Duration is how long one run of the animation takes, in seconds. Delay is the pause before the first run starts. Iterations is how many times the animation repeats — a number, or infinite for a loop that never stops, which suits loading spinners and gentle pulses but should be used sparingly elsewhere.

What is a timing function (easing)?

Easing controls how speed changes during the animation. Linear moves at a constant rate — right for rotations, robotic for entrances. Ease starts fast and settles gently; ease-in starts slow like something heavy getting moving; ease-out decelerates into place; ease-in-out does both. Real objects ease, which is why eased animations feel physical.

What does the fill mode 'both' do?

Fill mode decides what style applies outside the animation's running time. With both, the element holds the first keyframe during the delay (so a fade-in does not flash visible before starting) and keeps the last keyframe after finishing (so it does not snap back). For entrance animations it is almost always what you want.

Why should animations use transform and opacity?

Browsers can move an element with transform and fade it with opacity on the graphics hardware, without re-laying-out the page — so those two properties animate at a smooth 60 frames per second even on modest phones. Animating width, height, top or margins forces layout work every frame and is the usual cause of janky animation. Every preset in this generator animates only transform and opacity.

How do I restart an animation?

Remove the animation, force the browser to notice, and re-apply it — in practice: set the element's animation to none, read a layout property such as offsetWidth, then restore the animation. The Replay button on this page does exactly that to the preview box, and the same three lines work in your own code.

Are CSS animations accessible?

They can be, if you respect the prefers-reduced-motion media query: many users with vestibular disorders find movement genuinely distressing, and their systems can ask your site to calm down. Add a short media query that shortens or disables decorative animations for those users — it is a few lines and this generator's output drops into it unchanged.

Is anything I create uploaded or tracked?

No. The preview and the CSS are generated by JavaScript in your own browser. Settings you choose are never sent to a server or stored anywhere — closing the tab clears everything.

Related tools