CSS Clamp & Fluid Design Studio
Create accurate fluid typography and spacing, preview real CSS at responsive widths, and export reusable design tokens.
100% browser-local · CSS viewport preview · No uploads
Fluid design workspace
Set endpoints, test the CSS in a real preview context, then export.
Fluid value
Sizes are attached to viewport endpoints, not numerical min/max.
Actual responsive preview
Isolated iframe: its own CSS viewport and root size
Responsive value curve
| Width | Expected | Range |
|---|
Design system tokens
Saved in this editable project. All tokens use real generated CSS values.
Browser recovery is optional and may be cleared. Downloaded JSON is the portable backup. Preview root size is an assumption—not a WCAG certification. The tool never uploads your CSS or project.
How to use CSS Clamp Calculator
- Set the smaller and larger viewport widths in pixels. Enter the desired size at each viewport; the second size may be smaller.
- Set the root font size used for rem conversion and choose a CSS property. Presets provide a quick starting point.
- Inspect the endpoint and midpoint examples. Copy the clamp declaration or download it, then test zoom and the actual root font size in your layout.
When to use this tool
Make a heading or spacing value scale between two viewport sizes without abrupt breakpoint jumps. Check the result at both endpoints and with browser text zoom.
The preferred value is a line between two endpoints
The calculation finds a vw slope and a rem intercept from your viewport/size pairs. clamp() then limits that preferred value between the smaller and larger endpoint sizes. A decreasing design uses a negative vw coefficient; the minimum and maximum clamp bounds still stay in ascending order. The root-size input assumes a fixed pixel-to-rem relationship during calculation.
Worked example
Viewports: 320px → 1440px
Sizes: 16px → 32px; root: 16px
font-size: clamp(1rem, 0.7143rem + 1.4286vw, 2rem); Limits and output checks
Viewport widths must be positive and increasing. Endpoint sizes must be nonnegative. Actual computed sizes depend on the root font size and CSS environment. Fluid type still needs readable minimum sizes and zoom testing; using rem does not automatically establish accessibility.
Reference: CSS clamp() reference.
Frequently asked questions
Can the size decrease on wider screens?
Yes. Give the larger viewport a smaller target size. The preferred expression uses a negative vw term, with correctly ordered clamp bounds.
Can I use this for spacing?
Yes. Choose an appropriate property such as padding, gap or margin and review the result in your layout. This calculator uses nonnegative endpoint sizes.
Why does the result differ after changing the root font size?
The rem terms are interpreted by the browser using the actual root font size. A different root size changes the computed values from the original pixel assumptions.
Does the preview really change the viewport width?
Yes. It sets the width of an isolated iframe, so vw measures that iframe viewport rather than the width of a normal card. The computed CSS result is read from the iframe when its content is available.
Does this test accessibility or user text zoom automatically?
No. It shows selected computed values and potential small-text warnings. Test 200% text resize, browser zoom, and 320px reflow on the receiving site.
Describe the endpoints of a fluid CSS value
Enter the smaller and larger viewport endpoints and desired sizes. Inspect the generated clamp expression using the units expected by your stylesheet.
Scope of this workflow
Actual rendering depends on root font size and CSS context. A generated rem expression alone does not establish readable type or accessible zoom behavior.
Flexbox & Grid Playground — Live CSS Layout · All developer tools · Privacy policy · Contact PixelOkay