CSS transition-timing-function Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Animation & Motion

What You’ll Learn

The transition-timing-function property controls the speed curve of a transition — whether motion starts gently, ends softly, or moves at a constant rate.

01

Easing

Speed over time.

02

ease

Default curve.

03

linear

Constant speed.

04

ease-in/out

Entry & exit.

05

cubic-bezier

Custom curves.

06

steps

Stepped motion.

Introduction

The transition-timing-function property in CSS defines how intermediate values for CSS properties being affected by a transition are calculated. This property allows you to control the speed of the transition, making it start slowly, speed up, or slow down at different points during the transition. It is essential for creating smooth and natural animations on your web pages.

Definition and Usage

Set transition-timing-function on the base element state alongside transition-property and transition-duration. The timing function applies to both the forward transition (e.g., hover in) and the reverse (hover out).

💡
Beginner Tip

ease-out feels natural for elements entering the screen; ease-in works well for elements leaving. ease-in-out is a safe default for color and size changes.

📝 Syntax

The syntax for the transition-timing-function property is as follows:

syntax.css
element {
  transition-timing-function: timing-function;
}

Here, timing-function can be one of several predefined keywords, a cubic-bezier() function, or the steps() function.

Basic Example

timing-function.css
div {
  transition: background-color 2s;
  transition-timing-function: ease-in-out;
}

div:hover {
  background-color: green;
}

Syntax Rules

  • Keyword values: ease, linear, ease-in, ease-out, ease-in-out.
  • Custom curves use cubic-bezier(x1, y1, x2, y2) with x values between 0 and 1.
  • Stepped motion uses steps(n, start|end).
  • Default is ease when omitted from shorthand.
  • The property is not inherited.

Related Properties

  • transition — shorthand including timing function
  • transition-duration — how long the transition runs
  • transition-property — which properties animate
  • animation-timing-function — easing for @keyframes animations

🎯 Default Value

The default value of the transition-timing-function property is ease, which starts the transition slowly, speeds it up in the middle, and slows it down again before completion.

⚡ Quick Reference

QuestionAnswer
Default valueease
Constant speedtransition-timing-function: linear;
Smooth in and outtransition-timing-function: ease-in-out;
UI enter effectease-out
Custom bouncecubic-bezier(0.34, 1.56, 0.64, 1)
InheritedNo

💎 Property Values

The transition-timing-function property accepts keywords and function values.

ValueExampleDescription
easeeaseStarts slow, speeds up, then slows down (default).
linearlinearConstant speed from start to finish.
ease-inease-inStarts slow, then speeds up.
ease-outease-outStarts fast, then slows down.
ease-in-outease-in-outStarts slow, speeds up, then slows down.
cubic-bezier(n,n,n,n)cubic-bezier(0.4, 0, 0.2, 1)Defines a cubic Bezier curve. The x values range from 0 to 1.
steps(int,start/end)steps(4, end)Divides the transition into equal steps. The integer specifies the number of steps.
ease linear ease-in ease-out ease-in-out

When to Use transition-timing-function

Pick a timing function based on how the motion should feel:

  • General UI transitionsease or ease-in-out for colors and subtle hover effects.
  • Elements appearingease-out for menus, tooltips, and panels sliding in.
  • Elements disappearingease-in for exits that accelerate away.
  • Mechanical motionlinear for progress bars and loaders.
  • Playful effects — Custom cubic-bezier with y values above 1 for slight bounce.

👀 Live Preview

Hover the box below — the color change uses ease-in-out over 1.2 seconds:

transition-timing-function: ease-in-out

Notice the gentle start and finish compared to linear.

Examples Gallery

In this example, we’ll change the background color of a div element with a smooth transition using the ease-in-out timing function.

📜 Core Patterns

Start with keyword timing functions, then compare how each curve feels.

Example 1 — ease-in-out color transition

In this example, we’ll change the background color of a div element with a smooth transition using the ease-in-out timing function.

index.html
<style>
  div {
    width: 100px;
    height: 100px;
    background-color: blue;
    transition: background-color 2s;
    transition-timing-function: ease-in-out;
  }
  div:hover {
    background-color: green;
  }
</style>

<div></div>
Try It Yourself

How It Works

ease-in-out accelerates through the middle of the 2-second transition and decelerates at both ends for a balanced feel.

Example 2 — Compare timing functions

Hover each row to see how ease, linear, ease-in, ease-out, and ease-in-out differ.

compare.css
.ease .bar { transition-timing-function: ease; }
.linear .bar { transition-timing-function: linear; }
.ease-in .bar { transition-timing-function: ease-in; }
.ease-out .bar { transition-timing-function: ease-out; }
.ease-in-out .bar { transition-timing-function: ease-in-out; }
Try It Yourself

How It Works

Same duration and property, different curves — the bar reaches the end at the same time but moves differently along the way.

📄 UI Patterns

Apply ease-out for reveals and cubic-bezier for custom motion personality.

Example 3 — ease-out panel reveal

Use ease-out when content slides or fades into view — fast start, gentle landing.

ease-out.css
.panel {
  opacity: 0;
  transition: opacity 0.45s ease-out;
}

.wrap:hover .panel {
  opacity: 1;
}
Try It Yourself

How It Works

ease-out decelerates toward the end, which feels natural for content appearing on screen.

Example 4 — Custom cubic-bezier bounce

Go beyond keywords with a custom curve that slightly overshoots for a playful scale effect.

bezier.css
.badge {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge:hover {
  transform: scale(1.15);
}
Try It Yourself

How It Works

When y values in cubic-bezier exceed 1, the curve overshoots briefly, creating a subtle bounce before settling.

♿ Accessibility

  • Reduced motion — Use linear or disable transitions when prefers-reduced-motion: reduce is set.
  • Avoid excessive bounce — Strong cubic-bezier overshoot can distract or disorient users.
  • Do not rely on motion alone — State changes should be clear without animation.
  • Focus parity — Apply the same timing functions on :focus-visible as on hover.

timing-function in the shorthand

The third value in transition: property duration timing-function delay is the timing function. If omitted, it defaults to ease.

shorthand-timing.css
/* Longhand */
.btn {
  transition-property: transform;
  transition-duration: 0.3s;
  transition-timing-function: ease-out;
}

/* Shorthand equivalent */
.btn {
  transition: transform 0.3s ease-out;
}

🧠 How transition-timing-function Works

1

Timing function is set

Choose a keyword, cubic-bezier(), or steps().

Setup
2

Transition starts

A property value changes and the duration timer begins.

Trigger
3

Curve maps progress

The timing function controls how fast values change at each moment.

Easing
=

Natural-feeling motion

The animation follows the chosen speed curve from start to finish.

Browser Compatibility

The transition-timing-function property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is also supported in Internet Explorer 10 and later. As always, it is recommended to test your website across different browsers to ensure full compatibility.

Modern browsers · Widely supported

Easing curves everywhere

Keywords, cubic-bezier(), and steps() work in current Chrome, Firefox, Safari, Edge, and Opera.

98% Browser support
Google Chrome 26+ · Desktop & Mobile
Full support
Mozilla Firefox 16+ · Desktop & Mobile
Full support
Apple Safari 6.1+ · macOS & iOS
Full support
Microsoft Edge 12+ · All versions
Full support
Opera 12.1+ · All versions
Full support

Testing tip

Custom cubic-bezier curves render consistently in modern browsers. Test bounce effects on mobile to ensure they feel appropriate, not jarring.

transition-timing-function property 98% supported

Bottom line: transition-timing-function is reliable for easing in all modern browsers.

Conclusion

The transition-timing-function property is a vital tool for creating smooth and natural animations on your web pages.

By understanding and utilizing this property, you can enhance the user experience with subtle and effective transitions. Experiment with different timing functions to see how they can improve the look and feel of your web projects.

💡 Best Practices

✅ Do

  • Use ease-out for elements entering the viewport
  • Use linear for progress bars and loaders
  • Try ease-in-out for balanced color and opacity fades
  • Experiment with cubic-bezier for brand-specific motion
  • Respect prefers-reduced-motion: reduce

❌ Don’t

  • Use heavy bounce curves on large page sections
  • Assume all transitions feel the same with default ease
  • Overuse steps() unless you want deliberate stepped motion
  • Forget that timing function affects both hover-in and hover-out

Key Takeaways

Knowledge Unlocked

Five things to remember about transition-timing-function

Use these points when choosing easing curves.

5
Core concepts
🕐 02

ease

Default value.

Default
03

linear

Constant speed.

Keyword
📚 04

ease-out

UI reveals.

Pattern
🎯 05

bezier

Custom curves.

Advanced

❓ Frequently Asked Questions

transition-timing-function controls the speed curve of a CSS transition — how fast the animation moves at the start, middle, and end.
The default is ease, which starts slow, speeds up in the middle, and slows down before finishing.
ease varies speed during the transition for a natural feel. linear moves at constant speed from start to finish.
cubic-bezier(x1, y1, x2, y2) defines a custom easing curve. Values x1 and x2 are 0–1; y1 and y2 can exceed 1 for bounce effects.
No, transition-timing-function is not inherited. Set it on each element that needs a specific easing curve.

Practice in the Live Editor

Open the HTML editor and compare easing curves on hover transitions.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful