Design and media

Responsive clamp builder calculator

Linear interpolation in viewport width, clamped at the chosen endpoints.

Your numbers

Use the units shown. Results update as you change valid inputs.

YOUR RESULT

Linear interpolation in viewport width, clamped at the chosen endpoints.

THE NUMBERS, EXPLAINED

How to use this calculator.

Linear interpolation in viewport width, clamped at the chosen endpoints.

Start with your inputs

Enter minimum size (px), maximum size (px), minimum viewport (px), maximum viewport (px). Keep amounts in the units shown on each field. The example is a starting point, not a recommended value.

InputExample value
Minimum size (px)16
Maximum size (px)24
Minimum viewport (px)320
Maximum viewport (px)1280

A worked example

With the example inputs above, css expression is clamp(16px, calc(13.333333px + 0.833333vw), 24px). Change the inputs to explore your own scenario.

All results for the example inputs above
ResultExample answer
CSS expressionclamp(16px, calc(13.333333px + 0.833333vw), 24px)

How this is calculated

CSS expression

fluidSizeCSS(a,b,c,d)

Symbols and units
a
Minimum size (px)
b
Maximum size (px)
c
Minimum viewport (px)
d
Maximum viewport (px)

Use the units shown. A list keeps the order in which you enter its values. The symbol ^ means “raised to the power of”.

Calculation steps and notation

Slope = (maximum size − minimum size)/(maximum viewport − minimum viewport). Intercept = minimum size − slope × minimum viewport. Generate clamp(minimum px, intercept px + 100 × slope vw, maximum px), rounding the generated coefficients to six decimals.

Assumptions and limits

Linear interpolation in viewport width, clamped at the chosen endpoints.

Calculations use the values you enter. Blank or invalid inputs show an error instead of silently substituting zero. Results are displayed to useful precision; calculations retain the underlying numeric precision.

Questions about this tool

What does the result tell me?

CSS expression. The result applies to the method and inputs described above. Check the units and assumptions before using it in a decision.

Why might another calculator differ?

Differences in units, rounding, timing or model definitions can produce different answers. Compare the input definitions and the method, rather than only the final number. For this tool: Linear interpolation in viewport width, clamped at the chosen endpoints.

Are my inputs stored or sent to AI?

Calculations on this page happen in your browser. The separate AI question finder sends its submitted conversation to OpenAI; these calculator fields are not sent. Favourites and recent tool names are stored locally. A shared link contains the inputs you choose to include.

Review status

Software example and browser checks are recorded in our quality report. No external expert review is claimed. Created with coding assistance; calculations run as ordinary browser code.

Read the quality report →