CSS Clamp Generator
Create fluid CSS clamp() values for font sizes, spacing and widths that grow smoothly between a phone and a desktop screen, in rem or px, with a live preview.
Create fluid CSS clamp() values for font sizes, spacing and widths that grow smoothly between a phone and a desktop screen, in rem or px, with a live preview.
Used CSS Clamp Generator? Share how it went to help others.
About this tool
CSS Clamp Generator writes a clamp() value that makes a size grow smoothly with the screen instead of jumping at breakpoints. Enter the size you want on small screens and on large screens, and the two screen widths where growth should start and stop, for example 18px at 360px wide and 32px at 1280px wide. The tool works out the straight line between those points and writes it as clamp(minimum, preferred, maximum), where the preferred value combines a fixed part and a vw part. Below the small width the value stays at the minimum, and above the large width it stays at the maximum, so text never becomes tiny on a narrow phone or huge on a wide monitor. Choose the property (font-size, padding, margin, gap, width, max-width or border-radius) and the output unit. rem is recommended because it respects the visitor’s own browser text size; the root font size is 16px unless your site changes it. You can also give the value a CSS variable name, such as --step-1, to reuse it across a design system. A slider previews the result at any screen width from 280 to 1920 pixels, and a table shows the exact computed value on a phone, a tablet, a small laptop and two desktop widths. If you enter a larger size for small screens than for large ones, the value shrinks as the screen grows, which also works. Mistakes are caught: the large screen width must be bigger than the small one. For font sizes, the tool warns when the large size is more than two and a half times the small one, because text that grows mostly with screen width may not reach 200% when people zoom in, which can fail WCAG success criterion 1.4.4. Everything is calculated in your browser.

Font size, padding, margin, gap or width.
The size on small screens and on large screens.
Where growing starts and stops, such as 360 to 1280px.
Paste the clamp() value or CSS variable into your stylesheet.
One line replaces several media queries.
rem keeps the visitor’s text size setting working.
See the size at any screen width.
Exact sizes on phone, tablet and desktop.
Smooth from phone to desktop
Big on desktop, still readable on phones.
Exampleh1 from 28px on a 360px phone to 56px at 1280px.
Padding that shrinks on small screens.
ExampleSection padding from 24px to 96px.
A fluid type scale as CSS variables.
Example--step-0 to --step-5 for every text size.
Gaps and widths that adapt without media queries.
Examplegap from 12px to 32px across all screens.
Smooth, readable, accessible
Body text needs only a small range, such as 16 to 18px.
Zoom to 200% on a wide screen and check text still grows.
Use your real smallest and largest container widths.
Senior Software Engineer · Developer of Toolyconvert
Hemant developed CSS Clamp Generator and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.
Last updated 24 November 2026
Featured on
Toolyconvert is listed on these product directories and launch platforms.