How to Create CSS Easing Curves and Animations
Easing curves control how animations accelerate and decelerate. The difference between a cheap-feeling animation and a polished one is almost always the easing β linear motion feels robotic, while a well-chosen curve feels natural and intentional. CSS gives you full control over easing with cubic-bezier().
Built-In Easing Keywords
CSS provides five easing keywords: ease (the default, cubic-bezier(0.25, 0.1, 0.25, 1): a quick rise that is 80% complete at the halfway point, then a long slow finish), linear, ease-in (slow start β suits exits), ease-out (fast start, gentle stop β suits entrances) and ease-in-out (slow at both ends β suits motion between two on-screen positions). There are also step-start, step-end and steps() for frame-by-frame changes, and linear() for curves cubic-bezier cannot draw.
Custom Easing with cubic-bezier()
cubic-bezier() defines a custom easing curve with four control points:
width, height, top or left makes the browser redo layout, and usually paint, on every frame. Googleβs web.dev animation guide recommends keeping animations to transform and opacity where you can, so they stay on the compositing stage; check with the Performance panel in your browserβs dev tools.transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);The four values are x1, y1, x2, y2 β the positions of two control handles on a timing curve. x values must be between 0 and 1; y values can exceed this range for bounce or overshoot effects. The Easing Wizard lets you drag control points visually and see the resulting motion in real time.
Common Custom Curves
Material Design 3 standard: cubic-bezier(0.2, 0, 0, 1). Material 3's own token files call the older cubic-bezier(0.4, 0, 0.2, 1) "legacy" β that is Material 2's "standard" curve, which is slow to start rather than an ease-out. Back (overshoot) in-out: cubic-bezier(0.68, -0.55, 0.27, 1.55) dips about 9% below the start and overshoots the end by about 9% before settling β an overshoot, not a bounce. Snappy entrance: cubic-bezier(0, 0.55, 0.45, 1). Note that cubic-bezier(0.25, 0.1, 0.25, 1), often labeled an "Apple-style spring" online, is simply the CSS ease keyword and has no spring at all.
Worked Example: How Far Along Is Each Curve?
We solved each curve numerically (the CSS Easing definition of cubic-bezier) and read off how much of the movement is done at a quarter, half and three quarters of the duration (script in our test folder, October 13, 2026):
| Curve | 25% of time | 50% | 75% |
|---|---|---|---|
| ease | 41% | 80% | 96% |
| ease-out | 38% | 69% | 91% |
| ease-in-out | 13% | 50% | 87% |
| Material 2 standard (0.4, 0, 0.2, 1) | 24% | 78% | 96% |
| Material 3 standard (0.2, 0, 0, 1) | 61% | 88% | 98% |
| Back in-out (0.68, β0.55, 0.27, 1.55) | β8% | 60% | 109% |
Two practical points. The newer Material 3 curve front-loads the motion (61% done after a quarter of the time), which is why interfaces that adopt it feel faster at the same duration. And curves that finish early, like ease and both Material curves, look complete well before the duration ends, so a 400ms transition with them can often be shortened without looking abrupt.
For a real bounce or spring β several oscillations β cubic-bezier is not enough, because it can only overshoot once in each direction. The linear() function takes a list of points and draws any curve through them; MDN lists it in Chrome 113, Firefox 112 and Safari 17.2. Generators turn spring physics into a linear() list.
Keyframe Animations with Easing
For complex multi-step animations, use @keyframes with animation-timing-function:
@keyframes slideIn {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.element {
animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}The easing applies to the entire animation. For different easing at different stages, set animation-timing-function within individual keyframe blocks.
Animation Performance
Animate only transform and opacity β these properties are GPU-accelerated and don't trigger layout recalculation. Animating width, height, margin, padding, top, or left forces the browser to recalculate layout on every frame, causing jank. If you need to animate size, use transform: scale() instead of width/height. Always respect prefers-reduced-motion by wrapping animations in @media (prefers-reduced-motion: no-preference).
Frequently Asked Questions
What is a CSS easing curve?
What is the best easing for UI animations?
How do I create a bounce animation in CSS?
- [1]W3C CSS Easing Functions Level 1: cubic-bezier(), keywords, steps() β
- [2]W3C CSS Easing Functions Level 2: linear() easing function β
- [3]MDN Browser Compatibility Data: linear() (Chrome 113, Firefox 112, Safari 17.2; checked Oct 13, 2026) β
- [4]Material Web 2.2.0 tokens: md-sys-motion easing (standard 0.2,0,0,1; legacy 0.4,0,0.2,1) β
- [5]MDN Web Docs: prefers-reduced-motion β