CSS Easing Explained: Cubic-Bezier Curves, Durations and Natural Motion
Two animations can move an element the same distance in the same time and still feel completely different. One feels mechanical and cheap; the other feels smooth and natural. The difference is easing: how speed changes over the course of the animation. In CSS, easing is controlled by timing functions, and the most flexible of them is cubic-bezier().
Why linear motion looks wrong
Nothing in the physical world starts and stops instantly. A car accelerates, cruises, then brakes. A ball thrown upward slows as it rises. When an interface element moves at constant speed (linear timing) and then stops dead, our brains read it as artificial. Easing adds acceleration and deceleration, making motion feel like it has mass.
Reading an easing curve
An easing curve is a graph:
- The horizontal axis is time, from start (0) to end (1).
- The vertical axis is progress, from the starting position (0) to the end position (1).
A steep part of the curve means fast movement; a flat part means slow movement. A straight diagonal line is linear. A curve that rises quickly and then flattens means a fast start and a gentle stop.
How cubic-bezier() works
cubic-bezier(x1, y1, x2, y2) defines a curve that always starts at (0, 0) and ends at (1, 1). The four numbers are the coordinates of two control points that pull the curve toward them, just like the handles on a pen tool path in Figma or Illustrator.
- The x values (time) must stay between 0 and 1.
- The y values (progress) can go below 0 or above 1. That makes the element overshoot its target and come back, or pull back slightly before moving.
The best way to understand this is to drag the handles and watch the effect, which is exactly what the cubic bezier generator above lets you do, with a live comparison against linear motion.
The built-in keywords
| Keyword | cubic-bezier equivalent | Character |
|---|---|---|
linear | cubic-bezier(0, 0, 1, 1) | Constant speed |
ease (default) | cubic-bezier(0.25, 0.1, 0.25, 1) | Quick start, long gentle stop |
ease-in | cubic-bezier(0.42, 0, 1, 1) | Slow start, abrupt stop |
ease-out | cubic-bezier(0, 0, 0.58, 1) | Fast start, gentle stop |
ease-in-out | cubic-bezier(0.42, 0, 0.58, 1) | Slow start and stop |
The keywords are fine defaults but fairly mild. Custom curves with stronger acceleration, such as “expo” or “quint” style curves, feel more modern and responsive.
Which easing for which movement
A widely used rule of thumb, found in Material Design and many other motion guidelines:
| Movement | Recommended easing | Why |
|---|---|---|
| Element enters the screen | Ease-out (decelerate) | It arrives quickly and settles, so users see it fast |
| Element leaves the screen | Ease-in (accelerate) | It gathers speed as it goes, like leaving the room |
| Element moves within the screen | Ease-in-out | It starts and stops on screen, so both ends need softness |
| Hover and color changes | Ease-out or ease, short | Immediate response with a soft finish |
| Playful confirmation (badge pop, like) | Back / overshoot curve | Slight bounce adds personality |
Ease-in on its own is rarely right for entering elements: it makes the interface feel sluggish, because the most visible part of the motion happens slowly at the start.
Duration matters as much as easing
Even perfect easing feels wrong at the wrong speed. Common guidance:
- 100–200ms: hover effects, button presses, small state changes.
- 200–300ms: dropdowns, tooltips, small panels.
- 300–500ms: modals, page-level transitions, large movements.
- Over 500ms: rarely appropriate for UI; feels slow on repeated use.
Larger elements and longer distances need slightly longer durations. Exit animations can be a bit faster than entrances, because users are already done with the element. On mobile, keep things on the shorter side.
Overshoot and bounce
A y value above 1 produces overshoot, for example cubic-bezier(0.34, 1.56, 0.64, 1), often called “ease-out-back”. The element passes its target and settles back. It adds personality to small confirmations, like adding an item to a cart. Use it sparingly: on every dropdown and modal it becomes tiring. Note that a single cubic-bezier can only overshoot once; for real multi-bounce effects you need keyframes or the newer linear() easing function.
The linear() function
CSS now has a linear() timing function that accepts a list of points, letting you approximate any curve, including springs and bounces, with straight segments. It is supported in all major browsers since late 2023. Tools generate these long point lists from spring physics. For everyday transitions, cubic-bezier() remains simpler and easier to read.
Respect reduced motion
Some people experience dizziness or nausea from motion, especially large movements, parallax and zooming. Operating systems offer a “reduce motion” setting, and CSS exposes it:
@media (prefers-reduced-motion: reduce) {
* { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}A gentler approach keeps fades and color changes but removes movement and scaling. WCAG 2.3.3 (Animation from Interactions, level AAA) recommends letting users disable non-essential motion triggered by interaction.
Easing in transitions versus animations
- In a transition, the timing function applies to the whole change from one state to another.
- In a keyframe animation, the timing function applies to each segment between keyframes, not the animation as a whole. That surprises many developers: an animation with five keyframes and
easewill slow down and speed up five times.
Easing is free; the property you animate isn’t
Easing doesn’t affect performance; the properties you animate do. Animate transform and opacity wherever possible, because browsers can handle them on the compositor without recalculating layout. Our CSS transforms guide explains why.