Skip to content
Start a project

CSS clamp() calculator

One line that scales.

Give a smallest and a largest size, and the screen widths between which the size should grow. The calculator writes the clamp() line for your stylesheet. Free, and it runs in your browser.

Free. No sign-up.

Write the line

Change any field. The line and the preview follow.

The preview shows the size your line gives at this width.

Your lineclamp(1.5rem, 0.7571rem + 3.0476vw, 3.5rem)

39.5pxat 900 px wide

How clamp() works

The line has three parts, and the browser uses the middle one whenever it lies between the other two.

1.5rem0.7571rem + 3.0476vw3.5rem

  1. Smallest.The size never goes below this, however narrow the screen.

  2. Preferred.A fixed part in rem plus a part that grows with the screen. The rem part keeps the size growing when a visitor sets a larger text size in their browser.

  3. Largest.The size never goes above this, however wide the screen.

Need one size in rem?

Let’s build it.

If the website itself is the job, tell us about it. We reply within 24 hours.