Fluid type clamp generator
Calculate CSS clamp() for a font size that grows between two viewport widths, with rem bounds and an adjustable root-size assumption.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Enter the font sizes and viewport widths where scaling should start and end. Copy the CSS and check the computed sizes at both breakpoints. The rem conversion uses the root font size you provide.
How to use this tool
- Enter the small and large font sizes and their viewport widths. Adjust the assumed root font size if your design uses a value other than 16px.
- Generate CSS and compare the displayed sizes at the two endpoints and midpoint.
- Copy or download the CSS, then test it in your layout at narrow and wide widths and with browser zoom.
Supported inputs and limits
Uses a fixed root-font-size assumption to convert input pixels to rem; a changing site root size moves the effective breakpoints.
A rem/vw clamp does not by itself establish accessibility. Test browser zoom, text enlargement and reflow in your actual page.
Input stays in this browser. No account is needed.
Worked example
Example input
{"min":16,"max":32,"from":375,"to":1440,"root":16}Example options
{"min":16,"max":32,"from":375,"to":1440,"root":16}Example output
font-size: clamp(1rem, calc(0.64788732rem + 1.50234742vw), 2rem);
When something does not work
Check that the larger size and width exceed the smaller values. Use a root size between 8 and 32px, then verify the CSS in your page.
Frequently asked questions
What does the root font size change?
It converts your pixel sizes and the fluid offset to rem. At that assumed root size, the generated rule reaches your chosen sizes at the chosen widths. If your page changes its root font size, those exact breakpoint widths may shift.
Does this pass WCAG text resizing?
The result is a starting point, not a compliance result. The maximum is expressed in rem, but the vw term and your page layout can still limit text resizing. Test 200% zoom and reflow on the target page.
Can it calculate a scale with a changing root size?
No. It uses one root-size assumption. For a root size that varies with viewport width, calculate and test each range in your actual CSS.
Is the input sent to a server?
No. The calculation runs in this browser. Save the CSS you want before closing the tab.
Documentation & further reading
Related tools
Color converter
Same color. A different format.
Contrast checker
Check the contrast between text and background colors.
Gradient maker
Find a blend you love. Copy the CSS.
Palette and color mixing
Generate rule-based palettes or compare weighted RGB color mixtures.