Skip to main content

CSS Clamp Calculator

Generate fluid typography and responsive spacing with CSS clamp().
Set min/max values and let the calculator create the formula.

Preview at 768px viewport24.1px

The quick brown fox

320px1200px

Size at smallest viewport

Size at largest viewport

Typically 320px (mobile)

Typically 1200px or 1440px (desktop)

font-size: clamp(16px, 10.1818px + 1.8182vw, 32px);

How CSS clamp() Works

The clamp() function takes three values: a minimum, a preferred (fluid) value, and a maximum.

clamp(MIN, PREFERRED, MAX)
  • MIN:The smallest the value can be (floor)
  • PREFERRED:A fluid value using viewport units (vw) that scales between min and max
  • MAX:The largest the value can be (ceiling)

Common Use Cases

Fluid Typography

Scale font sizes smoothly between mobile and desktop without media queries.

Responsive Spacing

Create padding and margins that adapt to viewport size.

Flexible Widths

Set element widths that grow and shrink within bounds.

Grid Gaps

Scale gaps in flex and grid layouts for better responsiveness.

Browser Support

CSS clamp() is supported in all modern browsers since 2020.

Chrome 79+Firefox 75+Safari 13.1+Edge 79+