The animation-fill-mode property sets how an animation applies styles before and after it plays. By default the element snaps back to its normal CSS when the play is not running.
forwards keeps the last keyframe after the play ends. backwards applies the first keyframe during an animation-delay. both does both. It applies to all elements, including ::before and ::after, and it is not inherited. Fill mode does not remove motion for someone who set prefers-reduced-motion.
Standard-track.
Not deprecated and not experimental. none, forwards, backwards, and both have been widely available since 2015.
With no delay, the first keyframe has no wait to fill. Also, the first keyframe must differ from the element normal style, or the wait looks unchanged.
end
Which keyframe is last depends on direction
With animation-direction: reverse, the last keyframe for forwards is the from side. Direction and iteration count decide which frame stays.
order
The shorthand can wipe the fill
animation: 1s fade sets this property back to none. Write animation-fill-mode after it, or include forwards in the shorthand.
list
One keyword per animation name
animation-fill-mode: forwards, backwards follows the order of animation-name. Fewer keywords than names, and the list repeats.
Compatibility
Browser Support
animation-fill-mode is a browser style property. Node.js, Deno, and Bun do not play it. The versions below include all four keywords.
✓ Baseline · Widely available since 2015
animation-fill-mode
Chrome 43+, Firefox 16+, Safari 9+, Edge 12+, Internet Explorer 10+. none, forwards, backwards, and both share these versions.
97%all four keywords
Google Chrome43+
Full support
Mozilla Firefox16+
Full support
Apple Safari9+
Full support
Microsoft Edge12+
Full support
Opera30+
Full support
Samsung Internet4+
Full support
Internet Explorer10+
Full support
animation-fill-modeWidely supported
Bottom line: Older Chrome, Safari, and Firefox also accepted a prefixed property. The four fill-mode keywords shipped together with CSS animations.
Remember
Key Takeaways
Role: which animation styles stay before and after the play.
none: the initial value. Outside the play, normal CSS wins.
forwards: keep the last keyframe after the play ends.
backwards / both: fill the delay; both also keeps the end.
One line:animation-fill-mode decides whether keyframes stick around outside the active play.
Frequently Asked Questions
It sets which animation styles stay on the element outside the active play. none applies none. forwards keeps the last keyframe after the play ends. backwards applies the first keyframe during a delay. both does both.
The initial value is none. Outside the play, the element uses its normal CSS. After the animation ends, it snaps back unless you set forwards or both.
forwards keeps the last keyframe after the animation finishes. backwards applies the first keyframe as soon as the animation is applied, and keeps it during animation-delay. They cover different times.
Use both when you want the first keyframe during the delay and the last keyframe to remain after the play ends. It is forwards and backwards together.
backwards only changes the look during a delay, and only if the first keyframe differs from the element normal style. With no delay, or with a from that matches the resting style, you will not see it.
Chrome 43+, Firefox 16+, Safari 9+, Edge 12+, and Internet Explorer 10 support all four keywords. It is a browser style property, not a Node.js feature.