exp() CSS Function
The exp() function returns e (about 2.718) raised to the power of a number, such as exp(1).
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
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
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.
Desktop





Tablets & Mobile





