CSS clamp() Generator
Enter min/max viewport widths and sizes to instantly generate clamp() for fluid typography, with rem conversion and a live preview.
Settings
rem is recommended for accessibility.
Output clamp()
clamp()
Preview
Computed size: 24px
Fluid typography preview Fluid 123
How to Use
Enter sizes and widths
Enter the min/max sizes (px) and the min/max viewport widths you want to target.
Check the clamp()
The clamp() is calculated instantly as you type. Choose px or rem as the output unit.
Copy and use
Copy the clamp() and paste it into your CSS for font-size, padding, and more.
What is CSS clamp()?
clamp() is a CSS function that takes a minimum, preferred, and maximum value, smoothly scaling between them based on the viewport. Writing font-size: clamp(1rem, 0.5rem + 2vw, 1.5rem) lets you build fluid typography without media queries. This tool computes the preferred value (slope and intercept) for you automatically.
Features
- Real-time calculationThe clamp() is computed instantly as you type. No waiting for results.
- rem conversionSwitch between px and rem based on your root font size for accessible output.
- Live previewUse the viewport width simulator to see the computed size at any screen width.
- Runs in your browserAll calculations run locally. Your input values are never sent to any server.
Use Cases
- Responsive font-size for headings and body text
- Fluid spacing for margins and padding between sections
- Modern CSS with fewer media queries
- Building a typography scale for a design system
- Variable border-radius and gap for buttons and cards
FAQ
Is the CSS clamp() generator free to use?
Should I use px or rem?
How is the preferred (middle) value calculated?
Is my data sent to a server?
Which browsers support clamp()?
Can I use it for properties other than font-size?
Feedback
Missing a feature, or getting a result that looks wrong? Let us know — we improve our tools based on your feedback.