Favorites

linear() CSS Function

linear()
CSS FunctionThis function is supported by all modern browsers.
Updated 21st November 2026

The linear() easing function defines a custom easing curve from a list of points, so it can create effects such as bounce or spring.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The linear() CSS function defines a custom easing function by listing points that the animation's progress passes through, joined by straight lines. It is used wherever an easing function is accepted, such as transition-timing-function, animation-timing-function and the transition and animation shorthands. Do not confuse it with the linear keyword, which is a constant speed with no points.

Each point is an output value, usually from 0 to 1, optionally followed by one or two percentages that say when in the animation that output is reached. linear(0, 0.5 80%, 1) moves halfway in the first 80% of the time and then finishes quickly. Outputs can go above 1 or below 0 to create overshoot. Because you can add as many points as you like, linear() can approximate effects that cubic-bezier() cannot, such as bounces and springs. Tools exist that convert a JavaScript spring or bounce curve into a long linear() list.

/* Same as the linear keyword */
.a { transition-timing-function: linear(0, 1); }

/* Slow start, fast finish */
.b { transition-timing-function: linear(0, 0.25 75%, 1); }

/* Simple bounce at the end */
.drop {
  animation: fall 1s linear(0, 0.36, 1 50%, 0.75, 1 75%, 0.94, 1) forwards;
}

Interactive Demo

linear (for comparison)
the selected timing function
Demo Code
HTML Code
<div class="demo-lanes">
	linear (for comparison)
	<div class="demo-ref"></div>
	the selected timing function
	<div class="demo-element"></div>
</div>
CSS Code
@keyframes demo-ease {
	to { transform: translateX(220px); }
}
.demo-lanes {
	width: 300px;
	padding: 10px;
	box-sizing: border-box;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
	font-size: 12px;
	color: #666;
}
.demo-ref, .demo-element {
	width: 50px;
	height: 40px;
	margin: 4px 0 10px;
	border-radius: 6px;
	animation: demo-ease 2s infinite alternate;
}
.demo-ref {
	background: #c5c5c5;
	animation-timing-function: linear;
}
.demo-element {
	background: #f72585;
	animation-timing-function: linear(0, 1);
}

Syntax

linear() = linear( [ <number> && <percentage>{0,2} ]# )

Values

  • <number>The output progress at this point, where 0 is the start value and 1 is the end value. Values outside 0 to 1 create overshoot.
  • <percentage>Optional. When in the animation (input progress) this output is reached. Two percentages hold the output steady between them. Points without a percentage are spaced evenly between their neighbours.

Example

<div class="wrap">
<h1>CSS linear() examples</h1>
<div class="grid">
<div class="card">
<div class="track even"><span class="ball"></span></div>
<div class="label">linear(0, 1)</div>
</div>
<div class="card">
<div class="track late"><span class="ball"></span></div>
<div class="label">linear(0, 0.25 75%, 1)</div>
</div>
<div class="card">
<div class="track bounce"><span class="ball"></span></div>
<div class="label">linear(0, 0.36, 1 45%, 0.75, 1 72%, 0.93, 1)</div>
</div>
</div>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
margin: 24px;
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
background: #f5f7fb;
color: #102a43;
}

.wrap {
max-width: 860px;
margin: 0 auto;
}

h1 {
font-size: 20px;
margin: 0 0 16px;
}

.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 16px;
}

.card {
background: #fff;
border-radius: 12px;
padding: 16px;
box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
font-size: 12px;
color: #486581;
margin-top: 10px;
word-break: break-word;
}

.note {
font-size: 13px;
color: #486581;
margin-top: 14px;
}

/* linear() examples */
.track {
position: relative;
height: 44px;
border-radius: 22px;
background: #e2e8f0;
}

.ball {
position: absolute;
top: 6px;
left: 6px;
width: 32px;
height: 32px;
border-radius: 50%;
background: #2563eb;
animation: slide 2s infinite alternate;
}

@keyframes slide {
to { left: calc(100% - 38px); }
}

.even .ball { animation-timing-function: linear(0, 1); }
.late .ball { animation-timing-function: linear(0, 0.25 75%, 1); }
.bounce .ball { animation-timing-function: linear(0, 0.36, 1 45%, 0.75, 1 72%, 0.93, 1); }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS linear() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.