CSS • Responsive Design

CSS Clamp Generator

Build responsive clamp() values for typography, spacing, widths, and border radius. Set a minimum size, maximum size, and viewport range — then copy ready-to-paste CSS instantly.

Output
clamp()

Copy a valid CSS declaration in one click.

Viewport-aware
320 → 1440

Works for mobile-first and desktop scaling ranges.

Units
px / rem

Choose the output unit that matches your design system.

Best for
Fluid UI

Great for headings, gaps, padding, widths, and corner radius.

Popular presets

Start with a common fluid pattern.

Generator inputs

Choose the CSS property, output unit, and viewport range you want to scale across.

Selected property use case

Fluid typography for headings, body text, and UI labels.

Generated clamp()

Copy the expression only or the full CSS declaration.

Expression
clamp(16px, 10.6667px + 1.6667vw, 32px)
CSS declaration
font-size: clamp(16px, 10.6667px + 1.6667vw, 32px);
Example block
.demo {
  font-size: clamp(16px, 10.6667px + 1.6667vw, 32px);
}

Viewport samples

See the calculated size at common breakpoints. Values clamp below and above your configured viewport range.

320px viewport
16px
375px viewport
16.916667px
768px viewport
23.466667px
1024px viewport
27.733333px
1280px viewport
32px
1440px viewport
32px
Preview
Fluid heading sample
Build once, scale smoothly

This sample applies your generated declaration directly to the heading element.

How the math works

clamp(min, preferred, max) lets the browser scale values fluidly while keeping hard limits.

Preferred value
clamp(16px, 10.6667px + 1.6667vw, 32px)
Linear interpolation formula
font-size = 16px + (16px / 960px) * (100vw - 320px)
Slope
1.6667vw
Intercept
10.6667px

Clamp best practices

1. Pick realistic min and max values

Start from real design tokens or Figma values rather than guessing arbitrary numbers.

2. Use rem for design systems

rem-based output often works better when your typography and spacing already depend on root font size.

3. Keep viewport ranges intentional

A 320px to 1280px range is a good default, but align it with your actual product breakpoints.

4. Clamp more than text

Fluid spacing, width, and radius values can make interfaces feel more polished without many media queries.