CSS Clamp Calculator generates a clamp() expression for fluid sizing. Enter the minimum and maximum size in pixels and the viewport widths at which each should apply; the tool calculates the slope and intercept and writes a value such as clamp(1rem, 1.6667vw + 0.6667rem, 2rem).
The result scales smoothly between the two viewport widths and stops at the limits outside them. Sizes are output in rem, assuming a 16 pixel root, so text still responds to the user's browser font setting.
Advertisement
How to use CSS Clamp Calculator
1
Enter min and max size
In pixels, for example 16 and 32.
2
Enter the viewport range
For example 320 to 1280 pixels.
3
Copy the clamp()
Use it for font-size, padding or gap.
Use Cases
- Fluid headings that need no media queries
- Section padding that grows with the screen
- Building a responsive type scale
Frequently Asked Questions
Minimum, preferred and maximum. The preferred value is used unless it falls outside the limits.
A value in vw alone ignores the user's font-size preference and breaks zoom. Adding rem keeps it accessible.
Yes. It works for any length property.
Yes, CSS Clamp Calculator is 100% free with no usage limits, no watermarks, and no hidden charges. The platform is supported by non-intrusive advertising so all tools stay free for everyone.
Yes. CSS Clamp Calculator runs entirely in your browser using client-side JavaScript. Your files and data never leave your device and are never transmitted to our servers.