What is a cubic-bezier easing?
An easing tells the browser how fast an animation moves at each moment. linear moves at a constant speed. ease-out starts fast and slows down. cubic-bezier(x1, y1, x2, y2) lets you define any curve in between with four numbers. The curve starts at (0, 0), ends at (1, 1) and is shaped by two control points, which you set with the four numbers. On the horizontal axis is time, on the vertical axis is progress.
This generator draws the curve and lets you edit it directly. Drag the two round handles, or type the four numbers, and a ball moves along a track using your curve, next to a second ball moving in a straight line so the difference is easy to see. You can start from 17 presets: the five CSS keywords plus the classic easings from easings.net (sine, quad, cubic and back, each in, out and in-out).
The result is ready to paste as a transition-timing-function declaration, as a Tailwind class, or as a linear() function that samples the same curve as 16 points. Everything runs in your browser and nothing is uploaded.
How to build an easing curve
- Press a preset in "Starting points", for example "easeInOutCubic". The curve, the four numbers and the code update together.
- Drag the first handle (the one attached to the bottom left corner) and the second handle (attached to the top right corner). You can also focus a handle and use the arrow keys. Shift moves by 0.1 instead of 0.01.
- For exact values, use the sliders "x1 (first handle, time)", "y1 (first handle, progress)", "x2 (second handle, time)" and "y2 (second handle, progress)".
- Already have a curve? Type it into "Paste CSS to edit it". Both
cubic-bezier(...)and a keyword likeease-in-outwork, with or without the property name. An unreadable value shows an error. - Set "Duration of the preview" and press "Play". Tick "Loop back and forth" to watch it repeat.
- Under the curve, choose the "Format": CSS, Tailwind or
linear(). When your curve equals a CSS keyword, the tool tells you. - Copy the result with "Copy CSS".
Examples
The default curve is ease
The starting curve is cubic-bezier(0.25, 0.1, 0.25, 1), which is exactly the keyword ease. Halfway through the time, it has already covered about 80% of the distance, which is why ease feels quick at the start. With the CSS format the output is:
transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);Symmetrical ease-in-out as three formats
cubic-bezier(0.42, 0, 0.58, 1) is ease-in-out: at exactly half the time it has covered exactly half the distance. The same curve in the three formats:
CSS: transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
Tailwind: ease-[cubic-bezier(0.42,0,0.58,1)]
linear(): transition-timing-function: linear(0, 0.008, 0.031, 0.072, 0.129, 0.204, 0.293, 0.393, 0.5, 0.607, 0.707, 0.796, 0.871, 0.928, 0.969, 0.992, 1);The Tailwind class has no spaces, since spaces would split the class name.
An overshoot with "easeOutBack"
cubic-bezier(0.34, 1.56, 0.64, 1) has a y1 above 1, so the element goes past its destination and settles back. In the linear() format the sampled values rise above 1, peaking near 1.1, and end at 1. That is how a button gets a springy pop. The y values can go from -2 to 3 in the sliders, while x always stays between 0 and 1.
Pasting a Material-style curve
Paste transition-timing-function: cubic-bezier(.4, 0, .2, 1); and the tool reads the numbers (a leading dot is fine) and normalizes the code to cubic-bezier(0.4, 0, 0.2, 1). Numbers are rounded to two decimals, so 0.456 becomes 0.46.
Common mistakes
- Using an x outside 0 and 1.
cubic-bezier(1.2, 0, 0.5, 1)is not valid CSS and the browser ignores the whole declaration. Only y can leave the range, and that is what creates an overshoot or a pull back. - Expecting a bounce from a single curve. One Bezier can overshoot once. A ball that bounces several times needs keyframes or a
linear()function with many points. - Applying the easing to the wrong place. In a CSS animation with keyframes,
animation-timing-functionapplies between each pair of keyframes, not to the whole animation. A transition applies it once, to the whole change. - Forgetting that easing hides in the duration. A very slow curve with a short duration looks like a jump. Test with the preview duration set close to the real one.
- Mixing up the two handles. The first handle controls the start of the movement and the second controls the end. To soften only the ending, move only the second.
- Using
linear()in old browsers. The function is newer thancubic-bezier(). Keep acubic-bezier()declaration before it as a fallback.
Frequently asked questions
What do the four numbers mean?
They are the coordinates of two control points: (x1, y1) and (x2, y2). The x values are time and must be between 0 and 1. The y values are progress and may go below 0 or above 1.
Is ease the same as ease-in-out?
No. ease is cubic-bezier(0.25, 0.1, 0.25, 1), with a fast start and a long soft ending. ease-in-out is cubic-bezier(0.42, 0, 0.58, 1), which is slow at both ends and symmetric.
Can I use the curve in an animation?
Yes. The same value works in transition-timing-function and animation-timing-function. Use the CSS animation generator to build the keyframes and paste your curve in "Or your own easing".
How do I use it in React?
Convert the declaration with the CSS to React style converter, which turns it into a style object.