What is CSS Clamp Calculator?
CSS clamp sets a minimum value, a preferred fluid value, and a maximum value in one expression. It is commonly used for responsive font sizes and spacing because it can scale smoothly between mobile and desktop without writing several media queries.
quickAnswer
Calculate a responsive CSS clamp expression for fluid typography, spacing, or layout values. Enter minimum and maximum sizes with viewport ranges to generate a value that scales smoothly between them.
Last updated: 2026-06-11
limitations
- Clamp() values are static once generated. They do not adapt to changes in the DOM, user interactions, or container dimensions. For layout-aware scaling, consider container query units instead.
- The viewport-based preferred value may need adjustment at extreme screen sizes. Test the generated clamp value on very small and very large viewports to confirm the curve feels natural.
- This tool uses viewport width (vw) for the preferred value. It does not account for container query units (cqw) or other newer CSS units that behave differently.
Sources:MDN Web Docs · W3C Specifications · jquery.app on GitHub
How to use this tool
- Enter the smallest and largest size you want the property to use.
- Enter the viewport width where the smallest value should start and the viewport width where the largest value should stop.
- Choose the CSS property you want to generate.
- Copy the clamp expression into your stylesheet and test it at mobile, tablet, and desktop widths.
What you can use it for
- Create fluid headings without many media queries.
- Scale spacing smoothly between mobile and desktop.
- Copy a clamp value directly into CSS.