font-size: clamp(1rem, 0.6087rem + 1.7391vw, 2rem);Live Preview (resize your window)
The quick brown fox
100% Private
The clamp value is generated locally in your browser. Nothing uploaded.
CSS Clamp Generator builds a responsive clamp() value from a min size, max size, and viewport range. Create fluid typography and spacing with copyable CSS instantly.
Written & reviewed by Helperzy Editorial Team · Updated July 2026
font-size: clamp(1rem, 0.6087rem + 1.7391vw, 2rem);Live Preview (resize your window)
The quick brown fox
100% Private
The clamp value is generated locally in your browser. Nothing uploaded.
Enter the smallest size that stays readable on a narrow phone and the largest that still looks sensible on a wide monitor. These become the two clamp bounds.
Set the viewport widths where scaling starts and stops, commonly 320px and 1280px. The maximum must be larger than the minimum or the slope has no range to work across.
Copy the generated declaration into your CSS, preferring the rem output so browser zoom and user font settings are respected. Test the result at 320px on a real device.
The CSS clamp function takes three arguments, a minimum, a preferred value and a maximum, and returns the preferred value unless it strays outside the bounds. Put a viewport unit in the middle argument and you get a size that scales continuously with the window while never becoming unreadable on a phone or absurd on an ultrawide monitor. This generator builds that expression from four plain numbers: the smallest size you want, the largest, and the viewport widths between which the scaling should happen. Front-end developers building fluid typography, designers specifying a type scale that works on every screen, and anyone tired of maintaining five breakpoints for one heading all use it. The interesting part is the middle argument, and the generator does the algebra. Between your two viewport widths the size should change linearly, so the slope is the size difference divided by the viewport difference. Multiply that slope by 100 and you have the vw coefficient. The line also needs an intercept, because a pure vw value would pass through zero rather than through your minimum at your chosen breakpoint, so the preferred value comes out as a fixed offset plus a vw term. Outside the range the clamp bounds take over: below your minimum viewport the minimum size holds flat, above your maximum viewport the maximum holds flat. Choosing rem for the min, max and offset rather than px means a user who raises their browser font size scales the whole thing, which is the accessible default. Do the arithmetic. Say you want a heading at 24px on a 320-pixel phone growing to 48px at 1280 pixels. The size range is 24px across a viewport range of 960 pixels, so the slope is 24 divided by 960, which is 0.025, giving a coefficient of 2.5vw. The intercept is 24 minus 0.025 times 320, which is 16px, or exactly 1rem. The finished declaration is clamp(1.5rem, 1rem + 2.5vw, 3rem). Check it at three widths: at 320 pixels the middle term is 16 plus 8 equals 24px, matching your minimum; at 800 pixels it is 16 plus 20 equals 36px, a smooth midpoint; at 1280 pixels it is 16 plus 32 equals 48px, hitting your maximum exactly. Real uses. A developer replaces four media queries on an h1 with one clamp declaration and deletes twelve lines of CSS in the process. Someone building a marketing page uses clamp for section padding so the vertical rhythm tightens on mobile without needing a separate mobile stylesheet. A design system author defines a whole type scale as clamp values, so every heading level is fluid and the ratios between them hold at any width. A developer sizing a card grid gap uses clamp so the layout feels generous on a desktop monitor and compact on a phone. A team fixes an ultrawide bug where a hero title had grown to 96px. Two points to watch. Pure vw sizing without a clamp is the mistake this function exists to fix: a heading set to 5vw is 72px on a laptop and 19px on a phone, effectively unreadable, and clamping it solves that in one line. Second, be careful with the minimum: if your minimum is too large the text will never scale at all on small screens, and if the offset is negative the value can behave unexpectedly at very narrow widths, so test the low end on a real 320-pixel viewport rather than trusting the numbers. Also remember clamp respects browser zoom properly only when the min and max use rem. Support is universal in current browsers. All calculation runs in your browser and nothing is uploaded.
Input
Min 24px, max 48px, scaling between viewports of 320px and 1280px, root font 16px
Result
font-size: clamp(1.5rem, 1rem + 2.5vw, 3rem);
The 24px size range over a 960px viewport range gives a slope of 0.025, so 2.5vw, and the intercept is 24 minus 0.025 times 320, which equals 16px or 1rem.
Input
Checking that same declaration at three viewport widths
Result
320px gives 24px, 800px gives 36px, 1280px gives 48px
16 plus 2.5 percent of the width yields exactly the minimum at the low breakpoint, a smooth midpoint at 800px, and exactly the maximum at the high breakpoint.
clamp() takes three values — a minimum, a preferred value, and a maximum — and returns the preferred value unless it is smaller than the minimum or larger than the maximum, in which case it returns the limit. Combined with a vw unit in the preferred value, it lets a size scale fluidly with the viewport while never going outside your chosen bounds.
UUID Generator creates random UUIDs (v4) and GUIDs online for free. Generate unique identifiers instantly for databases, APIs, and development. No signup needed.
Image to Base64 Converter encodes any image into a Base64 data URI online for free. Get ready-to-use CSS and HTML code in your browser.
JSON to YAML Converter changes JSON into clean YAML instantly online for free. Validate and convert config data in your browser with no upload.
Cron Expression Generator builds and explains cron schedules online for free. Create cron expressions with a plain-English description in your browser.
Image Resizer changes image dimensions online — set exact pixels, use percentage scaling, or pick from 12 presets (Instagram, Passport, YouTube, etc.). Target specific file sizes like 50KB or 100KB. Batch resize multiple images. 100% free, browser-based.
Image Converter changes images between any format online free — JPG, PNG, WebP, AVIF, PDF, ICO, BMP, HEIC, GIF, SVG. Batch conversion, resize, rotate, flip, AI format recommendation. 100% browser-based, no upload.
Convert JPG to WebP format online free — reduce image file size by 25-35% with identical visual quality. Batch conversion, adjustable quality, lossless mode available. Boost website speed and Core Web Vitals scores. 100% browser-based, no upload needed.
Convert PNG to WebP format online free — reduce file size by 26-34% while preserving full transparency. Batch conversion, lossless and lossy modes, adjustable quality. Boost website performance and Core Web Vitals. 100% browser-based, no upload needed.