CSS Clamp / Responsive Font Size Generator
Last updated: What’s new
Generate fluid typography and spacing with CSS clamp(). Set a min and max size and your viewport range, then copy a clamp() value that scales smoothly across every screen, no media queries needed.
The quick brown fox jumps over the lazy dog.
Runs in your browser. Nothing is uploaded.
Referral reward
Know a business that needs a website or SEO?
Introduce them and earn a referral reward. They work with us directly, and we handle the proposal, delivery and support.
Know a business that needs a website or SEO?
Introduce them and earn a referral reward. They work with us directly, and we handle the proposal, delivery and support.
Projects: 10%, at least $100
Monthly services: 10% for the first six months
A $1,999 website earns you about $200. A $999 a month SEO plan earns about $600 over six months.
Your introduction message
This reference credits the introduction to you:
Email me the referral details
More options Send us this result or get a copy by email
Know a business that needs a website or SEO?
Introduce them and earn a referral reward. They work with us directly.
- Projects: 10%, at least $100
- Monthly services: 10% for the first six months
Your introduction message
This reference credits the introduction to you:
Email me the referral details
How Fluid Type Is Calculated
- Two anchor points, your min size at the min viewport and max size at the max viewport.
- Find the slope, the change in size divided by the change in viewport width gives a vw value.
- Find the intercept, a fixed rem term keeps text zoomable and accurate.
- Wrap in clamp(), the min and max bounds stop the size going too small or too large.
Why Fluid Type Helps
- Fewer media queries, one clamp() replaces several breakpoint rules.
- Looks right everywhere, type scales continuously instead of jumping.
- Accessible, a rem component keeps text zoomable for users who need it.
- Cleaner CSS, less code to maintain and fewer edge cases to test.
Fluid typography is one of the techniques we lean on in our web design services to build sites that look sharp on every screen without a pile of breakpoints to maintain.
CSS clamp() Reference
The clamp() function takes three arguments in the form clamp(MIN, PREFERRED, MAX). The browser uses the preferred value but never lets it fall below the minimum or rise above the maximum.
| Part | Role | Example |
|---|---|---|
| MIN | The smallest value allowed. The result never goes below this on small screens. | 1rem |
| PREFERRED | The target value, usually a rem plus vw formula so it scales with the viewport. | 0.5rem + 2vw |
| MAX | The largest value allowed. The result never goes above this on wide screens. | 2rem |
Put together, that example reads clamp(1rem, 0.5rem + 2vw, 2rem): it stays at 1rem on narrow screens, scales fluidly in the middle, and locks at 2rem once it gets large.
Fluid Typography Examples
Starting points for a fluid type scale between a 360px and a 1280px viewport: each value is at its minimum at 360px and reaches its maximum at 1280px. Tune the numbers in the generator above to fit your design.
| Use case | clamp() value |
|---|---|
| Hero heading (H1) | clamp(2rem, 1.2174rem + 3.4783vw, 4rem) |
| Section heading (H2) | clamp(1.5rem, 1.1087rem + 1.7391vw, 2.5rem) |
| Subheading (H3) | clamp(1.25rem, 1.0543rem + 0.8696vw, 1.75rem) |
| Body text | clamp(1rem, 0.9511rem + 0.2174vw, 1.125rem) |
| Lead paragraph | clamp(1.125rem, 0.9783rem + 0.6522vw, 1.5rem) |
| Section padding | clamp(2rem, 0.4348rem + 6.9565vw, 6rem) |
| Grid gap | clamp(1rem, 0.413rem + 2.6087vw, 2.5rem) |
Building a consistent fluid type scale by hand is fiddly. If you would rather hand it off, our web design services ship responsive, accessible design systems that look sharp on every device.
What’s new
-
The fluid typography examples are now generated with the tool itself, so each reaches its maximum at 1280px.
Next steps
CSS Clamp Generator related tools and articles
The closest follow-up checks and guides for this tool.