CSS calc() Builder

Visually build and test complex CSS calc() math expressions

1 Configuration
Presets:
2 Build Expression
3 Generated Expression
Add terms above to build your calc() expression...
4 Live Preview
Preview
? How It Works

CSS calc() lets you perform math when defining CSS values. It combines different units — like 100% - 20px — which is impossible with plain arithmetic. Our builder lets you add terms with any valid CSS unit (px, %, rem, em, vw, vh) and chain them with +, −, ×, ÷ operators. The expression is assembled with correct spacing around operators, parentheses for grouping, and validated before being applied to the live preview element in real time.

Frequently Asked Questions
Can calc() mix different CSS units?
Yes! That's the main power of calc(). You can combine percentages with pixels, rems with viewport units, and more. For example, width: calc(100% - 40px) gives you a full-width element minus fixed padding. However, multiplication and division require at least one operand to be a unitless number.
Does calc() support nested expressions?
Absolutely. You can nest calc() inside itself or use parentheses for grouping: calc(100% - calc(2rem + 10px)). Our builder handles complex chaining and you can see the exact output with proper spacing and parentheses.
What CSS properties work with calc()?
Almost any property that accepts a length, frequency, angle, time, number, or integer value. Common uses include width, height, margin, padding, font-size, top/left positioning, border-radius, gap, grid-template-columns, and CSS custom properties (variables).
Related Tools
Free tools by TUNA — energy supply from vetted manufacturers