CSS clamp() Generator

Fluid font sizes and spacing that scale smoothly between two viewport widths — no media queries

Generated value

font-size: clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem);

Below 320px it stays at 16px; above 1280px it caps at 24px; in between it scales linearly with the viewport.

How it works

  • clamp(MIN, PREFERRED, MAX) returns PREFERRED, bounded by MIN and MAX
  • • The preferred value is a line: y-intercept + slope·vw
  • slope = (maxSize − minSize) / (maxVw − minVw)
  • • Using rem for the fixed part keeps it responsive to user font-size settings
Share this tool