Home › Guides › Web Design › Easing functions in UI animation

Easing functions in UI animation

What cubic-bezier easing curves do, how ease, ease-in and ease-out differ in numbers, and how to choose one for a real interface.

By the tools4free.dev team · Last reviewed 4 December 2026

An easing function controls how fast an animation moves at each moment, without changing how long it lasts. In CSS, ease-out starts fast and slows to a stop, ease-in starts slowly and speeds up, ease-in-out does both, and linear moves at a constant rate. For most things that appear or move in response to a click, ease-out or a custom curve close to it feels most natural. This guide shows what those curves do in actual numbers and how to build your own.

What an easing curve is

Picture a graph. The horizontal axis is time from 0 (start) to 1 (end of the duration). The vertical axis is progress from 0 (start position) to 1 (final position). A straight diagonal is linear: after 25% of the time you are 25% of the way there. A curve that rises steeply at first and then flattens means the object moves quickly and then settles, which is what we see when something decelerates to a stop.

CSS describes the curve with a cubic Bezier from (0, 0) to (1, 1) and two control points, written cubic-bezier(x1, y1, x2, y2). The control points pull the curve towards them. The first point mostly shapes the start of the motion and the second shapes the end.

The built-in keywords in numbers

Each keyword is shorthand for a fixed curve. We calculated the progress at several moments with the same routine our easing generator uses.

KeywordEquivalentAt 10% of timeAt 25%At 50%At 75%At 90%
linearcubic-bezier(0, 0, 1, 1)0.1000.2500.5000.7500.900
easecubic-bezier(0.25, 0.1, 0.25, 1)0.0950.4090.8020.9600.994
ease-incubic-bezier(0.42, 0, 1, 1)0.0170.0930.3150.6220.839
ease-outcubic-bezier(0, 0, 0.58, 1)0.1610.3780.6850.9070.983
ease-in-outcubic-bezier(0.42, 0, 0.58, 1)0.0200.1290.5000.8710.980

Reading the table: ease-in is only 31.5% of the way after half the time, so it spends the first half barely moving and rushes at the end. ease-out is 68.5% of the way after half the time, so most of the movement is done early. ease, the default for transitions, is even more front-loaded at the midpoint (80.2%), then trails off.

What that means in pixels

Take a panel that slides 200px in 300ms. At 75ms, a quarter of the way through the time, it has moved 50px with linear, about 18.6px with ease-in (0.093 x 200) and about 75.6px with ease-out (0.378 x 200). On screen, the ease-out panel appears to respond almost at once, because the first frames already show a visible movement. The ease-in panel looks like it hesitates before it starts.

Which curve for which job

These are widely used design conventions, not part of any specification. Test them in your own interface.

Writing your own curve

Two rules come from the specification. The x values (the first and third numbers) must be between 0 and 1, because time cannot run backwards. The y values can be anything, which allows overshoot. A common smooth deceleration is:

transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);

This curve, cubic-bezier(0.4, 0, 0.2, 1), has a gentle start and a long, soft landing. We calculated it at 25%, 50% and 75% of the time: 0.237, 0.776 and 0.959. It is more decisive than the ease-in-out keyword, because the start is slightly quicker and the end much longer.

Overshoot and bounce

If y2 is above 1, the curve goes past the target and comes back. Take cubic-bezier(0.34, 1.56, 0.64, 1). At 40% of the time it is at 1.030, so it has already passed the end position. It peaks at about 1.098 near 57% of the time and finishes at exactly 1.0. On a 200px move, that is a visible overshoot of about 19.6px before settling. It adds energy to a button or a badge, but it will look wrong on something large or serious, and it exaggerates any layout shift.

The generator and the CSS reject x values outside 0 to 1. For example, cubic-bezier(1.2, 0, 0.5, 1) is invalid, and the whole declaration is ignored by the browser.

Duration matters as much as the curve

A perfect curve on the wrong duration still feels off. As a rule of thumb, small changes such as hover states and toggles work in roughly 100 to 200ms, and larger movements such as panels and dialogs in roughly 200 to 400ms. Longer than that and the interface starts to feel slow, particularly if the animation happens on every interaction. These are guidelines drawn from common practice. If someone has to wait for an animation before they can do the next thing, it is too long.

Other timing functions

steps(n) jumps between n equal stages with no in-between frames, which suits sprite-sheet animation and typewriter effects. The linear() function lets you list many points to draw a curve that a single Bezier cannot, such as a bounce with several rebounds. Both are described alongside cubic-bezier() in the CSS easing specification.

Reduced motion

Some people are made unwell by large movement on screen. The prefers-reduced-motion media query reports their operating-system setting, and you can respond by removing large movements, parallax and bounces, keeping at most a quick fade. WCAG 2.2 includes a criterion about animation from interactions (2.3.3, Level AAA), so it is a good habit even if you only aim for AA.

@media (prefers-reduced-motion: reduce) {
  .panel { transition: opacity 150ms linear; }
}

Common mistakes

Try it: drag the control points in the easing generator to see the curve, compare it with the presets and copy the cubic-bezier() value.

Frequently asked questions

What is the default easing for a CSS transition?

The default is ease, which is cubic-bezier(0.25, 0.1, 0.25, 1).

Does the curve change how long an animation takes?

No. The duration is set separately. The curve only changes how progress is spread over that time.

Why can y go outside 0 to 1 but not x?

The x axis is time, and time must keep moving forward. The y axis is progress, and moving past the target (or before the start) is a valid effect.

Is linear ever the right choice?

Yes, for constant motion such as spinners, marquees and progress fills. It looks mechanical for movements that represent physical objects.

Sources