Type scale and clamp calculator
Pick a ratio and get fluid clamp() font sizes, ready for theme.json.
How to use it
- Set the smallest and largest screen width your design covers, and the body text size you want at each.
- Pick a ratio for small screens and one for large screens. A bigger ratio spreads the headings further apart.
- Drag the preview width to see every step at that screen size, and read the Zooms to 2x column: No means that step needs a max closer to its min.
- Pick CSS, theme.json or GeneratePress and copy the code into your site.
Frequently Asked Questions
What does clamp() do for font sizes?
clamp() takes a smallest size, a size that grows with the screen width, and a largest size. Text sits at the smallest size on small screens, grows in a straight line as the screen widens, and stops at the largest size. One line of CSS replaces a set of media queries.
What is a type scale ratio?
Each step of the scale is the step below it times the ratio. At 1.25, 16px body text gives headings of 20, 25, 31 and 39px. Small screens usually want a smaller ratio than large ones, so headings do not crowd a phone.
Can fluid type fail accessibility?
Yes. Zooms to 2x means a visitor can make the text at least twice its size with browser zoom, which the tool tests at 500%, the most a browser zooms (WCAG 1.4.4). Zoom grows px and rem but not the vw part of a clamp(), so a size whose max is far above its min can stop short. As a rule of thumb, keep each max at no more than 2.5 times its min. The tool warns you about every step that does not.
How does theme.json take fluid font sizes?
Each size in settings.typography.fontSizes gets a fluid min and max, and settings.typography.fluid sets the screen widths where growing starts and stops. WordPress 6.4 or later writes the clamp() itself, so you never paste one. It only works in block themes.
How do I use these sizes in GeneratePress?
Open Customizer, Typography, then the Typography Manager. Add Body and Heading 1 to Heading 6 and paste each clamp() into the Desktop font size. Leave Tablet and Mobile empty, because a value there replaces the clamp() on smaller screens.
Why rem and not px?
rem follows the reader's own default text size in the browser settings, and px does not. The tool takes px because they are easier to think in, then writes rem, assuming the usual 16px root.
More free tools
Palette and contrast checker
Build a color palette, check every pair with WCAG 2 and APCA, and export it to theme.json.
Gradient and shadow generator
Build CSS gradients and layered box shadows, then copy them as CSS, theme.json presets or GenerateBlocks styles.
SERP pixel checker
See your title and description in real pixels on desktop and mobile, before Google cuts them off.