The animation-duration property sets how long one full cycle of a CSS animation takes. Shorter durations feel snappy; longer durations feel smooth and relaxed.
01
Animation Speed
Control how long motion lasts.
02
Syntax
Use s or ms time values.
03
Default 0s
No visible animation without duration.
04
Seconds
2s, 3s, 0.8s and more.
05
Milliseconds
500ms, 800ms for fine control.
06
Shorthand
Works inside animation too.
Fundamentals
Definition and Usage
The animation-duration CSS property defines the length of time it takes to complete one animation cycle. It does not control when the animation starts — that is handled by animation-delay — but how fast the keyframes play from start to finish.
Use shorter durations for buttons, toggles, and micro-interactions. Use longer durations for hero fades, background color transitions, and decorative motion that should feel calm.
💡
Beginner Tip
If your animation does not appear to run, check that animation-duration is greater than 0s and that you also set animation-name or use the animation shorthand.
In animation: riseUp 1.2s ease-out both, the 1.2s value is the animation duration.
🧠 How animation-duration Works
1
You define keyframes
Create a start state and end state with @keyframes.
Keyframes
2
You set a duration
Choose how many seconds or milliseconds one full cycle should take.
Time value
3
The browser spreads keyframes over that time
A longer duration makes the same motion slower; a shorter duration makes it faster.
Playback speed
=
⏱️
Controlled pacing
Duration lets you match animation speed to the mood and purpose of your UI.
Compatibility
Universal Browser Support
animation-duration is supported in all modern browsers alongside CSS animations.
✓ Baseline · CSS Animations
Set animation speed in modern browsers
Chrome, Firefox, Safari, Edge, and Opera all support animation-duration with s and ms values.
98%Modern browser support
Google Chrome43+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera30+ · Modern versions
Full support
Legacy browsers
Very old browsers without CSS animation support also lack animation-duration.
💻
Internet ExplorerIE 9 and earlier · No CSS animation support
None
animation-duration property98% supported
Bottom line: Use animation-duration confidently in modern projects. Keep UI animations short for better usability.
Wrap Up
Conclusion
The animation-duration property controls how long one animation cycle takes to complete. It is one of the most important settings for making motion feel fast, smooth, or relaxed.
Start with values like 0.5s for quick UI feedback and 2s to 3s for larger visual effects, then adjust until the pacing feels right.