I built this calculator to turn one size from your design into a CSS clamp() value. Pick a property, pick your design width (1280, 1440 or 1920px), and enter the desktop size in px. Add a mobile size if you have one, or leave it blank and the tool picks a sensible one for you. You get a line of CSS with rem limits and a vw middle value, ready to paste.
clamp() takes three values: a minimum, a preferred value and a maximum. Here the preferred value is your desktop size divided by your design width, in vw. That means the size hits your desktop value at exactly your design width and shrinks with the screen until it reaches your mobile value. Below that point it stays at the mobile size.
Convert px → rem + clamp() · 1440px design system
Enter each side in px. Leave blank to skip.
Worked example: a 48px heading on a 1440px design, 32px on mobile
Inputs: Property font-size, Design width 1440px, Max 48, Min 32, Base font 16.
Output: font-size: clamp(2rem, 3.3333vw, 3rem);
At 1440px wide the heading is 48px. At 1200px it is 40px (1200 × 3.3333 ÷ 100). At 960px and narrower it stays at 32px, because 960 × 3.3333 ÷ 100 = 32.
Leave Min blank and the tool picks 34px (70% of 48, rounded), so you get font-size: clamp(2.125rem, 3.3333vw, 3rem);, which stops shrinking at 1020px.
FAQ
clamp() sets a CSS value that scales fluidly between a defined minimum and maximum based on the viewport width, replacing multiple media queries with one line of CSS.
Choose a property, choose your design width, and enter your desktop size in px. Add a mobile size or leave it blank, then press Generate clamp() and copy the CSS.
Pick the width of your Figma or XD frame. If you’re unsure, 1440px is a safe default, and 1920px suits wide layouts.
Yes. It’s free, needs no sign-up, and runs in your browser.