Favorites

pow() CSS Function

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

The pow() function raises a number to a power, such as pow(2, 3), which is 8. It is useful for typographic scales.

☕
Enjoying this site?

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

Buy us a coffee

Description

The pow() CSS function raises a base number to the power of an exponent. For example, pow(2, 3) is 8, because 2 × 2 × 2 = 8. Both arguments must be plain <number> values, and the result is a number, so multiply it by a unit when you need a length, time or other dimension.

The most popular use of pow() is building a modular type scale, where each heading level is a fixed ratio larger than the one below it. Instead of hard-coding every size, you can store the ratio in a custom property and raise it to the level number. Fractional and negative exponents also work, so pow(4, 0.5) is 2 and pow(2, -1) is 0.5.

:root {
  --ratio: 1.25;
}

h3 { font-size: calc(1rem * pow(var(--ratio), 1)); }  /* 1.25rem */
h2 { font-size: calc(1rem * pow(var(--ratio), 2)); }  /* about 1.56rem */
h1 { font-size: calc(1rem * pow(var(--ratio), 3)); }  /* about 1.95rem */

small { font-size: calc(1rem * pow(var(--ratio), -1)); } /* 0.8rem */

pow() is part of the exponential function family with sqrt(), hypot(), log() and exp().

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(pow(2, 3) * 10px);
}

Syntax

pow() = pow( <calc-sum>, <calc-sum> )

Values

  • baseA calculation resolving to a <number>: the value to be multiplied by itself.
  • exponentA calculation resolving to a <number>: the power to raise the base to. Fractional and negative values are allowed.

Example

<div class="wrap">
<h1>CSS pow() examples</h1>
<div class="card scale">
<p style="--n: 4">Heading<span>pow(1.25, 4)</span></p>
<p style="--n: 3">Heading<span>pow(1.25, 3)</span></p>
<p style="--n: 2">Heading<span>pow(1.25, 2)</span></p>
<p style="--n: 1">Heading<span>pow(1.25, 1)</span></p>
<p style="--n: 0">Body text<span>pow(1.25, 0)</span></p>
<p style="--n: -1">Small print<span>pow(1.25, -1)</span></p>
</div>
<p class="note">Each line is calc(1rem * pow(var(--ratio), var(--n))).</p>
</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;
}

/* pow() examples */
:root {
--ratio: 1.25;
}

.scale p {
margin: 0 0 8px;
line-height: 1.2;
font-weight: 600;
font-size: calc(1rem * pow(var(--ratio), var(--n)));
}

.scale span {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
font-size: 12px;
font-weight: 400;
color: #486581;
margin-left: 8px;
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS pow() 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