1. Home
  2. Fluid sizes

Fluid typography calculator for clamp()

Set the minimum and maximum viewport and text size: the calculator builds clamp() and a scale of steps.

Current size—
Fluid text: Ґеній and Єнот ate lunch.

CSS custom properties

Scale table

StepminmaxAa

How the formula works

clamp(min, preferred, max) picks a value between two limits. The preferred value is linear in the viewport width: intercept + slope × 100vw. The calculator derives them so that the size equals the minimum at the minimum viewport and the maximum at the maximum viewport.

Why rem is part of the preferred value

With vw alone the user cannot enlarge text with browser zoom. Adding a rem component keeps the text responsive to browser settings, which matters for WCAG 1.4.4.

The scale

Besides the base step the calculator produces steps above and below it with the ratio you choose, from 1.125 for a restrained scale to 1.5 for a bold one. Copy the variables into :root and use them for headings, captions and spacing.

Test the result at 200 % zoom and on a 320 px screen: fluid sizes must not break the layout.