Timing Functions: Easing Keywords, cubic-bezier(), steps() and linear()
How motion speeds up and slows down: what a timing function maps, the ease keywords and their cubic-bezier() equivalents, overshoot with y values beyond 0 to 1, steps() and its jump terms, linear() for bounces, and choosing easing and duration.
kvi5hnuCode Sprout team member7 min readOn this page
A transition or animation has a duration, but the value doesn't have to change at a steady rate. A timing function, also called an easing function, maps how far through the time you are to how far through the change the value should be. It's what makes motion feel natural: real objects speed up and slow down instead of moving at constant speed.
The same functions are used by transition-timing-function, animation-timing-function (article 109) and the Web Animations API's easing option.

The keywords
| Keyword | Equivalent | Feel |
|---|---|---|
ease (default) | cubic-bezier(0.25, 0.1, 0.25, 1) | quick start, long gentle finish |
ease-in | cubic-bezier(0.42, 0, 1, 1) | starts slowly, ends abruptly |
ease-out | cubic-bezier(0, 0, 0.58, 1) | starts quickly, settles gently |
ease-in-out | cubic-bezier(0.42, 0, 0.58, 1) | slow at both ends |
linear | linear(0, 1) | constant speed |
Tested in Chrome, animating a width from 0 to 100px over 1s, the values at 250ms, 500ms and 750ms were:
ease: 40.8, 80.2 and 96px, so it's 80% done at half time.ease-in: 9.3, 31.5 and 62.2px.ease-out: 37.8, 68.5 and 90.6px.ease-in-out: 12.9, 50 and 87.1px.linear: 25, 50 and 75px.
cubic-bezier()
cubic-bezier(x1, y1, x2, y2) defines a curve from (0, 0) to (1, 1) using two control points. x is time and y is progress:
- x values must be between 0 and 1, because time can't go backward. Tested in Chrome,
cubic-bezier(1.5, 0, 0, 1)was invalid, and the property kept its default,ease. - y values can go outside 0 to 1, which makes the value overshoot its target and come back, or dip below its start first. Tested in Chrome: with
cubic-bezier(0.3, 1.6, 0.6, 1)from 0 to 100px, the value was 110.8px at the halfway point, then settled at 100px.
.pop { transition: scale 0.4s cubic-bezier(0.3, 1.6, 0.6, 1); } /* overshoots, then settles */
.sheet { transition: translate 0.3s cubic-bezier(0.2, 0, 0, 1); } /* a fast, smooth "emphasized" ease-out */
.anticipate { transition: translate 0.5s cubic-bezier(0.5, -0.4, 0.5, 1); } /* pulls back before moving */
Overshoot is only visible for properties that can go beyond their end values. Colors and opacity are clamped to their valid range, so an overshoot just holds at the end value.
Browser developer tools include a curve editor for cubic-bezier(): click the curve icon next to a timing function in the Styles panel.
steps()
steps(n, <jump>) moves in n equal jumps instead of smoothly. It's used for sprite-sheet animation, typewriter effects and clock hands. The jump term says where the jumps happen:
| Value | Tested values at 0, 25, 50, 75 and 100% of 1s, from 0 to 100px |
|---|---|
steps(4) or steps(4, jump-end), end | 0, 25, 50, 75, then 100 at the very end |
steps(4, jump-start), start | 25, 50, 75, 100, 100: jumps at the beginning of each step |
steps(4, jump-none) | 0, 33.3, 66.7, 100, 100: four values including both ends |
steps(4, jump-both) | 20, 40, 60, 80, then 100: five jumps |
step-start means steps(1, jump-start) and jumps to the end value immediately. Tested in Chrome, its computed value was steps(1, start). step-end means steps(1, jump-end) and holds the start value until the end.
For a sprite sheet with 8 frames, use steps(8) and animate background-position across the sheet's full width, so each step shows the next frame and the last one is never a blank.
linear()
linear() takes a list of output values, optionally with time positions, and joins them with straight lines. With enough points, it approximates any curve, including bounces and springs that cubic-bezier() can't express:
.ball { animation: drop 1s linear(0, 1 36%, 0.75 55%, 1 73%, 0.93 86%, 1) both; }
.slow-middle { transition: translate 1s linear(0, 0.25 75%, 1); }
- Values without a position are spread evenly between their neighbors. Tested in Chrome,
linear(0, 0.25 75%, 1)computed tolinear(0 0%, 0.25 75%, 1 100%), and was at 25% progress after 750ms of a 1s animation. - The bounce above, tested in Chrome on a 100px movement, reached 100px at 36%, came back to 75px at 55%, reached 100px again at 73%, dipped to 93px at 86%, and ended at 100px.
Tools like the "linear() easing generator" turn a spring or bounce formula into a linear() list. Around 20 to 40 points give a smooth result.
linear() works in all browsers, since Safari 17.2 and Firefox 112.

Read the spacing, not the curve: wide gaps mean fast motion, bunched dots mean slow. The two steps() rows differ only in when the first jump happens.
Choosing easing and duration
- Entering elements:
ease-outor a stronger custom ease-out. They arrive fast and settle, which feels responsive. - Leaving elements:
ease-in. They start slowly and accelerate away, which reads as "going". - Moving on screen:
ease-in-out, or a custom curve likecubic-bezier(0.2, 0, 0, 1). - Colors, opacity and progress bars:
linearorease. - Durations: 100 to 200ms for small changes like buttons and toggles, 200 to 400ms for panels and dialogs, rarely more than 500ms for interface motion. Longer motion feels slow and blocks users.
- Larger distances need slightly longer durations, so the speed doesn't feel violent.
- Use a few custom properties so the whole interface shares the same motion style:
:root {
--ease-out: cubic-bezier(0.2, 0, 0, 1);
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--dur-fast: 150ms;
--dur-medium: 300ms;
}
.dialog { transition: opacity var(--dur-medium) var(--ease-out), translate var(--dur-medium) var(--ease-out); }
When a transition reverses, it uses the timing function of the new state's transition, applied to the new direction. It isn't mirrored, so an ease-out going forward is also ease-out going back unless you change it.
body { font: 0.75rem system-ui, sans-serif; margin: 1rem; }
button { font: inherit; padding: 0.3rem 0.9rem; margin-block-end: 0.4rem; }
.lane {
display: grid; grid-template-columns: 5.5rem 1fr; align-items: center;
block-size: 1.7rem; border-block-end: 1px dashed #d8cfc0;
}
.lane i {
inline-size: 1.1rem; block-size: 1.1rem; border-radius: 50%; background: #8a3b12;
translate: 0 0;
transition: translate 1.2s var(--e);
}
.run .lane i { translate: calc(100cqi - 5.5rem - 1.1rem) 0; } /* lane width minus the label column and the ball */
.lane { container-type: inline-size; }
.lane span { font-family: ui-monospace, monospace; }
@media (prefers-reduced-motion: reduce) { .lane i { transition-duration: 0.01s; } }
Every ball takes 1.2s, but they spread out along the way: ease-out leads early, ease-in catches up at the end, the overshoot ball passes the end and comes back, and the steps ball jumps. Press Run again to send them back, with the same curves.
What's current
cubic-bezier(),steps()with all jump terms, and the keywords: all browsers.linear()with stops: all browsers.
Common questions
Why is my cubic-bezier() ignored?
An x value is outside 0 to 1, which makes it invalid.
How do I make a bounce?
With linear() and a list of points, or with keyframes. cubic-bezier() can overshoot once but can't bounce.
What's the difference between steps(4) and steps(4, jump-none)?
steps(4) shows 0, 25, 50 and 75% and reaches 100% only at the end; jump-none shows 0, 33, 67 and 100%, holding each for a quarter of the time.
Which easing should I use by default?
ease-out, or a custom ease-out, for most interface motion.
Summary
- A timing function maps time progress to value progress.
easeis the default;ease-outsuits entering elements,ease-inleaving ones.cubic-bezier()x values must be 0 to 1; y values outside that range overshoot.steps(n, jump)moves in jumps;linear()joins points, making bounces and springs possible.- Keep interface durations short, around 150 to 400ms, and share them through custom properties.
Practice questions
Write a transition where a toast slides in with a slight overshoot over 0.4s.
Answer
.toast { translate: 0 120%; transition: translate 0.4s cubic-bezier(0.3, 1.4, 0.6, 1); }
.toast.show { translate: 0 0; }
A y1 above 1 makes the toast pass its final position and settle back.
Is cubic-bezier(0.2, -0.5, 1.2, 1) valid?
Answer
No. y values may be negative, but x2 = 1.2 is outside 0 to 1, so the whole value is invalid.
A sprite sheet has 6 frames side by side, each 64px wide. Write the animation.
Answer
.sprite {
inline-size: 64px; block-size: 64px;
background: url(walk.png) 0 0 / 384px 64px;
animation: walk 0.6s steps(6) infinite;
}
@keyframes walk { to { background-position: -384px 0; } }
steps(6) with the default jump-end shows frames 0 to 5, then the loop restarts before the empty position at -384px is ever shown.
Which timing function holds the start value for the whole duration, then jumps to the end value?
Answer
step-end, the same as steps(1, jump-end).
Previous: Transitions: Animating Between States With transition
Next: Transitioning the Hard Cases: display, Height auto, @starting-style and allow-discrete

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.