How to use the Fluid Font Size (clamp) Generator
- Enter the smallest and largest font size.
- Enter the viewport widths where scaling starts and stops.
- Copy the clamp() value.
What does this tool do?
clamp(min, preferred, max) keeps a value between limits. With a preferred value that combines rem and vw, text grows smoothly between two screen sizes instead of jumping at breakpoints.
Why use it?
- Fewer media queries.
- Smooth, consistent typography.
- Accessible rem-based output.
Use cases
- Fluid headings that scale between phone and desktop.
- Responsive spacing and gaps.
- Fewer media queries in a design system.
Example
16px at 375px wide to 24px at 1280px wide: font-size: clamp(1rem, 0.7928rem + 0.884vw, 1.5rem);
Common mistakes
- A maximum so large that headings dominate wide screens.
- Using only vw, which ignores users' font settings.
- Mixing px and rem inconsistently across the scale.
The formula
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
Do all browsers support clamp()?
Yes. clamp() has been supported by all major browsers since 2020.
Why use rem for the minimum and maximum?
rem respects the reader's browser font-size setting. Sizes based only on vw ignore that setting and don't grow when people zoom in on some devices, which can fail accessibility requirements.
Can I use clamp for spacing?
Yes, any length works, such as padding, margin and gap.
Which viewport widths should I use?
Commonly about 360–400 px for the minimum and 1200–1440 px for the maximum.
Content last updated . See how M2Toolkit works.