Skip to content
FluidClamp
Language: English

Fluid Typography with CSS clamp(): Guide and Generator

Fluid typography scales text smoothly between a small and a large screen instead of jumping at breakpoints. Use the generator, then read how to choose sizes that stay readable and accessible.

Input unit
Output unit

Common presets

Your clamp() value

clamp(1.125rem, 0.8333rem + 1.4583vw, 2rem)

Slope: 1.4583vw · Intercept: 0.8333rem

CSS
clamp(1.125rem, 0.8333rem + 1.4583vw, 2rem)
CSS custom property
--fluid-size: clamp(1.125rem, 0.8333rem + 1.4583vw, 2rem);
Tailwind class
text-[clamp(1.125rem,0.8333rem_+_1.4583vw,2rem)]

Max is 1.78× the min – within the 2.5× guideline for WCAG SC 1.4.4 Resize Text.

Rendered size by viewport
ViewportSize (px)Size (rem)
320px181.125
375px18.81.1751
768px24.531.5333
1024px28.271.7667
1280px322
1440px322
1920px322

Your settings are saved in the URL, so you can bookmark or share this exact result.

Live preview

28.27px at a 1024px viewport

Fluid type grows smoothly with the screen.

What fluid typography means

Classic responsive type picks a few fixed sizes and swaps them with media queries: 16px on phones, 18px on tablets, 20px on desktop. Fluid typography replaces those steps with a continuous function of the viewport width. With CSS clamp() the whole rule fits on one line, and the browser calculates the right size for every width between your two endpoints.

The formula behind clamp()

A fluid size is a straight line through two points: (min viewport, min size) and (max viewport, max size). The slope is (max size − min size) ÷ (max viewport − min viewport). Multiply it by 100 to get the vw coefficient. The intercept is min size − slope × min viewport. The result is clamp(min size, intercept + slope·100vw, max size). The generator above does exactly this and rounds to the number of decimals you choose.

Choosing good sizes

Body text rarely needs to change much: 16 to 18 or 16 to 20 pixels covers most reading layouts. Headings benefit more from fluid sizing because a 48px headline that looks great on a laptop takes up half a phone screen. Start with your largest heading and work down, keeping the ratio between min and max smaller for smaller text.

Pick the viewport range from your layout, not from device lists. The minimum is usually 320 or 360 px. The maximum is the width where your content container reaches its max-width; past that point the line length no longer grows, so the font size should not either.

Accessibility checklist

Keep min, max and the intercept in rem so user font preferences still apply. Check WCAG 1.4.4 by zooming to 200%: when the maximum is more than about 2.5 times the minimum, zoom may not enlarge text enough, and the tool warns you. Keep line height relative (for example 1.5) so it scales with the font size, and test your longest words on the narrowest screen.

Frequently asked questions

Does fluid typography hurt accessibility?

Not when it is built with rem and a moderate ratio. Problems appear when sizes are pure vw or grow more than about 2.5× between the min and max viewport, because browser zoom then has less effect.

Do I still need media queries?

For font sizes, usually not. Keep media queries for layout changes such as switching from one to two columns.

What browsers support clamp()?

Chrome, Edge, Firefox and Safari have supported clamp() since 2020, so it is safe for production. Older browsers simply ignore the declaration, so you can add a plain fallback size before it.

Should line height be fluid too?

Use a unitless line height such as 1.2 for headings and 1.5 for body text. It then scales automatically with the fluid font size.