Developer
CSS Clamp Calculator
Pick a minimum and maximum size and the screen widths between them โ get a clamp() value that scales smoothly, with no media queries.
Settings
Used on small screens
Used on large screens
Screen width where scaling starts
Screen width where scaling stops
1rem in px โ 16 in every browser by default
How it works
The middle value of clamp() is a straight line: it equals your minimum at the minimum viewport and your maximum at the maximum viewport. Outside that range the value stays fixed.
Generated CSS
font-size: clamp(1rem, 0.8043rem + 0.8696vw, 1.5rem);
Just the value, for a custom property or Tailwind:
Usage example
.element {
font-size: clamp(1rem, 0.8043rem + 0.8696vw, 1.5rem);
}
Live preview
The coloured band shows where the value scales (360px to 1280px).
Computed font-size: 19.55px (1.222rem)
Fluid text
Correct in rem and em
The maths is done in px and converted back, so rem values scale exactly between your two breakpoints.
Live preview
Drag the screen-width slider to see the exact computed size for font size, spacing, width and more.
Copy or download
Copy the full declaration, just the clamp() value, or download a ready-to-use .css file.
Fluid sizes with CSS clamp()
clamp(MIN, PREFERRED, MAX) lets a value grow with the screen while never going below MIN or above MAX. With a preferred value like 0.8rem + 0.9vw, text and spacing scale smoothly from a 360px phone to a wide monitor โ no breakpoints needed.
How to use it
- Choose the CSS property and unit (rem is best for font sizes).
- Enter the smallest and largest value you want.
- Set the screen widths where scaling should start and stop.
- Drag the preview slider to check the result, then copy the CSS.
The formula
slope = (max โ min) รท (maxViewport โ minViewport), intercept = min โ slope ร minViewport. The preferred value is intercept + slope ร 100vw. For rem and em the sizes are converted to px using the root font size first, because vw is always measured in px.
Tips
- Use rem for font sizes. Because the preferred value keeps a rem part, text still grows when people zoom in, which helps with accessibility (WCAG 1.4.4 Resize Text).
- Keep the ratio between max and min modest (for body text, around 1.25ร) so text stays readable.
- Percent units aren't offered because a percentage depends on the parent element, so there's no single correct conversion to
vw.
Private by design. Everything runs in your browser โ nothing you enter is uploaded or stored by AISeekho.