Tools /  CSS clamp() Calculator

CSS clamp() Calculator

流体タイポ計算
検証済TESTED
MIN FONT PX
MAX FONT PX
MIN VIEWPORT PX
MAX VIEWPORT PX
ROOT PX
font-size: clamp(1.00rem, 0.51rem + 2.17vw, 2.25rem);
LIVE PREVIEW
Fluid type, planed to fit

This heading uses the exact clamp() above. Resize your window to feel it flex.

VIEWPORTCOMPUTED PXREMSTATE
360px16.0px1.00remat min
768px24.9px1.55remfluid
1024px30.4px1.90remfluid
1440px36.0px2.25remat max
1920px36.0px2.25remat max

Sizes are computed from the linear slope between your two anchor viewports: pure math, no resizing required.

How it works

仕組み

This calculator builds a CSS clamp() expression for fluid typography: type that scales smoothly between a minimum and maximum size as the viewport widens, with no media queries. Enter your smallest font size, largest font size, and the two viewport widths where each should apply, and the tool computes the slope and rem-based intercept for you. A live sample heading renders with the exact value so you can resize your window and feel it flex, and a table shows the computed size at common breakpoints, worked out mathematically with no dragging required.

Why does the formula mix rem and vw units?

The vw part makes the size track the viewport, while the rem part anchors it to the user’s chosen root font size. Keeping the intercept in rem means the text still scales when someone raises their browser’s default font size, an accessibility win over pure px or pure vw values.

What are sensible viewport anchors?

360px and 1280px cover most phones through laptops and are a solid default. If your layout has a max-width container, use that container’s width as the upper anchor instead, since the type stops needing to grow once the layout stops growing.

Can I use this for spacing, not just font size?

Yes. The math is identical for padding, margins, and gaps. Just copy the clamp() value into any length property. Many design systems define a small set of fluid spacing steps this way and reuse them everywhere.

More on the bench 他の道具
Regex Tester
Cron Expression Builder
Meta Tag Previewer
Shadow & Gradient Generator
Viewport Simulator
Tab Order Visualizer
JSON Formatter
Diff Checker