How to Create CSS Animations Online — Free (2026)
By Rui Barreira · Last updated: 18 June 2026
The brevio CSS Animation Generator builds the @keyframes rule and animation properties for any element, with a live preview and one-click copy. Everything runs client-side — no file upload, no account.
CSS Animation Syntax
CSS animations require two things: a @keyframes block that defines what changes, and animation properties on the element that define how it plays.
@keyframes slide-in {
from { transform: translateX(-100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
.element {
animation: slide-in 0.5s ease-out forwards;
}The Eight Animation Properties
| Property | What it controls | Common values |
|---|---|---|
| animation-name | Which @keyframes block to use | fade-in, slide-up, bounce |
| animation-duration | How long one cycle takes | 0.3s, 1s, 2000ms |
| animation-timing-function | Acceleration curve within each cycle | ease, linear, ease-in-out |
| animation-delay | Wait before starting | 0s, 0.2s, 500ms |
| animation-iteration-count | How many times it plays | 1, 3, infinite |
| animation-direction | Play forward, backward, or alternating | normal, reverse, alternate |
| animation-fill-mode | State before/after the animation | none, forwards, backwards, both |
| animation-play-state | Pause or run | running, paused |
How to Create a CSS Animation Step by Step
- Open the CSS Animation Generator.
- Name your animation. Use a descriptive, lowercase, hyphenated name — for example,
fade-in-uporpulse. This name links the@keyframesblock to the element. - Set the duration. Most UI transitions work well between 0.2s and 0.5s. Longer durations (1s+) are better for attention-getting animations like loaders.
- Choose a timing function.
easeis the natural default.ease-outfeels responsive (fast start, gentle finish).linearis good for looping spinners.cubic-bezierallows full custom curves. - Set iteration count. Type
1for a one-shot entrance animation. Typeinfinitefor looping effects like spinners or pulsing indicators. - Choose fill mode. Use
forwardsfor entrance animations so the element stays in its final state after the animation ends.bothcovers both before and after. - Preview the animation. Click Play Preview to see the animation on the demo box with your current settings.
- Copy the CSS. Click Copy CSS to get the full animation class and keyframe block.
Common CSS Animation Patterns
Fade in
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in { animation: fade-in 0.3s ease forwards; }Slide in from bottom
@keyframes slide-up {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.slide-up { animation: slide-up 0.4s ease-out forwards; }Infinite spinner
@keyframes spin {
to { transform: rotate(360deg); }
}
.spinner { animation: spin 1s linear infinite; }Pulse (attention indicator)
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.pulse { animation: pulse 1.5s ease-in-out infinite; }Reducing Motion for Accessibility
Users who have enabled "Reduce Motion" in their OS prefer minimal animations. Wrap your animations in a media query to respect this preference:
@media (prefers-reduced-motion: no-preference) {
.fade-in {
animation: fade-in 0.4s ease forwards;
}
}This applies the animation only when the user has not requested reduced motion. Alternatively, disable or shorten animations in the prefers-reduced-motion: reduce query.
Frequently Asked Questions
What is the difference between CSS transitions and CSS animations?
Transitions animate a property change triggered by a state change (like :hover). They go from A to B once. CSS animations define arbitrary keyframe sequences (@keyframes) that run independently of user interaction, can loop, and can have multiple intermediate steps.
Can I animate any CSS property?
Most properties that take numeric or color values can be animated. Properties that trigger layout (like width, height, top, left) are expensive to animate. For performance, prefer animating transform and opacity, which are composited by the browser on the GPU without triggering layout or paint.
How do I pause and resume a CSS animation with JavaScript?
Toggle the animation-play-state property: element.style.animationPlayState = 'paused' to pause and 'running' to resume. This is the cleanest way to control animations without removing and re-adding CSS classes.
Frequently Asked Questions
- What is a CSS animation fill mode?
- Fill mode controls what styles apply when the animation is not running. "forwards" keeps the final keyframe styles after the animation ends; "backwards" applies the initial keyframe during the delay.
- What does animation-iteration-count: infinite do?
- It makes the animation loop indefinitely. Use it for loaders, pulsing effects, or continuous scrolling banners.
- What is the difference between ease and ease-in-out?
- ease starts fast and ends slow. ease-in-out starts slow, speeds up in the middle, and slows down at the end — generally more natural-looking for UI transitions.