Skip to content
TabKiwiTabKiwi

CSS clamp() Generator

Create fluid CSS clamp() values that scale between two viewport widths, in rem or px.

DesignRuns in your browser. Your files never leave this device.
Loading tool…

About this tool

Set a minimum and maximum value and the viewport widths where each should apply, and get a clamp() that grows linearly in between. It works for any property, including padding, gaps and font sizes. Test the result at any screen width with the slider.

How to use CSS clamp() Generator

  1. Enter the CSS property and the min and max values.
  2. Set the min and max viewport widths.
  3. Choose rem or px output.
  4. Copy the declaration.

Frequently asked questions

How does the clamp() formula work?

The middle value is a straight line through your two points: a fixed part plus a vw part. clamp() keeps the result between your minimum and maximum.

Can the value shrink as the screen gets wider?

Yes. Make the minimum-width value larger than the maximum-width one and the generated vw term becomes negative.

More Design tools

View all 33 →