Cl
Runs in your browserNothing is uploadedDesign & Color

CSS Clamp Generator

Give a smallest and largest size and the screen widths between them, and get a fluid CSS clamp() value.

Loading tool…
Short answer

CSS Clamp Generator writes a fluid clamp() value that grows in a straight line from your smallest size at one screen width to your largest size at another, and stays fixed outside that range. It uses rem so browser text settings still apply.

What is CSS clamp()?

clamp()

A CSS function with three parts: a minimum, a preferred value and a maximum. The browser uses the preferred value but never goes below the minimum or above the maximum.

Fluid type

When the preferred value mixes rem and vw, text grows smoothly with the screen width instead of jumping at breakpoints. The tool works out the slope and starting point for you.

Why use CSS Clamp Generator?

  • No media queries. One line replaces a stack of breakpoint font sizes.
  • Accessible by design. The rem parts respect the reader's browser text size, which vw alone would ignore.
  • Check the middle. See the size at the midpoint width to confirm the curve feels right.

How to use CSS Clamp Generator, step by step

CSS Clamp Generator in PrintxPDF with a file loaded, options on the right and the run button below
CSS Clamp Generator with a file loaded: the steps below follow this screen.
  1. Enter the sizes in CSS Clamp Generator. The smallest and largest size in pixels.
  2. Enter the screen widths. The viewport width where each size applies, and your root font size.
  3. Copy the CSS line. Use the Copy button on the CSS row. Change the property name for spacing or other values.

Frequently asked questions

Can the size shrink as the screen grows?

Yes. Make the largest size smaller than the smallest and the tool writes a clamp() that decreases with width.

Does it work for spacing as well as fonts?

Yes. Change the CSS property to padding, gap or any length property.

Which browsers support clamp()?

All current versions of Chrome, Edge, Firefox and Safari.

Looking for the long version? The guides cover each of these jobs in depth.