The animation-iteration-count property controls how many times a CSS animation repeats. Use it to play an effect once, repeat it a set number of times, or loop forever with infinite.
01
Repeat Control
Set how many cycles run.
02
Syntax
Number or infinite.
03
Default 1
Plays once by default.
04
Finite Loops
Use 2, 3, or more repeats.
05
infinite
Loop without stopping.
06
Shorthand
Works inside animation too.
Fundamentals
Definition and Usage
The animation-iteration-count CSS property defines how many times an animation cycle should play before stopping. One cycle means running through all keyframes from start to end once.
This is useful for loaders that spin forever, attention-grabbing effects that repeat a few times, or entrance animations that should happen only once.
💡
Beginner Tip
Pair animation-iteration-count: infinite with animation-direction: alternate to create smooth back-and-forth looping motion.
Foundation
📝 Syntax
Set animation-iteration-count with a number or the keyword infinite:
In animation: blink 1.2s ease-in-out infinite, the final keyword sets the iteration count to loop forever.
🧠 How animation-iteration-count Works
1
You define an animation cycle
Keyframes plus duration create one complete pass from start to end.
One cycle
2
You set an iteration count
Choose a number like 3 or the keyword infinite.
Repeat rule
3
The browser repeats the cycle
Each iteration runs the full keyframe sequence again until the count is reached.
Playback
=
🔀
Controlled repetition
You decide whether motion happens once, a few times, or continuously.
Compatibility
Universal Browser Support
animation-iteration-count is supported in all modern browsers alongside CSS animations.
✓ Baseline · CSS Animations
Repeat animations reliably in modern browsers
Chrome, Firefox, Safari, Edge, and Opera all support numeric counts and infinite.
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-iteration-count.
💻
Internet ExplorerIE 9 and earlier · No CSS animation support
None
animation-iteration-count property98% supported
Bottom line: Use numeric counts and infinite confidently in modern projects. Avoid unnecessary infinite loops on large pages.
Wrap Up
Conclusion
The animation-iteration-count property lets you control how many times a CSS animation repeats. It is essential for loaders, looping backgrounds, and any effect that should run once or a limited number of times.
Start with the default 1 for entrance animations, use small numbers like 2 or 3 for emphasis, and reserve infinite for ongoing indicators like spinners.