CSS ease-in-out: slow, fast, slow
An easing function says how fast an animation or transition goes at each moment. ease-in-out starts slowly, speeds up in the middle and slows down again at the end, like a car that accelerates and brakes smoothly. In CSS it is a keyword that stands for the cubic Bezier curve cubic-bezier(0.42, 0, 0.58, 1): two control points, (0.42, 0) and (0.58, 1), shape the curve from (0, 0) to (1, 1). The cubic-bezier generator opens here on this curve so you can drag the points and copy your own.
The five keywords, compared
Progress of the animation (0% to 100% of the way) at 25, 50 and 75% of the time, computed by solving each Bezier curve:
| Keyword | cubic-bezier | 25% | 50% | 75% |
|---|---|---|---|---|
| ease | cubic-bezier(0.25, 0.1, 0.25, 1) | 40.9% | 80.2% | 96% |
| ease-in | cubic-bezier(0.42, 0, 1, 1) | 9.3% | 31.5% | 62.2% |
| ease-out | cubic-bezier(0, 0, 0.58, 1) | 37.8% | 68.5% | 90.7% |
| ease-in-out | cubic-bezier(0.42, 0, 0.58, 1) | 12.9% | 50% | 87.1% |
| linear | cubic-bezier(0, 0, 1, 1) | 25% | 50% | 75% |
ease-in-out is symmetric: at half the time it is exactly half the way, and it is at 12.92% at 25% of the time but 87.08% at 75%, a mirror image. ease-out covers most of the distance early (it is at 37.81% after a quarter of the time), which feels responsive; ease-in does the opposite.
When to use which
- ease-in-out: things that move from one place to another on screen (a panel sliding, a toggle, a carousel), because they both start and stop in view.
- ease-out: elements that enter the screen or respond to a click; they arrive fast and settle softly.
- ease-in: elements that leave the screen; they start slowly and accelerate out of view.
- linear: constant motion, such as a loading bar or a spinner, where acceleration would look wrong.
More curves: the easings.net set
The generator also has the classic curves of easings.net, in the same cubic-bezier form (the "Back" ones go past the target and return, so their y goes beyond 0 and 1):
| Name | cubic-bezier |
|---|---|
| easeInSine | cubic-bezier(0.12, 0, 0.39, 0) |
| easeOutSine | cubic-bezier(0.61, 1, 0.88, 1) |
| easeInOutSine | cubic-bezier(0.37, 0, 0.63, 1) |
| easeInQuad | cubic-bezier(0.11, 0, 0.5, 0) |
| easeOutQuad | cubic-bezier(0.5, 1, 0.89, 1) |
| easeInOutQuad | cubic-bezier(0.45, 0, 0.55, 1) |
| easeInCubic | cubic-bezier(0.32, 0, 0.67, 0) |
| easeOutCubic | cubic-bezier(0.33, 1, 0.68, 1) |
| easeInOutCubic | cubic-bezier(0.65, 0, 0.35, 1) |
| easeInBack | cubic-bezier(0.36, 0, 0.66, -0.56) |
| easeOutBack | cubic-bezier(0.34, 1.56, 0.64, 1) |
| easeInOutBack | cubic-bezier(0.68, -0.6, 0.32, 1.6) |
The modern form: linear()
CSS now also accepts linear(), which describes an easing as points that the browser joins with straight lines. It can express curves a cubic Bezier cannot (a bounce, a spring). The generator converts the same curve to it, in 8 steps:
transition-timing-function: linear(0, 0.03, 0.13, 0.29, 0.5, 0.71, 0.87, 0.97, 1);Using it
.panel {
transition: transform 300ms ease-in-out;
}
.panel.custom {
transition: transform 300ms cubic-bezier(0.42, 0, 0.58, 1);
}Common mistakes
- Animating with ease-in-out and a long duration: the slow start makes the interface feel late. Keep UI transitions between 150 and 400 ms.
- Putting the x of a control point outside 0 to 1: CSS rejects the whole cubic-bezier. Only y may go beyond that range.
How to use the generator
- The curve ease-in-out is loaded; drag the two control points or type new values.
- Watch the ball move with the curve and set the duration to feel it.
- Copy cubic-bezier(...), the Tailwind class or the linear() form.
Frequently asked questions
What is the cubic-bezier of ease-in-out?
cubic-bezier(0.42, 0, 0.58, 1). The keyword ease, the default, is a different curve: cubic-bezier(0.25, 0.1, 0.25, 1).
What is the difference between ease and ease-in-out?
ease starts a bit faster and has a long, soft ending; ease-in-out is symmetric, slow at both ends. In the table above compare their progress at 25% of the time.
Can I use these curves in JavaScript animations?
Yes: the Web Animations API (element.animate) and most libraries accept the same cubic-bezier(...) string as the easing option.