CSS Clamp Calculator

NEW

Calculate fluid CSS clamp() values

FreeNo sign-upColor & CSS Tools →

CSS Clamp Calculator generates a clamp() expression for fluid sizing. Enter the minimum and maximum size in pixels and the viewport widths at which each should apply; the tool calculates the slope and intercept and writes a value such as clamp(1rem, 1.6667vw + 0.6667rem, 2rem).

The result scales smoothly between the two viewport widths and stops at the limits outside them. Sizes are output in rem, assuming a 16 pixel root, so text still responds to the user's browser font setting.

Advertisement

How to use CSS Clamp Calculator

1

Enter min and max size

In pixels, for example 16 and 32.

2

Enter the viewport range

For example 320 to 1280 pixels.

3

Copy the clamp()

Use it for font-size, padding or gap.

Use Cases

  • Fluid headings that need no media queries
  • Section padding that grows with the screen
  • Building a responsive type scale

Frequently Asked Questions