CSS transition-timing-function Property

The CSS transition-timing-function property controls how a transition progresses over time, including whether it accelerates, decelerates, moves at a constant rate, or changes in steps.

Timing functions determine the rate of change during a transition without changing its specified duration. You can use predefined keywords, custom cubic Bézier curves, or step-based functions to create different effects.

transition-timing-function Syntax

The transition-timing-function property accepts an easing keyword, a timing function, or a comma-separated list of timing functions.

Basic Syntax

.example {
  transition-timing-function: ease;
}

Linear Timing

.example {
  transition-timing-function: linear;
}

Ease-In Timing

.example {
  transition-timing-function: ease-in;
}

Ease-Out Timing

.example {
  transition-timing-function: ease-out;
}

Ease-In-Out Timing

.example {
  transition-timing-function: ease-in-out;
}

Custom Cubic Bézier Curve

.example {
  transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

Step-Based Timing

.example {
  transition-timing-function: steps(4, end);
}

Custom Linear Easing

.example {
  transition-timing-function: linear(0, 0.2 25%, 0.8 75%, 1);
}

Multiple Timing Functions

.example {
  transition-timing-function: ease, linear, ease-out;
}

CSS-Wide Keywords

.example {
  transition-timing-function: initial;
}
.example {
  transition-timing-function: inherit;
}
.example {
  transition-timing-function: unset;
}
.example {
  transition-timing-function: revert;
}
.example {
  transition-timing-function: revert-layer;
}

Property Values

Value Description
ease Starts slowly, accelerates, and slows toward the end. This is the initial value.
linear Progresses at a constant rate.
ease-in Starts slowly and accelerates.
ease-out Starts quickly and decelerates.
ease-in-out Accelerates and decelerates more symmetrically.
step-start Jumps immediately to the final progress value.
step-end Holds the starting progress value until the end.
steps() Divides transition progress into discrete steps.
cubic-bezier() Defines a custom easing curve using four control-point coordinates.
linear() Defines a custom piecewise-linear easing function using progress stops.
Comma-separated list Assigns different timing functions to multiple transitions.

Property Characteristics

Characteristic Value
Initial value ease
Inherited No
Applies to All elements, including ::before and ::after
Computed value As specified
Animation type Not animatable
Percentages Used within supported timing functions, not as a standalone property value
Specification CSS Transitions and CSS Easing Functions

Note: The timing function controls the progression of a transition. The transition-duration property controls how long the transition takes.

How It Works

A transition timing function maps elapsed time to transition progress. This determines how quickly the property moves between its starting and ending values.

Step 1: Define the Initial Style

.box {
  transform: translateX(0);
}

Step 2: Select the Property

.box {
  transition-property: transform;
}

Step 3: Set the Duration

.box {
  transition-duration: 1s;
}

Step 4: Choose the Timing Function

.box {
  transition-timing-function: ease-in-out;
}

Step 5: Define the Changed State

.box:hover {
  transform: translateX(100px);
}

Complete Example

.box {
  transform: translateX(0);
  transition-property: transform;
  transition-duration: 1s;
  transition-timing-function: ease-in-out;
}
.box:hover {
  transform: translateX(100px);
}

The box moves over one second, accelerating near the beginning and decelerating near the end.

Understanding Progress

A linear transition reaches approximately 50% progress halfway through its duration. An easing function may reach a different progress value at the same point in time.

Some custom easing functions can temporarily produce progress values outside the normal 0 to 1 range. Whether the property visibly overshoots depends on its animation type and value restrictions.

Easing Keywords

CSS provides several predefined timing functions for common transition effects.

ease

.example {
  transition-timing-function: ease;
}

The default easing curve starts slowly, accelerates, and slows near the end.

linear

.example {
  transition-timing-function: linear;
}

Transition progress changes at a constant rate.

ease-in

.example {
  transition-timing-function: ease-in;
}

The transition begins slowly and accelerates toward the end.

ease-out

.example {
  transition-timing-function: ease-out;
}

The transition begins quickly and slows toward the end.

ease-in-out

.example {
  transition-timing-function: ease-in-out;
}

The transition accelerates and decelerates in a more balanced pattern.

Equivalent Cubic Bézier Values

Keyword Equivalent Function
ease cubic-bezier(0.25, 0.1, 0.25, 1)
linear cubic-bezier(0, 0, 1, 1)
ease-in cubic-bezier(0.42, 0, 1, 1)
ease-out cubic-bezier(0, 0, 0.58, 1)
ease-in-out cubic-bezier(0.42, 0, 0.58, 1)

Choosing an Easing Keyword

Use ease-out for many responsive interface effects, ease-in-out for balanced movement, and linear when constant progress is appropriate. Choose based on the interaction rather than applying one function to every transition.

The cubic-bezier() Function

The cubic-bezier() function defines a custom easing curve using two control points.

Syntax

.example {
  transition-timing-function: cubic-bezier(x1, y1, x2, y2);
}

The first and third numbers represent the horizontal coordinates of the control points. They must be between 0 and 1. The vertical coordinates can extend outside that range.

Custom Ease

.example {
  transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

Custom Acceleration

.example {
  transition-timing-function: cubic-bezier(0.7, 0, 1, 0.5);
}

Custom Deceleration

.example {
  transition-timing-function: cubic-bezier(0, 0.5, 0.3, 1);
}

Overshooting Curve

.example {
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

This curve can produce progress beyond the final value before settling back. Properties that restrict their values may clamp the visible result.

Invalid Control Points

.example {
  transition-timing-function: cubic-bezier(1.5, 0, 0.5, 1);
}

This declaration is invalid because the first horizontal coordinate exceeds 1.

Recommended Practice

Use custom Bézier curves when predefined easing keywords do not provide the intended effect. Test the curve in both forward and reverse transitions.

The steps() Function

The steps() function divides transition progress into discrete jumps rather than producing continuous interpolation.

Basic Syntax

.example {
  transition-timing-function: steps(4, end);
}

Step Count

The first argument specifies the number of steps. It must be a positive integer, except that steps(1, jump-none) is invalid because jump-none requires at least two steps.

Step Positions

Position Behavior
jump-start Includes a jump at the beginning of the interval.
jump-end Includes a jump at the end of the interval.
jump-none Excludes jumps at both endpoints.
jump-both Includes jumps at both endpoints.
start Equivalent to jump-start.
end Equivalent to jump-end.

steps() With start

.example {
  transition-timing-function: steps(4, start);
}

steps() With end

.example {
  transition-timing-function: steps(4, end);
}

step-start

.example {
  transition-timing-function: step-start;
}

This is equivalent to steps(1, start).

step-end

.example {
  transition-timing-function: step-end;
}

This is equivalent to steps(1, end).

Practical Example

.indicator {
  width: 40px;
  transition: width 1s steps(5, end);
}
.indicator.is-active {
  width: 200px;
}

The width changes in five discrete increments rather than continuously.

Important Consideration

Step timing functions can create abrupt changes. Use them for effects that intentionally require distinct stages, such as frame-based indicators or stepped progress displays.

The linear() Function

The linear() function defines a custom piecewise-linear timing function using a series of progress stops.

Unlike the linear keyword, which produces constant progress, linear() can create multiple segments with different rates of change.

Basic Syntax

.example {
  transition-timing-function: linear(0, 0.5, 1);
}

Explicit Stop Positions

.example {
  transition-timing-function: linear(0, 0.2 25%, 0.8 75%, 1);
}

The percentages specify positions along the transition timeline.

Custom Acceleration Pattern

.example {
  transition-timing-function: linear(0, 0.1 20%, 0.5 50%, 1);
}

Overshoot Effect

.example {
  transition-timing-function: linear(0, 1.15 70%, 0.95 85%, 1);
}

This function can move beyond the final progress value and then return to it.

Comparison With the linear Keyword

.constant {
  transition-timing-function: linear;
}
.custom {
  transition-timing-function: linear(0, 0.1 30%, 0.9 70%, 1);
}

The first transition progresses at a constant rate. The second uses different rates across its defined segments.

Browser Compatibility

The linear() function is newer than the traditional easing keywords. Check current browser support when using it in production.

Fallback Example

.example {
  transition-timing-function: ease;
  transition-timing-function: linear(0, 0.2 25%, 0.8 75%, 1);
}

Browsers that do not recognize linear() can use the earlier ease declaration.

Multiple Timing Functions

Different properties can use different timing functions within the same transition declaration.

Two Properties

.example {
  transition-property: opacity, transform;
  transition-duration: 0.3s, 0.5s;
  transition-timing-function: linear, ease-out;
}

Opacity uses linear timing, while transform uses ease-out timing.

Three Properties

.example {
  transition-property: opacity, transform, background-color;
  transition-duration: 0.3s;
  transition-timing-function: linear, ease-in, ease-out;
}

Repeating Shorter Lists

.example {
  transition-property: opacity, transform, background-color;
  transition-timing-function: ease, linear;
}

The timing function list repeats as needed. Opacity uses ease, transform uses linear, and background color uses ease.

Extra Timing Functions

.example {
  transition-property: opacity, transform;
  transition-timing-function: ease, linear, ease-out;
}

The extra timing function does not create another transition because only two properties are selected.

Using the Shorthand

.example {
  transition: opacity 0.3s linear, transform 0.5s ease-out;
}

Recommended Practice

Keep property names, durations, delays, and timing functions in a consistent order so their relationships remain clear.

Timing Function, Duration, and Delay

The timing function, duration, and delay control different aspects of a transition.

Property Purpose
transition-timing-function Controls how transition progress changes over time.
transition-duration Controls how long the transition takes.
transition-delay Controls how long to wait before the transition begins.

Timing Function Only

.example {
  transition-timing-function: ease-in-out;
}

The initial transition duration is 0s, so this declaration alone does not create a visible gradual transition.

Timing Function With Duration

.example {
  transition-duration: 0.5s;
  transition-timing-function: ease-in-out;
}

Timing Function With Duration and Delay

.example {
  transition-duration: 0.5s;
  transition-delay: 0.2s;
  transition-timing-function: ease-in-out;
}

Equivalent Shorthand

.example {
  transition: all 0.5s ease-in-out 0.2s;
}

Important Consideration

A timing function does not change the declared duration. However, interruptions, reversals, and easing curves can affect how long a particular visual change appears to take.

Using the transition Shorthand

The transition-timing-function property is included in the transition shorthand.

Longhand Syntax

.example {
  transition-property: opacity;
  transition-duration: 0.5s;
  transition-timing-function: ease-out;
  transition-delay: 0.2s;
}

Equivalent Shorthand

.example {
  transition: opacity 0.5s ease-out 0.2s;
}

Default Timing Function

.example {
  transition: opacity 0.5s;
}

When no timing function is specified, the default is ease.

Custom Cubic Bézier Timing

.example {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

Step-Based Timing

.example {
  transition: width 1s steps(5, end);
}

Multiple Transitions

.example {
  transition: opacity 0.3s linear, transform 0.5s ease-out;
}

Shorthand Reset Behavior

.example {
  transition-timing-function: linear;
  transition: opacity 0.3s ease;
}

The shorthand replaces the previous timing function with ease.

Overriding the Shorthand

.example {
  transition: opacity 0.3s ease;
  transition-timing-function: linear;
}

The later longhand declaration changes the timing function to linear.

The transition-timing-function property works with the other CSS transition properties.

transition

.example {
  transition: opacity 0.3s ease;
}

Combines transition settings into a shorthand declaration.

transition-property

.example {
  transition-property: opacity;
}

Identifies which properties should transition.

transition-duration

.example {
  transition-duration: 0.3s;
}

Specifies how long each transition takes.

transition-delay

.example {
  transition-delay: 0.2s;
}

Specifies how long to wait before a transition begins.

transition-behavior

.example {
  transition-behavior: allow-discrete;
}

Allows eligible discrete properties to participate in transitions.

animation-timing-function

.example {
  animation-timing-function: ease-in-out;
}

Controls the timing of CSS animations created using @keyframes.

Complete Example

.example {
  transition-property: opacity, transform;
  transition-duration: 0.3s, 0.5s;
  transition-timing-function: linear, ease-out;
  transition-delay: 0s, 0.1s;
  transition-behavior: normal;
}

Inheritance

The transition-timing-function property is not inherited. Child elements do not automatically use their parent's timing function.

Parent Element

.parent {
  transition-timing-function: ease-in-out;
}

Child Element

.child {
  transition-timing-function: linear;
}

Explicit Inheritance

.child {
  transition-timing-function: inherit;
}

Restore the Initial Value

.child {
  transition-timing-function: initial;
}

This restores the initial value of ease.

Using unset

.child {
  transition-timing-function: unset;
}

Because the property is not inherited, unset restores its initial value.

Important Consideration

Declare timing functions on the elements whose transitions need to be controlled.

Practical Examples

Button Background Color

.button {
  background-color: #2563eb;
  transition: background-color 0.3s ease-out;
}
.button:hover {
  background-color: #1e40af;
}

Card Movement

.card {
  transform: translateY(0);
  transition: transform 0.4s ease-in-out;
}
.card:hover {
  transform: translateY(-8px);
}

Image Opacity

.image {
  opacity: 0.6;
  transition: opacity 0.3s linear;
}
.image:hover {
  opacity: 1;
}

Custom Easing Curve

.panel {
  transform: scale(1);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.panel:hover {
  transform: scale(1.05);
}

Stepped Width Change

.progress {
  width: 40px;
  transition: width 1s steps(5, end);
}
.progress.is-active {
  width: 200px;
}

Multiple Timing Functions

.card {
  opacity: 0.8;
  transform: translateY(0);
  transition: opacity 0.2s linear, transform 0.5s ease-out;
}
.card:hover {
  opacity: 1;
  transform: translateY(-6px);
}

Navigation Link Color

.nav-link {
  color: #374151;
  transition: color 0.2s ease;
}
.nav-link:hover,
.nav-link:focus-visible {
  color: #2563eb;
}

transition-timing-function Example

This example compares five timing functions. Hover over or keyboard-focus the demonstration area to move each bar across its track. All five transitions have the same duration, but their movement patterns differ.

HTML Example

<div class="timing-demo" tabindex="0" aria-label="Focus or hover to compare transition timing functions">
  <div class="timing-row">
    <span class="timing-label">linear</span>
    <div class="timing-track"><div class="timing-bar timing-linear"></div></div>
  </div>
  <div class="timing-row">
    <span class="timing-label">ease</span>
    <div class="timing-track"><div class="timing-bar timing-ease"></div></div>
  </div>
  <div class="timing-row">
    <span class="timing-label">ease-in</span>
    <div class="timing-track"><div class="timing-bar timing-ease-in"></div></div>
  </div>
  <div class="timing-row">
    <span class="timing-label">ease-out</span>
    <div class="timing-track"><div class="timing-bar timing-ease-out"></div></div>
  </div>
  <div class="timing-row">
    <span class="timing-label">ease-in-out</span>
    <div class="timing-track"><div class="timing-bar timing-ease-in-out"></div></div>
  </div>
</div>

CSS Example

.timing-demo {
  padding: 20px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.timing-demo:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}
.timing-row {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.timing-row:last-child {
  margin-bottom: 0;
}
.timing-label {
  font-size: 14px;
}
.timing-track {
  height: 24px;
  background-color: #e5e7eb;
  border-radius: 4px;
}
.timing-bar {
  width: 25%;
  height: 100%;
  background-color: #2563eb;
  border-radius: 4px;
  transform: translateX(0);
  transition-property: transform;
  transition-duration: 2s;
}
.timing-demo:hover .timing-bar,
.timing-demo:focus-visible .timing-bar {
  transform: translateX(300%);
}
.timing-linear {
  transition-timing-function: linear;
}
.timing-ease {
  transition-timing-function: ease;
}
.timing-ease-in {
  transition-timing-function: ease-in;
}
.timing-ease-out {
  transition-timing-function: ease-out;
}
.timing-ease-in-out {
  transition-timing-function: ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .timing-bar {
    transition: none;
  }
}
Browser Result
linear
ease
ease-in
ease-out
ease-in-out

Understanding the Results

Each bar travels the same distance over two seconds. The timing function changes how the movement is distributed across that time.

linear

The bar moves at a constant rate from beginning to end.

ease

The bar starts slowly, speeds up, and slows near the end.

ease-in

The bar starts slowly and accelerates toward the end.

ease-out

The bar moves quickly at first and decelerates toward the end.

ease-in-out

The bar accelerates and decelerates in a more balanced pattern.

Experiment With steps()

.timing-linear {
  transition-timing-function: steps(5, end);
}

The first bar now moves in five distinct jumps.

Experiment With cubic-bezier()

.timing-ease {
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

The second bar can temporarily overshoot its final position before settling back.

Accessibility Considerations

Transition timing functions can affect how users experience motion and visual feedback. Use easing effects that support clarity and responsiveness.

Respect Reduced Motion Preferences

@media (prefers-reduced-motion: reduce) {
  .interactive-element {
    transition: none;
  }
}

Avoid Excessive Motion

Large movements, overshooting curves, and repeated transitions can be distracting or uncomfortable for some users.

Keep Interface Feedback Responsive

Avoid easing patterns that delay important feedback or make controls feel unresponsive.

Maintain Visible Focus Indicators

Keyboard focus indicators should remain easy to identify throughout transitions.

Avoid Unnecessary Overshooting

Custom easing curves that overshoot their final values should be used carefully, especially for large movements.

Preserve Essential Information

Do not rely on transition motion alone to communicate important state changes.

Support Keyboard and Touch Input

Interactive effects should not depend exclusively on hover states.

Provide Functional Fallbacks

The interface should remain usable when transitions are disabled or unsupported.

Common Mistakes

Forgetting the Duration

.example {
  transition-timing-function: ease-in-out;
}

The initial transition duration is 0s. A timing function alone does not produce a visible gradual transition.

Using an Invalid Keyword

.example {
  transition-timing-function: smooth;
}

The keyword smooth is not a valid CSS timing function.

Using Time Values

.example {
  transition-timing-function: 0.5s;
}

Time values belong to transition-duration or transition-delay.

Using Invalid Cubic Bézier Coordinates

.example {
  transition-timing-function: cubic-bezier(1.5, 0, 0.5, 1);
}

The horizontal control-point coordinates must remain between 0 and 1.

Using an Invalid Step Count

.example {
  transition-timing-function: steps(0, end);
}

The number of steps must be positive.

Confusing linear and linear()

The linear keyword creates constant progress. The linear() function defines a custom piecewise-linear easing curve.

Forgetting Commas

.example {
  transition-timing-function: ease linear;
}

Separate multiple timing functions with commas.

Expecting the Timing Function to Change Duration

The timing function controls progress within the declared duration. It does not change the duration itself.

Overwriting Timing With the Shorthand

.example {
  transition-timing-function: linear;
  transition: opacity 0.3s ease;
}

The shorthand replaces the previous timing function with ease.

Ignoring Reduced Motion Preferences

Provide alternatives for users who prefer reduced motion.

Important Considerations

Keep the following points in mind when using transition-timing-function:

  • The property controls how a transition progresses over time.
  • The initial value is ease.
  • The property is not inherited.
  • The linear keyword produces constant progress.
  • The ease keyword starts slowly, accelerates, and slows near the end.
  • The ease-in keyword produces accelerating progress.
  • The ease-out keyword produces decelerating progress.
  • The ease-in-out keyword combines acceleration and deceleration.
  • The cubic-bezier() function defines custom easing curves.
  • The horizontal Bézier control-point coordinates must be between 0 and 1.
  • Vertical Bézier coordinates can extend outside the normal progress range.
  • The steps() function divides progress into discrete jumps.
  • The step-start and step-end keywords are predefined step functions.
  • The linear() function defines custom piecewise-linear easing.
  • Multiple timing functions can be separated by commas.
  • Each timing function corresponds to a transition property.
  • Shorter timing function lists repeat values as needed.
  • Extra timing function values do not create additional transitions.
  • The property is a longhand component of transition.
  • The shorthand can reset previously declared timing functions.
  • The timing function does not change the declared duration.
  • A nonzero duration is normally required for visible gradual interpolation.
  • Transitions can be interrupted or reversed.
  • Custom easing curves can produce overshooting effects.
  • Some properties restrict or clamp overshooting values.
  • Use motion effects carefully and respect reduced motion preferences.
  • Test timing functions across supported browsers.

Browser Support

The CSS transition-timing-function property is widely supported across modern browsers. Traditional easing keywords, cubic-bezier(), and steps() are established CSS features.

The newer linear() function has separate compatibility considerations. Check current support before relying on it without a fallback.

For current compatibility information, visit Can I Use? and search for transition-timing-function.

Basic Declaration

.example {
  transition-timing-function: ease-in-out;
}

Custom Cubic Bézier

.example {
  transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

Step Timing

.example {
  transition-timing-function: steps(5, end);
}

Feature Detection

@supports (transition-timing-function: linear(0, 0.5, 1)) {
  .example {
    transition-timing-function: linear(0, 0.5, 1);
  }
}

Fallback for linear()

.example {
  transition-timing-function: ease;
  transition-timing-function: linear(0, 0.2 25%, 0.8 75%, 1);
}

Testing Recommendations

Test easing keywords, custom curves, step functions, interrupted transitions, and reduced motion settings. Verify support for newer easing functions when targeting older browsers.

Specifications

The transition-timing-function property is defined in the CSS Transitions specification. Timing function syntax and behavior are defined in the CSS Easing Functions specifications.

CSS Transitions Level 1 - The transition-timing-function Property

CSS Easing Functions Level 1

CSS Easing Functions Level 2

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: transition-timing-function