CSS clamp() generator
Build a CSS clamp() for fluid font sizes and spacing that scale between two screen widths.
CSS
- Value
clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem) - As a font size
font-size: clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem);
Preview
Resize the window to see this text grow.
Missing a feature or found a bug in CSS clamp() generator? Tell me on X (@_andrewtran) or by email.
How to use CSS clamp() generator
- Enter the smallest and largest size in pixels.
- Enter the screen widths where scaling starts and stops.
- Copy the clamp() value into your CSS.
Questions and answers
Is my data sent anywhere?
No. Everything runs in your browser on this device. Nothing you paste is uploaded or stored.
How does the value scale?
In a straight line between the two screen widths. Below the first width it stays at the smallest size, and above the second at the largest.
Why is the result in rem?
So the text still grows when someone raises their browser font size. A value in vw alone would ignore that setting.
Related tools
Unicode character inspector
See the code point, type, UTF-8 bytes and UTF-16 units of every character in a piece of text.User agent parser
Read the browser, engine, operating system and device type from any user agent string.Keyboard event inspector
Press any key to see its key, code, keyCode, location and modifiers, as JavaScript receives them.HTTP status codes
Look up any HTTP status code and what it means, from 200 OK to 504 Gateway Timeout.