CSS Clamp Calculator

Make font sizes and spacing scale smoothly between phone and desktop with one clamp() line.

FreeNo sign-upPrivate — runs in your browser

Preview

800px
The quick brown fox jumps over the lazy dog

Size at common screen widths

How to use the CSS Clamp Calculator

  1. Enter the sizesSet the smallest size (for phones) and the largest size (for desktops) in pixels.
  2. Set the screen rangeChoose the screen widths where scaling starts and stops, such as 320 px and 1280 px.
  3. Copy the clamp() valuePaste it into your CSS. Drag the preview slider to see the size at any screen width.

Example

16 px → 24 px between 320 px and 1280 px screens gives font-size: clamp(1rem, 0.8333rem + 0.8333vw, 1.5rem);

At a 768 px tablet the size is 19.73 px; below 320 px it stays at 16 px, above 1280 px it stays at 24 px.

Frequently asked questions

How does clamp() work?

clamp(MIN, PREFERRED, MAX) uses the preferred value but never goes below the minimum or above the maximum. The preferred value here mixes rem and vw, so it grows with the screen.

Why use rem instead of px?

rem respects the reader’s browser font-size setting, so text still grows for people who need bigger text. Mixing rem with vw keeps zoom working.

Which browsers support clamp()?

All modern browsers have supported clamp() since 2020: Chrome, Edge, Firefox, Safari and their mobile versions.

Popular posts from this blog

Character Counter

Speech to Text Online

Keyboard Tester