What Is the CSS Clamp Calculator?
Generate fluid CSS clamp() values for responsive typography and spacing. Enter minimum and maximum sizes with viewport breakpoints, and get production-ready clamp() declarations.
Why Use This Tool?
Fluid typography scales smoothly between breakpoints without media queries. The clamp() function sets a minimum, a preferred viewport-based value, and a maximum — but calculating the preferred value formula is non-trivial. This tool does the math for you.
How to Use This CSS Clamp Calculator
- Set your minimum value — Enter the smallest size (e.g., 16px for body text). This is the floor — the value won't go below this on any screen.
- Set your maximum value — Enter the largest size (e.g., 24px). This is the ceiling — the value caps here on large screens.
- Define your viewport range — Set the minimum and maximum viewport widths where the fluid scaling should happen (e.g., 320px to 1200px).
- Copy the clamp() function — The tool generates the complete
clamp(min, preferred, max)value with the correct vw calculation for the preferred (middle) value.
Worked example: the default 16 → 32 px, checked in Chromium
The defaults (16 px at 320 px wide, 32 px at 1200 px) give clamp(1.0000rem, 0.6364rem + 1.8182vw, 2.0000rem). On October 12, 2026 we applied it in Chromium at five viewport widths, then simulated 200% browser zoom on a 1280 px window (which leaves a 640 px CSS viewport) and a reader whose browser font size is 20 px instead of 16.
| Situation | Computed size | What you might expect |
|---|---|---|
| 320 px wide | 16.0 px | 16 (min) |
| 375 px (common phone) | 17.0 px | — |
| 768 px (tablet) | 24.1 px | the tool's preview shows the same |
| 1200 px and wider | 32 px | 32 (max) |
| 1280 px window at 200% zoom | 21.8 CSS px = 43.6 px on screen | 64 px (2 × 32): only 1.36× bigger |
| Browser font size 20 px, 760 px wide | 26.5 px | 30 px (25% more than 24): the vw part ignores the setting |
- Fluid type can fight zoom. Zooming in makes the CSS viewport narrower, so the vw term shrinks while the rem term grows. With this 2:1 range, 200% zoom made the heading only 1.36× larger. WCAG 1.4.4 asks that text can reach 200%, so check large ranges: a smaller max/min ratio, or a bigger rem share in the middle value, keeps zoom working.
- The rem values assume a 16 px root. The tool divides by 16. If your site sets html { font-size: 62.5% } or another base, the min and max will be off by that factor; convert from your real root size.
- Readers' font settings only partly apply. The rem term follows a larger browser font size, the vw term does not, so the middle of the range grows less than the ends.
- Min must be smaller than max, and viewport min below viewport max. If you swap them, the slope turns negative and clamp() pins the value at one end; the output still looks valid.
- Other properties: the property selector writes the same clamp() for padding, margin, gap or width; the px inputs are converted to rem the same way.
Sources
Checked on .
Frequently Asked Questions
📖 Learn More
Related Article The Complete Guide to CSS Units → Related Article How to Use CSS Clamp for Responsive Design →Built by Derek Giordano · Part of Ultimate Design Tools