Code & Media

Fluid Type Scale

Generate a responsive `clamp()` type scale from two breakpoints.

  • Draft kept in this tabYour draft is kept in this tab's session storage and cleared when the tab closes.
  • Runs in your browserProcessing happens in this page. No application server receives your input.
Load sample

Scale settings

CSS clamp declarations

164 characters

Scale summary

Viewport range
320px โ€“ 1280px
Base size range
16px โ€“ 20px
Modular ratio
1.25
Steps
3 / 24
Unit basis
1rem = 16px, preferred term rem + vw

Generated steps

Generated fluid scale steps
StepVariableMin (px / rem)Max (px / rem)Preferred (rem + vw)DeclarationAction
0--step-016px (1rem)20px (1.25rem)0.917rem + 0.417vw--step-0: clamp(1rem, 0.917rem + 0.417vw, 1.25rem);
1--step-120px (1.25rem)25px (1.563rem)1.146rem + 0.521vw--step-1: clamp(1.25rem, 1.146rem + 0.521vw, 1.563rem);
2--step-225px (1.563rem)31.25px (1.953rem)1.432rem + 0.651vw--step-2: clamp(1.563rem, 1.432rem + 0.651vw, 1.953rem);

What this tool does

Generates a responsive fluid typographic scale as CSS clamp() custom property declarations from minimum and maximum viewport breakpoints, base font sizes, and a modular scale ratio in-page.

Interpolation & accessibility rules

  • Computes two-point linear interpolation between (minViewport, minBase * ratio^step) and (maxViewport, maxBase * ratio^step) for each step 0..steps-1.
  • Emits preferred terms as rem + vw (assuming 1rem = 16px) rather than pure vw so user browser zoom continues to scale typography.
  • Rounds values at emission time to the selected decimal precision (0..6, default 3) rather than compounding rounding error across intermediate steps.
  • Emits a flat scale with an explicit warning row on each declaration when ratio is 1 (no progression across steps).
  • Refuses degenerate viewport ranges (minViewport >= maxViewport) with DegenerateRange rather than dividing by zero.

Operational limits & execution

In-page: the scale is computed again on every change of a number or of the precision.

Maximum step count: 24 steps (returns StepCapExceeded above the cap). Viewport bounds must lie between 1px and 10000px, base font sizes between 1px and 400px, and ratio must be a positive finite number (returns OutOfRange outside bounds). Runs synchronously in-page with zero external runtime calls.

Worked example

Input:

minViewport 320, maxViewport 1280, minBase 16, maxBase 20, ratio 1.25, steps 3

Expected output:

--step-0: clamp(1rem, 0.917rem + 0.417vw, 1.25rem);

Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.