How to use the fluid typography calculator
- Set the smallest and largest sizes. Choose the font size you want on a small phone and the size you want on a large desktop screen.
- Set where scaling starts and stops. Below the start width the text stays at the smallest size. Above the stop width it stays at the largest size.
- Check your root font size. The output uses rem units so it respects the user's browser font settings. Most sites use a 16px root size.
- Preview and copy. Drag the preview screen width to see the size at any width, then copy the font-size rule.
What is fluid typography?
Fluid typography makes text scale smoothly with the width of the screen instead of jumping between fixed sizes at breakpoints. Headings stay proportionate on every device without a stack of media queries.
How clamp() works
clamp(min, preferred, max) uses the preferred value but never goes below the minimum or above the maximum. The preferred value combines a rem amount with a vw amount, so it grows at a steady rate as the screen gets wider. The calculator works out the slope between your two points.
Accessibility
Using rem for the minimum and maximum, and adding a rem term to the preferred value, means text still responds when a user increases their browser font size or zooms. Pure vw font sizes do not, which fails WCAG's resize text requirement.
Using it in WordPress, Elementor, Divi, Bricks and Breakdance
Choose your page builder from Paste into, above the code, and Refract rewrites the CSS for it. Elementor Pro and Divi 5 use the selector keyword, Bricks uses %root% and Breakdance uses %%SELECTOR%%, so the effect only applies to the element you paste it into. Elementor’s newer V4 atomic elements (Heading, Image, Button, Div block) work differently: their Custom CSS sits inside the element’s own style, so Refract splits the code into a part for the element and a part for your site-wide CSS. For the WordPress block editor, free Elementor and Divi 4, you add a CSS class to the element and paste the CSS into your site’s custom CSS. The numbered steps under the code show exactly where to click, and Refract remembers your builder for every tool.
Frequently asked questions
Is clamp() supported everywhere?
Yes. clamp() works in all current browsers.
Should I use fluid type for body text?
It is most useful for headings. Body text usually works best with a small range, for example 16px to 18px, or a fixed size.
Why is the output in rem instead of px?
rem values scale with the user's browser font settings, which is better for accessibility.
Can I use this in Elementor, Divi or Bricks?
Yes. Choose your page builder under Paste into, above the code. The CSS is rewritten for that builder, and the steps underneath tell you exactly where to paste it. WordPress’s block editor and Breakdance are supported too.