Skip to content
FluidClamp
Language: English

CSS clamp() Calculator for Fluid Typography

Enter a minimum and maximum size and the viewport range between them. Get a ready-to-paste clamp() value, a live preview and the rendered size at every common breakpoint.

Input unit
Output unit

Common presets

Your clamp() value

clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem)

Slope: 0.8333vw ยท Intercept: 0.8333rem

CSS
clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem)
CSS custom property
--fluid-size: clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem);
Tailwind class
text-[clamp(1rem,0.8333rem_+_0.8333vw,1.5rem)]

Max is 1.5ร— the min โ€“ within the 2.5ร— guideline for WCAG SC 1.4.4 Resize Text.

Rendered size by viewport
ViewportSize (px)Size (rem)
320px161
375px16.461.0286
768px19.731.2333
1024px21.871.3667
1280px241.5
1440px241.5
1920px241.5

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

Live preview

21.87px at a 1024px viewport

Fluid type grows smoothly with the screen.

How this clamp() calculator works

You choose two points: the size you want on the narrowest screen and the size you want on the widest one. The calculator draws a straight line between them and turns it into a single CSS clamp() expression with three parts โ€“ a minimum, a preferred value and a maximum. Below the minimum viewport the value stays at the minimum, above the maximum viewport it stays at the maximum, and in between it scales smoothly without a single media query.

The slope tells you how many pixels the value grows for every pixel of viewport width; it is written in vw units, where 1vw is 1% of the viewport width. The intercept is where that line would cross a zero-width screen. Together they make up the middle argument, for example 0.8333rem + 0.8333vw.

Why the output uses rem

Mixing a rem part into the preferred value keeps fluid text connected to the reader's browser font-size setting. A size built only from vw ignores that preference and can weaken zoom. That is why rem is the default output; px is available if your design tokens are written in pixels, and the root font size field covers projects that change the html font size.

Preview, breakpoints and accessibility

Drag the viewport slider from 320 to 1920 px to see the text at the size it would render at that width. The table lists computed sizes at 320 and 375 px for phones, 768 and 1024 px for tablets, and 1280, 1440 and 1920 px for desktops, so you can confirm that headings are neither cramped on phones nor oversized on wide monitors.

WCAG success criterion 1.4.4 requires that text can be resized to 200% without losing content. Browser zoom also shrinks the viewport measured in CSS pixels, so aggressive fluid type can grow less than expected. A common rule of thumb is to keep the maximum within 2.5 times the minimum, and the calculator warns you when you go beyond it.

Share and export

Every setting is stored in the page URL, so you can bookmark a result or send it to a teammate. Copy the plain clamp() value, a CSS custom property for your :root, or a Tailwind arbitrary class. Need a full set of sizes? Switch to type scale mode to export a modular scale as CSS variables.

Frequently asked questions

What does CSS clamp() do?

clamp(MIN, VAL, MAX) returns VAL but never less than MIN or more than MAX. When VAL contains a viewport unit, the result grows with the screen and stops at your limits. It works in every modern browser.

Is clamp() better than media queries for font sizes?

Media queries change sizes in steps at fixed breakpoints. clamp() scales continuously with one line of CSS and avoids sudden jumps. You can still combine both when a layout really changes at a breakpoint.

Should I use px or rem in clamp()?

Use rem for the minimum, the maximum and the fixed part of the preferred value so text follows the user's font-size setting. The vw part supplies the fluid growth.

Which viewport range should I choose?

Most sites start at 320โ€“375 px, the narrowest phones, and stop at 1200โ€“1440 px, the width where the main content container stops growing. Beyond that, larger text rarely improves readability.

Is anything sent to a server?

No. All math runs in your browser. Vercel Analytics records anonymous, cookieless page views and button events only.