CSS calc() works in Chrome 19+, Edge 12+, Firefox 4+, Safari 6+, Opera 15+, and Samsung Internet 4+. Learn the operators, custom-property tricks, and quirks.

Prince Dewani
May 6, 2026
CSS calc() is a W3C function that lets a stylesheet do math inside any length, percentage, angle, time, or frequency value, mixing units like px, %, and vw. It works in Chrome 19+, Edge 12+, Firefox 4+, Safari 6+ on macOS and iOS, Opera 15+, and Samsung Internet 4+, with partial support in Internet Explorer 9 to 11.
This guide covers what CSS calc() is, the browsers that support it, the math operators, custom-property use, use cases, and known issues.
CSS calc() is a CSS function defined in the W3C CSS Values and Units Module that performs math on numeric property values. It accepts addition, subtraction, multiplication, and division on lengths, percentages, numbers, angles, times, and frequencies, and lets you mix units like px and %.
CSS calc() works in every modern desktop and mobile browser. The function shipped early across Chrome, Firefox, Safari, and Opera, while Internet Explorer added only partial support and Opera Mini still does not support it.
Chrome supports CSS calc() from Chrome 19 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 4 to 18 did not support it. Chrome added calc() inside color channels in Chrome 119, so newer color-mix and relative color expressions also accept calc() math.
Microsoft Edge supports CSS calc() from Edge 12 on Windows, macOS, Linux, Android, and iOS. The legacy EdgeHTML engine inherited the partial-support quirks from Internet Explorer, so calc() on table cells and inside box-shadow values failed silently. Chromium Edge from Edge 79 onwards behaves the same as Chrome.
Firefox supports CSS calc() from Firefox 4 on Windows, macOS, Linux, and Android. Firefox 1 to 3.6 did not support it. Firefox 16 added calc() to font-size, transform, and a wider set of properties, and Firefox 59 added calc() inside color functions like rgb() and hsl().
Safari supports CSS calc() from Safari 6 on macOS and from Safari 6 on iOS and iPadOS. Safari 3.1 to 5.1 did not support it. Safari 6 and 7 ignore viewport units like vw and vh inside calc(), so a value like calc(100vh - 80px) computes to the static fallback on those two versions. Safari 7.1 and later treat viewport units the same as Chrome.
Opera supports CSS calc() from Opera 15 on desktop and from Opera Mobile 14 on Android. Opera 9 to 12.1 used the Presto engine and did not support calc(). Opera Mini, the proxy-rendered mobile browser, still does not support calc() in any version, so always pair calc() with a static fallback when Opera Mini matters.
Samsung Internet supports CSS calc() from Samsung Internet 4 on Galaxy phones and tablets. The browser is built on Chromium, so it follows the same calc() rules as Chrome for Android, including viewport units and color-channel math from Samsung Internet 23.
Chrome for Android supports CSS calc() from Chrome 25 on Android 4.0 and later. The legacy stock Android Browser added partial calc() support in Android 4.4 KitKat WebView, but viewport units and nested calc() failed in that build. Use Chrome for Android, Firefox for Android, or Samsung Internet for full calc() support.
Internet Explorer 9, 10, and 11 ship partial CSS calc() support. The function works on width, height, padding, margin, and font-size, but it fails on table cells and silently drops box-shadow whenever calc() appears in any of its values. IE 6 to 8 do not support calc() at all. Microsoft has retired Internet Explorer, so use Edge for any new CSS calc() work.
Note: CSS calc() behaves differently in Safari 6 to 7, IE 9 to 11, and Opera Mini. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!
CSS calc() supports four math operators: addition with +, subtraction with -, multiplication with *, and division with /. The operators follow standard math precedence, where * and / bind tighter than + and -. Each operator carries its own rules about units and whitespace.
CSS calc() pairs with CSS custom properties through the var() function, so a single :root variable can drive a whole layout grid. Chrome 49+, Firefox 31+, Safari 9.1+, and Edge 15+ all parse calc() with var() correctly, which covers every browser that supports custom properties in the first place.
The snippet below sets a gutter and a column count once, then uses calc() to derive the column width, the padding, and a viewport-aware hero height. Change one variable and every dependent value follows.
:root {
--gutter: 24px;
--columns: 4;
}
.card {
/* Subtract gutters from the parent width and divide by the column count. */
width: calc((100% - (var(--columns) - 1) * var(--gutter)) / var(--columns));
margin-right: var(--gutter);
padding: calc(var(--gutter) / 2);
}
.hero {
/* Lock the hero to the viewport minus the header. */
min-height: calc(100vh - 80px);
font-size: calc(1rem + 0.5vw);
}When the var() lookup fails, calc() returns the type-default value (zero for lengths, transparent for colors). Pass a fallback inside var(), like var(--gutter, 16px), so a missing variable does not collapse a layout to zero.
CSS calc() shows up across almost every production web app because it solves layout problems that pure flex or grid still cannot. The most common cases mix percentages with fixed pixel values, lock content under a sticky header, and scale type to the viewport.
CSS calc() has the broadest browser support of almost any modern CSS feature, but a handful of real edge cases still bite in production. Most of the surprises come from older Safari builds, IE 11 quirks, and sub-pixel rounding differences across rendering engines.
In my experience, the silent failure that costs the most debugging time is the missing space around + and -. The page looks correct in your editor, the property simply disappears in the browser, and DevTools highlights the rule as invalid in pale grey. A Stylelint rule catches it before it ever ships.
All CSS calc() version numbers and platform notes in this guide come from these primary sources:
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance