Digital Hub Lab
CSS clamp() Calculator
Generate a CSS clamp() expression for fluid spacing, typography, widths and other responsive values.
Create a CSS clamp expression that scales a property smoothly between minimum and maximum values across a viewport range.
Preparing the interactive tool…
This interactive tool requires JavaScript. Enable JavaScript and reload the page to use it.
How to use this tool
- Enter the CSS property you want to control.
- Set the root font size and value limits.
- Choose the viewport range.
- Copy the declaration and test it at small, medium and large widths.
Understanding the result
Clamp combines a minimum, a fluid preferred value and a maximum. The calculated expression is mathematical; suitability still depends on the component and layout.
Practical guidance
Use sensible limits and verify the result in real content. Fluid spacing should support the layout rather than cause text or controls to become cramped.
