CSS Clamp() Calculator

Generate fluid CSS values that scale between a min and max with viewport width — no media queries needed.

Max value must be greater than min value, and max viewport must be greater than min viewport.
Generated CSS
clamp(1rem, 0.82rem + 0.48vw, 2rem)
font-size: clamp(1rem, 0.82rem + 0.48vw, 2rem);
—
Minimum
—
Fluid
—
Maximum
Live Preview
Viewport: 900px
The quick brown fox
—
320px Size scales with viewport → 1600px

How CSS clamp() works

clamp(min, preferred, max) is a CSS math function that clamps a value between a lower and upper bound. The preferred value is typically a viewport-relative expression like calc(0.82rem + 0.48vw) that scales with screen width. When the viewport is narrow, the value is clamped to the minimum; when wide, to the maximum.


The clamp() formula

Given a minimum size at a minimum viewport and maximum size at a maximum viewport, the fluid value is:


slope = (maxSize - minSize) / (maxVW - minVW)

intercept = minSize - (slope × minVW)

clamp(minSize, calc(slope × 100vw + intercept), maxSize)


This creates a linear scale between the two size/viewport pairs, clamped at both ends. Use rem units for font sizes to respect user browser zoom settings — this is important for accessibility.

📦 CSS Tools + UIFlow Complete Bundle
Every preset pack + all UI components: 368 snippets in one file. One-time, €19.
✓ Matching set, tested together · ✓ Commercial & client projects OK · ✓ Instant download
€19 →
🎁 Not ready to buy? Get 10 free CSS presets →

Related Tools

Font Scale Generator Typographic scales with perfect ratios and any Google Font Letter Spacing Generator Fine-tune letter spacing, line height and font size CSS Units Converter Convert between px, rem, em, vw, vh, pt, cm and more. Set base font si CSS Typography Playground Design type — 40+ Google Fonts, size, weight, line height, letter spac