Fluid typography clamp() calculator
Generate a CSS clamp() from min and max sizes and a viewport range.
FreeRuns in your browserNo signupUpdated 2026-10-29
The size stays at the minimum below the smallest viewport and at the maximum above the largest.
Slope
1.522vw
px gained per 100px of viewport, as vw
Intercept
12.52px
The fixed part of the calc()
Growth
1.78×
18px to 32px
h1 {
font-size: clamp(1.125rem, calc(0.7826rem + 1.5217vw), 2rem);
}text-[clamp(1.125rem,_0.7826rem_+_1.5217vw,_2rem)]
Size at common viewports
| Viewport | Font size | In rem |
|---|---|---|
| 320px | 18.0px | 1.125rem |
| 375px | 18.2px | 1.1393rem |
| 768px | 24.2px | 1.513rem |
| 1024px | 28.1px | 1.7565rem |
| 1280px | 32.0px | 2rem |
| 1536px | 32.0px | 2rem |
| 1920px | 32.0px | 2rem |
Preview
Resize the window to see this heading scale.
About this tool
How it works and how to read the result.
Need this done for you?
Website design & development
Company websites designed and built to win trust and enquiries.
See the serviceWhat it does
A clamp calculator for CSS font sizes takes the smallest and largest size you want, plus the viewport widths where each should apply, and writes one clamp() value that scales smoothly between them. Below the smallest viewport the text stays at the minimum. Above the largest it stops at the maximum. In between it grows in a straight line. The limits are written in rem so the text still respects a reader's browser font setting, and a table shows the size you get at common screen widths.
How to use it
- Enter the minimum and maximum font size in pixels.
- Enter the viewport widths where those sizes should apply. 360px and 1280px cover most phones and laptops.
- Leave the root size at 16 unless your CSS changes the font size on
html. - Copy the
clamp()rule or the Tailwind class. - Check the table to see the size at each common breakpoint, and resize the window to watch the preview scale.
How to read the result
With the defaults, 18px at 360px wide rising to 32px at 1280px, the output is clamp(1.125rem, calc(0.7826rem + 1.5217vw), 2rem).
The first and last values are the floor and ceiling: 18px and 32px divided by 16. The middle is the straight line between your two points. The slope is (32 − 18) ÷ (1280 − 360), or 0.0152, which as a viewport unit is 1.5217vw: the text gains about 1.5px for every 100px of screen width. The intercept, 0.7826rem or 12.52px, is where that line would meet a zero-width screen. Add the two and you get the size at any width. At 768px that is 12.52 + 0.0152 × 768, or 24.2px, which matches the table.
The growth figure, 1.78× here, shows how much the text changes between the extremes. Keep body text well under 2×. Large ratios make zooming unreliable, because the vw part does not grow when someone zooms in.
Build a full set of related sizes with the type scale generator. For a site designed with fluid type from the start, see our website design and development service.
Questions
Frequently asked.
Why use rem in clamp() instead of px?
Rem values scale with the reader's browser font setting and px values do not. If someone sets their default text to 20px, a rem floor and ceiling grow with it. The vw part never responds to that setting, which is why the intercept is in rem too, so part of the middle value still scales.
What viewport range should I use?
Use the narrowest screen you design for as the minimum, usually 320 to 375px, and the width where your layout stops growing as the maximum, often 1200 to 1440px. Above the maximum the text stays fixed, which is what you want once the content column has a max-width.
Is fluid type bad for accessibility?
Not if the range is modest. WCAG 1.4.4 asks that text can be zoomed to 200%. Because vw units ignore zoom, a size that is mostly vw may not double. Keep the maximum under about 2.5 times the minimum and keep a rem intercept, and zoom works as expected.
Your next move
Like what you see? Tell us about it.
A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.
India · Working with clients worldwide