The Website Mentor
Font Size Clamp Calculator
Enter the smallest and biggest font sizes you'd like on your website, and the screen widths they apply to.
The tool will generate a clamp() value in rem and vw, so the text follows your visitor's browser settings and still adapts to the screen size.
New to clamp()? See what it does in one picture
clamp(1.75rem, 1rem + 3vw, 3rem)
Minimum
28px
Never smaller than this.
Preferred
Fluid
Grows with the screen width.
Maximum
48px
Never bigger than this.
1. Your sizes
Type sizes in px. The result is converted to rem.
2. Your CSS
Copy a single value, or the whole set as CSS variables.
The whole value, ready for CSS or any field that accepts it.
Where to paste it
Full clamp(): paste into any font size field that accepts CSS values, in place of a px number.
Values only: for a field that already adds clamp() itself and asks for the minimum, preferred and maximum. Paste the three values with no clamp( and no closing bracket.
If a field rejects it, add the CSS from the box above to your theme's custom CSS instead, and check the result on the live page.
3. See it at any screen width
Drag the slider, or pick a device.
| Size | px | rem |
|---|
Size against screen width
Flat at the minimum, a smooth climb, then flat at the maximum. The vertical line is the screen width above.
Why rem and vw together: the vw part makes the text grow with the screen, and the rem part keeps it tied to the visitor's own text size setting. Keep the largest size within about 2.5 times the smallest, so text can still zoom for people who need it.
This tool's heading uses clamp(1.75rem, 1rem + 3vw, 3rem). Tool by thewebsitementor.com
Not sure how px, rem, vw and clamp() fit together?
Watch this 10-minute video that explains it…
