Favorites

exp() CSS Function

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

The exp() function returns e (about 2.718) raised to the power of a number, such as exp(1).

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The exp() CSS function returns the mathematical constant e (approximately 2.718) raised to the power of the given number. In other words, exp(x) is the same as pow(e, x). It produces exponential growth: each time the argument goes up by one, the result is multiplied by about 2.718.

The argument must be a <number> without units, and the result is also a number. To use it for sizes or durations, multiply the result by a value with a unit, for example calc(exp(2) * 10px). exp() is the inverse of the natural logarithm, so log(exp(x)) returns x. It is useful for easing-like sizing, for spacing scales that grow quickly, and for any calculation that needs natural exponential behaviour.

:root {
  --step: 1;
}

/* Spacing that grows exponentially with each step */
.space {
  margin-block: calc(exp(var(--step)) * 4px);
}

/* exp(0) = 1, exp(1) is about 2.72, exp(2) is about 7.39 */
.bar-1 { width: calc(exp(1) * 30px); }
.bar-2 { width: calc(exp(2) * 30px); }

exp() belongs to the exponential function family together with pow(), sqrt(), log() and hypot().

Interactive Demo

050px100px150px200px250px
Demo Code
HTML Code
<div class="demo-track">
	<div class="demo-element"></div>
</div>
<div class="demo-scale"><span>0</span><span>50px</span><span>100px</span><span>150px</span><span>200px</span><span>250px</span></div>
CSS Code
.demo-track {
	width: 300px;
	height: 36px;
	background: #f4f4f4 repeating-linear-gradient(90deg, #b0b0b0 0 1px, transparent 1px 50px);
	outline: 1px solid #c5c5c5;
}
.demo-scale {
	display: grid;
	grid-template-columns: repeat(6, 50px);
	width: 300px;
	font-size: 11px;
	color: #666;
}
.demo-element {
	height: 100%;
	background: linear-gradient(90deg, #f72585, #b5179e);
	width: calc(exp(0) * 50px);
}

Syntax

exp() = exp( <calc-sum> )

Values

  • <calc-sum>A calculation that resolves to a <number>. The function returns e raised to this power, as a <number>.

Example

<div class="wrap">
<h1>CSS exp() examples</h1>
<div class="card list">
<div class="bar e0"></div><div class="label">calc(exp(0) * 25px) = 25px</div>
<div class="bar e1"></div><div class="label">calc(exp(1) * 25px) &asymp; 68px</div>
<div class="bar e2"></div><div class="label">calc(exp(2) * 25px) &asymp; 185px</div>
<div class="bar e3"></div><div class="label">calc(exp(3) * 25px) &asymp; 502px</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;
}

/* exp() examples */
.bar {
height: 28px;
border-radius: 6px;
background: linear-gradient(90deg, #2563eb, #06b6d4);
max-width: 100%;
}

.track {
background: #e2e8f0;
border-radius: 6px;
overflow: hidden;
}

.list { display: grid; gap: 10px; }
.e0 { width: calc(exp(0) * 25px); }
.e1 { width: calc(exp(1) * 25px); }
.e2 { width: calc(exp(2) * 25px); }
.e3 { width: calc(exp(3) * 25px); }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS exp() 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
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee