calc() is a CSS function that lets you perform basic arithmetic—addition, subtraction, multiplication, and division—on values to determine the final size, position, or spacing of an element. The beauty is that you can mix different units in the same expression, something that’s impossible with plain CSS values.
Instead of locking yourself to a fixed number or relying entirely on relative units, you can combine them.
For example:

Why It’s So Useful
The real power of calc() is flexibility. Let’s say you’re designing a fluid layout where some elements use percentages and others use absolute units like pixels or rems.
It’s especially handy when:
- You need to leave space for fixed elements (like sidebars or headers) while keeping the rest fluid

- Typography and spacing need to scale, but still respect a base offset

- Responsive designs require subtle size adjustments without rewriting your CSS at every breakpoint

Things to Keep in Mind
calc() doesn’t break the cascade—it works just like any other CSS value.
NOTE: letting space around operators matters:calc(100% - 20px)works,calc(100%-20px)does not.