Skip to content
Sizes and screen widths → clamp()Developer tools

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.

Did this tool work for you?

Used CSS Clamp Generator? Share how it went to help others.

About this tool

About CSS Clamp Generator

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.

CSS Clamp Generator tool

Where fluid sizes help

Smooth from phone to desktop

Headings

Big on desktop, still readable on phones.

Exampleh1 from 28px on a 360px phone to 56px at 1280px.

Section spacing

Padding that shrinks on small screens.

ExampleSection padding from 24px to 96px.

Design systems

A fluid type scale as CSS variables.

Example--step-0 to --step-5 for every text size.

Cards and grids

Gaps and widths that adapt without media queries.

Examplegap from 12px to 32px across all screens.

Fluid sizing tips

Smooth, readable, accessible

Keep body text steady

Body text needs only a small range, such as 16 to 18px.

Test browser zoom

Zoom to 200% on a wide screen and check text still grows.

Match your layout

Use your real smallest and largest container widths.

Need a gradient too?

Build backgrounds visually.

CSS Gradient Generator
Built & tested by

HemantInsights

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

Answers and guidanceFrequently Asked Questions
What does clamp() do?
clamp(min, preferred, max) uses the preferred value but never goes below the minimum or above the maximum. With a vw part in the preferred value, the size grows with the screen width.
Why use rem instead of px?
rem scales with the visitor’s browser text size. If someone sets larger text in their browser, rem-based sizes grow with it; px sizes do not.
Is clamp() supported in all browsers?
Yes. All current versions of Chrome, Edge, Firefox and Safari support it, including on phones.
Can a value shrink as the screen gets wider?
Yes. Enter a larger size for small screens than for large screens and the preferred value uses a negative vw part.
Why is there a zoom warning?
Text sized mostly in vw does not grow when people zoom, because zooming also shrinks the viewport in CSS pixels. Keeping the range modest and using rem helps text reach 200%.
What root font size should I use?
16px, the browser default, unless your stylesheet sets a different size on the html element.
More tools for your workflowRelated Tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.