CSS exp() Function

The exp() function is a CSS math function that calculates e raised to the power of a given number.

In mathematics, e represents Euler's number, a mathematical constant approximately equal to 2.718281828459045. It's the base rate of growth shared by all continually growing processes. When you pass a value into the exp() function, the browser multiplies e by itself that many times.

For example:

While you might not use this for standard web layouts, it's a fantastic tool for creating exponential scales, physics-based animations, or non-linear sizing directly in your stylesheet. Instead of manually calculating exponential steps or using JavaScript, you can let CSS handle the math.

Here's an example demonstrating exponential growth. We have four bars, and we pass a simple sequence of numbers (0, 1, 2, and 3) into the exp() function to determine their widths. Notice how quickly the width scales up:

View Output Full Screen Preview

How It Works

The exp() function takes a single calculation as its argument. This argument must resolve to a unitless number. If you try to pass a dimension (like 10px or 45deg), the function will be invalid.

Because the function returns a unitless number, you'll typically need to multiply it by a unit (like px, rem, or %) inside a calc() function to actually apply it to a CSS property, just like we did in the example above.

Official Syntax

The official syntax of the exp() function is as follows:

Possible Values

As indicated in the official syntax, the exp() function accepts the following value:

calc-sum

A mathematical calculation that resolves to a unitless <number>. The function evaluates this input and returns e raised to that power.

CSS Specifications

Browser Support

The following table provided by Caniuse.com shows the level of browser support for this feature.