CSS clamp() Generator
Enter the smallest and largest size and the two screen widths to get a ready CSS clamp() for fluid type or spacing, with a value table and a full fluid type scale.
Free, no sign-up
Your data stays on your device
Works offline after first open
The tool
Loading the tool…
How to use
- Enter the size on a small screen and on a large screen (in px).
- Set the two screen widths where scaling starts and stops.
- Copy the ready CSS line and check the value at each screen width.
- For a full type scale, open the “Fluid type scale” tab.
Privacy & how it works
Processes your data in the browser and stores nothing.
- Engine: lightweight in-page code, no external libraries.
- Works offline after you open it once.
Frequently asked questions
How is the value calculated?
We draw a straight line between the two points: slope = (max size − min size) ÷ (max width − min width), written as “rem constant + slope vw”. clamp() keeps the value between the minimum and maximum.
Why is there a rem part inside?
If the size were pure vw, browser zoom would not enlarge the text. The rem constant keeps zoom working, which matters for accessibility.
Why the warning when max is 2.5× min or more?
When the maximum is more than 2.5 times the minimum, users may not be able to zoom text to 200% (WCAG 1.4.4) on some screens. Reduce the range or test with zoom.
Formulas & sources
Related tools
Type & Spacing ScalePick a base font size and ratio to get a harmonious size scale for headings and text with an Arabic and English preview, plus a spacing scale, exported as CSS, Tailwind or JSON.CSS Units ConverterConvert between px, rem, em, %, vw, vh, pt, cm and more using your root font size and viewport, with a px-to-rem table and vw values on common screens.Grid CalculatorWork out column width in a layout grid from container width, column count, gutters and margins, with every span in px and %, a grid preview and ready CSS Grid code.Contrast CheckerCheck text and background contrast against WCAG AA and AAA for normal text, large text and UI parts, with an Arabic and English preview and the nearest passing colour.