CSS Clamp Generator
Create fluid font sizes with the CSS clamp() function.
Create fluid font sizes with the CSS clamp() function. Free, instant and private in your browser.
Loading the interactive tool… This page needs JavaScript to run the CSS Clamp Generator.
How to use CSS Clamp Generator
- Choose your colors or values.
- Preview the result live.
- Tweak until it looks right.
- Copy the CSS or code into your project.
How CSS Clamp Generator works
Enter the smallest and largest font size in pixels and the viewport widths where scaling should start and stop. The tool computes a linear slope between the two points and writes a font-size clamp() with a rem minimum, a rem plus vw preferred value, and a rem maximum, all based on 16 pixels per rem. The maximum viewport must be larger than the minimum viewport, and the maximum size cannot be below the minimum.
Worked example
Input min 16px, max 32px, viewport 375px to 1280px → Output font-size: clamp(1rem, 0.5856rem + 1.768vw, 2rem); which grows smoothly between those two widths.
Common uses
- Setting fluid heading sizes without writing many media queries.
- Making body text scale slightly between phone and desktop widths.
- Calculating the middle value of clamp() instead of working out the slope by hand.
Best for
- web and UI design
- front-end development
- quick visual experiments
Tips for better results
- Use rem units so zoom and user settings still work.
- Check color contrast for accessibility.
- Test designs on light and dark backgrounds.
- Keep a copy of final values in your design system.
Frequently asked questions
What does clamp() do?
It picks a value between a minimum and maximum that scales with the viewport.
Is my data sent to a server?
No. This tool runs in your browser, so what you enter stays on your device.
Do I need an account to use CSS Clamp Generator?
No account or sign-up is needed. Just open the tool and use it.
Related tools
- CSS Border Radius Generator — Design rounded corners per corner and copy the CSS.
- CSS Gradient Generator — Create linear and radial CSS gradients with ready-to-copy code.
- CSS Text Shadow Generator — Build CSS text shadows with a live preview.
- Glassmorphism CSS Generator — Create frosted-glass CSS with blur, transparency and border.
- Box Shadow Generator — Design CSS box shadows visually and copy the code.
- Color Palette Generator — Generate harmonious color palettes from a base color.