ToolHub

CSS clamp() Generator

Generate responsive clamp() code from size and viewport ranges for fluid typography—no media queries needed. Everything runs in your browser.

Input
Output
clamp() value
clamp(1rem, 0.884vw + 0.7928rem, 1.5rem)
Usage
font-size: clamp(1rem, 0.884vw + 0.7928rem, 1.5rem);

FAQ

How does clamp() work?

clamp(min, preferred, max) uses the preferred value bounded by min/max. A 'vw + rem' linear expression makes size scale with viewport width.

How are the vw slope and rem intercept derived?

It's the line through (minViewport, minSize) and (maxViewport, maxSize): slope × 100 becomes the vw factor; the intercept converts to rem at 16px.

Why rem instead of px?

rem respects the user's browser font-size setting. Pure vw ignores zoom and accessibility preferences, which can violate WCAG.

Related tools