CSS Clamp Generator Formatter🔒 100% local
Generate responsive clamp() values. Privacy-first, no server uploads, no tracking.
Builds a font-size: clamp(...) declaration from two or three comma-separated values. With three values they are copied straight into clamp(min, preferred, max) as typed. With two pixel values it computes the linear slope between a 320px and a 1200px viewport, writes the middle term as vw units plus a rem offset, and prints a short explanation of how the clamp behaves. No preview is rendered and the values are not stored - the CSS string and its notes are the whole output.
How to use it
- Enter either three values (min, preferred, max) or two pixel values (min, max) in the input box.
- Press Process. The declaration is printed under === CSS clamp() ===, ready to paste.
- If you gave two values, read the middle term as slope + offset: the vw part grows with the viewport and the rem part holds the starting size.
- Copy Output keeps the declaration and the explanation.
Worked example
1rem, 2vw, 3rembecomes=== CSS clamp() ===
font-size: clamp(1rem, 2vw, 3rem);Three values are passed through unchanged; the explanation below the declaration is fixed text in both modes.
16px, 32pxbecomesfont-size: clamp(1rem, 1.82vw + 0.64rem, 2rem);Computed by the tool's own maths: slope is (32-16)/(1200-320) = 0.01818, written as 1.82vw, and the offset is 16 - 0.01818 x 320 = 10.18px, rounded to 0.64rem.
8px, 40pxbecomesfont-size: clamp(0.5rem, 3.64vw + 0.23rem, 2.5rem);A real output and a real defect: here the offset is negative, 8 - 0.03636 x 320 = -3.64px, but the plus sign is hard-coded, so this clamp grows slightly faster than asked.
When to use it
- Replacing a set of font-size media queries with a single fluid declaration.
- Getting the vw-plus-rem middle term for a size pair without working the slope out by hand.
- Producing a starting clamp() to hand-tune after checking it in the browser.
What it does not do
- Three values are not validated at all. 'foo, bar, baz' is accepted and printed as clamp(foo, bar, baz).
- A negative offset is printed with a plus sign, so a two-value input whose slope line crosses zero below the 320px mark produces a declaration that is subtly wrong - see the 8px, 40px example above.
- Two-value mode demands px on both sides: '1rem, 3rem' is refused with an error telling you to use px or supply a preferred value.
- The fluid band is fixed to 320px-1200px viewports, so the range cannot be retuned, and the printed explanation describes that window even when you supplied your own preferred value.