Skip to main content

Fluid Typography Calculator

Generate CSS clamp() for responsive font sizes that scale smoothly between viewport widths.
No media queries needed.

Live Preview

Simulated viewport:1024px
320px1920px

The quick brown fox jumps over the lazy dog

Current size: 19.52px(1.220rem)
Min
16px
Max
24px

Usually 16px (browser default)

font-size: clamp(1rem, 0.5vw + 0.9rem, 1.5rem);
/* Fallback for older browsers */
font-size: 16px;
font-size: clamp(1rem, 0.5vw + 0.9rem, 1.5rem);

Calculation Breakdown

Formula

Slope:(24 - 16) / (1920 - 320)
= 0.005
Y-intercept:16 - (0.005 * 320)
= 14.4px

clamp() Values

Minimum:1rem (16px)
Preferred:0.5vw + 0.9rem
Maximum:1.5rem (24px)

How clamp() Works

The CSS clamp() function takes three values and returns the middle value, clamped between the minimum and maximum.

/* Syntax */
clamp(MIN, PREFERRED, MAX)

MIN

The smallest the font size can be. Used on viewports at or below your minimum viewport width.

PREFERRED

The ideal value that scales with viewport. Combines vw units with a rem offset for smooth scaling.

MAX

The largest the font size can be. Used on viewports at or above your maximum viewport width.

Why Use Fluid Typography?

  • No media queries needed - Font sizes scale smoothly across all viewport widths
  • Better reading experience - Text is always proportional to the screen size
  • Less CSS to maintain - One line replaces multiple breakpoint declarations
  • Respects user preferences - rem units scale with browser font size settings

Browser Support

The clamp() function is supported in all modern browsers (Chrome 79+, Firefox 75+, Safari 13.1+, Edge 79+). For older browsers, use the fallback output which provides a static px value first, then the clamp() value which will be ignored if not supported.

Example Usage

/* Fluid heading */
h1 {
font-size: clamp(2rem, 5vw + 1rem, 4rem);
}
/* Fluid body text */
body {
font-size: clamp(1rem, 0.5vw + 0.875rem, 1.25rem);
}