Skip to content

Menu

Responsive Font Calculator

Calculate fluid typography with clamp()

Runs entirely in your browserFrontendFree, no sign-up
Loading tool

01What is Responsive Font Calculator?

Designers usually hand over two font sizes: one for phones and one for desktop. Turning that pair into a single CSS value that grows smoothly in between is the job of this calculator. It writes a CSS clamp() expression, the function defined in the W3C CSS Values and Units Module Level 4, which takes a minimum, a preferred value and a maximum. The maths is a straight line. You give a Min Font Size and Max Font Size, plus the Min Viewport and Max Viewport widths where each size should apply. The tool divides the size difference by the viewport difference to get the slope. It then works out where that line would cross a zero-width screen, which becomes the intercept. The preferred value is that intercept in rem plus the slope times 100 in vw, because 1vw is one percent of the viewport width. Here's a real run. Going from 16px to 32px between 320px and 1200px gives a slope of 16 over 880, so the output is clamp(1rem, 0.6364rem + 1.8182vw, 2rem). At 320px wide the middle term works out to 16px, and at 1200px it reaches 32px. Outside that range clamp() pins the size to the bounds. All three arguments come out in rem, not px. That matters for accessibility, since rem follows the reader's browser font setting and pure vw ignores it. You can type sizes in Pixels (px) or REM. In REM mode you also set the Root Font Size, and the rem numbers change while the vw slope stays put. Numbers are rounded to four decimal places with trailing zeros trimmed. That keeps the result within a tiny fraction of a pixel of the exact line. If your max size is smaller than your min, so text shrinks as the screen grows, the slope turns negative and the bounds are swapped so clamp() still gets the smaller value first. If the max viewport isn't larger than the min viewport, you get an error message instead of a division by zero. Below the result you'll see the computed size at six widths, from Mobile S at 320px to Wide at 1440px, plus a sample line rendered at your current window size. The calculation is plain arithmetic in the page script, so your numbers never leave the tab. One honest limit: the tool only does linear scaling between two points. It won't build a full modular type scale for you, so run it once per step.

Front-end developers and design-system maintainers who need to turn a designer's mobile and desktop font sizes into one fluid CSS value. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Responsive Font Calculator

  1. Choose Pixels (px) or REM. In REM mode, set the Root Font Size (px).
  2. Enter the Min Font Size and Max Font Size.
  3. Enter the Min Viewport (px) and Max Viewport (px) where those sizes should apply.
  4. Read the Clamp Value and the Font Size at Different Viewports list to check the sizes in between.
  5. Copy the line from Quick Copy, or take Full CSS with Fallback for a plain size plus the clamp() in @supports.

03Worked examples

Input: 16px to 32px, viewport 320px to 1200px, root 16px
Result: clamp(1rem, 0.6364rem + 1.8182vw, 2rem)
The slope is 16px over 880px of viewport, which is 1.8182vw.
Input: 16px to 20px, viewport 320px to 1200px (Body text example)
Result: clamp(1rem, 0.9091rem + 0.4545vw, 1.25rem)
A gentle slope suits body copy.
Input: 32px to 72px, viewport 375px to 1440px (Hero heading example)
Result: clamp(2rem, 1.1197rem + 3.7559vw, 4.5rem)
Input: 48px to 24px, viewport 320px to 1200px
Result: clamp(1.5rem, 3.5455rem + -2.7273vw, 3rem)
Text that shrinks as the viewport grows gets a negative slope, and the bounds are swapped so the smaller value comes first.
Input: 16px to 32px, viewport 320px to 1200px, root 10px
Result: clamp(1.6rem, 1.0182rem + 1.8182vw, 3.2rem)
A different root changes the rem numbers but not the vw slope.
Input: Min viewport 320px, max viewport 320px
Result: Error: Max viewport must be larger than min viewport.
Equal widths would mean dividing by zero, so no clamp() is produced.

04Common use cases

  • Turning a Figma spec of 32px on mobile and 72px on desktop into one font-size line for a hero heading
  • Building every step of a design-system type scale with the same viewport range so headings stay in proportion
  • Replacing three or four media-query font-size overrides in an old stylesheet with a single clamp() value
  • Adding fluid fontSize entries to a Tailwind theme or a CSS custom property like --step-2
  • Checking what size a heading will actually render at on a 768px tablet before shipping
  • Making a large display heading shrink slightly on wide screens by entering a smaller max than min

05Tips

  • WCAG 1.4.4 asks that text can be resized to 200%. A large max-to-min ratio leans heavily on vw, which zoom doesn't scale, so test zoom on big headings.
  • Keep the rem part in the preferred value. A value made only of vw ignores the reader's browser font setting.
  • Use one viewport range for your whole type scale. Mixing ranges makes headings change size at different rates.
  • A negative vw number in the output is expected when the max size is smaller than the min. It isn't a bug.
  • Changing Root Font Size only rescales the rem numbers. Match it to the html font-size your project really uses.

06Related concepts

Fluid typography, CSS clamp(), Viewport units, rem, Responsive design.

Frequently Asked Questions

What is Responsive Font Calculator?

Responsive Font Calculator is a free, browser-based developer tool on AIDToolStack. Calculate fluid typography with clamp() It requires no installation or sign-up and works entirely in your browser.

Is Responsive Font Calculator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Responsive Font Calculator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe