Menu
PDF Tools
Image Tools
Converters & Utilities
Seller & Print Tools
Accounting & Business
Calculators
Text & Writing Tools
Developer & Web Tools
Creator & Social Tools
Browser Utilities & Games
Document & Design Makers
Text & Developer Tools
Exam & Form Tools

CSS Clamp Calculator

Type a smallest size, a largest size and the viewport widths between which the size should grow. The page writes a clamp() value that scales smoothly in between and holds steady outside.

How to use CSS Clamp Calculator online

  1. Enter smallest and largest sizes. In pixels.
  2. Enter the two viewport widths. Where the growth starts and ends.
  3. Choose rem or px. And the property name.
  4. Copy the CSS. Check the table first.

Why use this free CSS Clamp Calculator

  • Live clamp value
  • Rem or pixel output
  • Property name option
  • Table of sizes at common widths
  • Growing and shrinking sizes
  • Slope and intercept shown

What clamp does

The clamp function takes a smallest value, a preferred value and a largest value, and picks the preferred one unless it falls outside the range. A preferred value made from a fixed part plus a share of the viewport width grows in a straight line. Between your two widths the size follows that line, and outside them it stays at the smallest or largest size.

The formula

The slope is the change in size divided by the change in width, and it is written in viewport width units by multiplying by one hundred. The fixed part is the smallest size minus the slope times the smallest width. The page shows both, so you can check the result by hand.

Rem or pixels

Sizes in rem follow the reader font setting, which keeps text readable when the reader changes it. Pixels do not. Choose rem for type and for spacing that should grow with text, and note that the root size is used to convert. The default root size of sixteen pixels is the browser default.

The check table

A table lists the size at common widths from small phones to wide screens, in pixels and in rem. Read it to see whether the size at a given width looks right before you put the value in a style sheet.

Limits and care

A size made only of viewport units does not respond to zoom, which can be a problem for people who zoom text. Keeping the smallest and largest in rem and the middle part mixed helps, but check your design at large zoom. The calculation runs in your browser.

Using the tool

The CSS Clamp Calculator works again whenever the text or an option changes. Press Try a sample to see how it behaves.

CSS Clamp Calculator: frequently asked questions

Can the size shrink as the screen grows?
Yes. If the smallest size is larger than the largest, the slope is negative and the page writes a minus sign.
Why does the value use vw?
The vw unit is one percent of the viewport width, so it makes the size change with the screen.
Does it work for spacing too?
Yes. Use any property, such as padding or margin, in the property field.
What root size should I use?
Sixteen pixels is the usual browser default, so keep it unless your page sets another.
Is the result supported by browsers?
The clamp function works in current versions of the main browsers. Check your own support table.
Can anyone see the text I put into the CSS Clamp Calculator?
No copy is made on a server; the CSS Clamp Calculator runs in your browser.
Is there a way to reuse the CSS Clamp Calculator result?
Yes. Use the copy button on the CSS Clamp Calculator result, or select it and copy it by hand.

Related searches for CSS Clamp Calculator

  • CSS Clamp Calculator online
  • free CSS Clamp Calculator
  • CSS Clamp Calculator online free
  • CSS Clamp Calculator for mobile
  • CSS Clamp Calculator without sign up
  • css clamp formula
  • css clamp calculator with table
  • CSS Clamp Calculator – Developer & Web Tools

CSS Clamp Calculator is a free online tool on MAITBOX, in the Developer & Web Tools group. It runs in your browser, so what you type is not sent to a server. It works on Android and iPhone, and on Windows, Mac and Linux, with no download and no account.

More tools in Developer & Web Tools →

Search tools