Home › Design › Cubic-Bezier Easing Generator

Cubic-Bezier Easing Generator

Set the four values of a CSS cubic-bezier() curve, pick a preset, and copy the timing function. The curve shows how far a value has moved at each point in time.

Presets

CSS timing function

Loading.

Curve preview

Progress y at three points in time. A time of 0 is the start of the transition and 1 is the end.

Time 0.25: progress-
Time 0.5: progress-
Time 0.75: progress-
This page needs JavaScript. Values are rounded to 4 decimal places in the output.

How to use

  1. Start from a preset if you like. The buttons ease, ease-in, ease-out, ease-in-out and linear fill in the four values.
  2. Adjust x1 and x2. They must stay between 0 and 1.
  3. Adjust y1 and y2. These can be any number, including negative values or values above 1.
  4. Read the cubic-bezier() line under "CSS timing function" and press Copy.
  5. Use "Curve preview" to see how far along the transition is at times 0.25, 0.5 and 0.75.

Paste the result into transition-timing-function, animation-timing-function or the shorthand, for example transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);.

Worked example

You want a button to pop slightly past its end size and settle back. Enter x1 = 0.34, y1 = 1.56, x2 = 0.64, y2 = 1. The page gives cubic-bezier(0.34, 1.56, 0.64, 1). Because y1 is above 1, the curve overshoots. The preview readings, rounded to four places, are:

TimeThis curveease-in-out
0.250.81630.1292
0.51.08740.5
0.751.05960.8708

At halfway the pop curve is already at 1.0874, which is 8.7% past the end value. A progress above 1 is what produces the overshoot. The ease-in-out preset is symmetrical, so it sits exactly at 0.5 at the halfway time.

How it works

A CSS easing is a curve from (0, 0) to (1, 1). The two middle points, (x1, y1) and (x2, y2), bend it. Horizontal axis: time, from the start of the transition (0) to the end (1). Vertical axis: progress, from the start value (0) to the end value (1). The curve is a cubic Bezier, and the exact definition is in the CSS Easing Functions specification. MDN summarises the syntax under easing-function.

x1 and x2 are the horizontal positions of the two control points. They must be between 0 and 1, because time cannot run backwards.

y1 and y2 are the vertical positions. They can be any number. Values below 0 or above 1 make the curve overshoot, which is useful for a bounce or a spring feel.

To find the progress at a given time, the page solves the curve for the point where its horizontal position equals that time, then reads the vertical position at that point. The solution uses bisection and is checked to a tolerance of one part in a billion of the curve parameter. Output values are rounded to four decimal places.

The presets are the CSS keywords written as numbers: ease is (0.25, 0.1, 0.25, 1), ease-in is (0.42, 0, 1, 1), ease-out is (0, 0, 0.58, 1), ease-in-out is (0.42, 0, 0.58, 1) and linear is (0, 0, 1, 1).

Nothing you type is sent anywhere. The curve is worked out in your browser and no request is made with your numbers.

Common mistakes

Frequently asked questions

What do the four numbers mean?

They are the coordinates of the two control points that shape the curve. The start (0, 0) and end (1, 1) are fixed.

Is ease the same as linear?

No. Linear moves at constant speed. Ease starts faster, then slows towards the end.

Why is progress negative at the start of some curves?

A negative y1 pulls the element backwards before it moves forwards, a wind-up effect. It is allowed in CSS.

Can I use this for JavaScript animation?

Yes. The Web Animations API and the animate() method accept the same timing function strings.

What about spring or bounce curves with several bounces?

A single cubic Bezier has one bend at most on each side. For multi-bounce motion, use CSS linear() easing or keyframes.

Related tools