Skip to main content

CSS calc() Calculator

Build and preview two-term CSS calc() expressions with common length units. Preview assumes a configurable viewport, container, and font size; values stay local.

Expression inputs

-100,000 to 100,000
-100,000 to 100,000

Preview context

1 to 10,000 px
1 to 10,000 px
1 to 10,000 px
1 to 1,000 px
1 to 1,000 px

Use two compatible lengths or two numbers for addition and subtraction. Multiplication needs a unitless term; division needs a nonzero unitless divisor. The preview assumes % uses container width; em, rem, vw, and vh use the context above. Inputs are limited to 12 characters, terms to -100,000–100,000, context widths to 1–10,000 px, and font sizes to 1–1,000 px. Preview values are capped at 1,000,000,000. CSS is not parsed or executed.

CSS calc() expression

Preview result1168px

Numeric preview only; the generated expression remains CSS for the browser to resolve during layout.

Was this tool helpful?