Fluid Typography (Clamp)

Generate fluid font sizes and spacing using the CSS `clamp()` function. Automatically calculates the ideal slope between two viewport breakpoints.

Fluid Scale Preview

Sample Text Scaling

Resize your browser window to see the text scale smoothly between your set boundaries.

font-size: clamp(1.0000rem, 0.3333rem + 3.3333vw, 3.0000rem);

About the CSS Clamp Generator

Enter the smallest and largest font size you want and the viewport widths where each should apply, and get a clamp() rule that scales smoothly between them.

Everything you enter is processed in your browser; nothing is uploaded or stored.

How to use it

  1. Enter the minimum and maximum font size in px.
  2. Enter the minimum and maximum viewport widths in px (for example 360 and 1280).
  3. Copy the generated font-size: clamp(…) rule.

The clamp() formula

slope = (max size − min size) ÷ (max viewport − min viewport)

preferred value = (min size − slope × min viewport) in rem + (slope × 100) vw

clamp(min, preferred, max) uses the preferred value but never goes below the minimum or above the maximum. The tool converts pixel sizes to rem (÷ 16) so the result respects the reader’s browser font-size setting.

Example

16 px at 360 px wide growing to 24 px at 1280 px wide gives roughly font-size: clamp(1rem, 0.8043rem + 0.8696vw, 1.5rem).

Frequently asked questions

Is clamp() supported in all browsers?

Yes, every current browser supports it.

Why use rem instead of px?

rem scales with the user’s default font size, which matters for accessibility.

Can I use clamp() for spacing too?

Yes – padding, margins and gaps work the same way.