Your files never leave your device. All processing happens locally in your browser.
How do I calculate a modular typography scale?
The Typography Scale Calculator builds a harmonious MODULAR type scale from a base font size and a ratio (each step is base × ratioⁿ), giving you px + rem sizes, suggested line-heights and letter-spacing, an optional fluid clamp() per step, a live specimen in system fonts, and copyable output as CSS custom properties, a Tailwind fontSize config or JSON. It runs 100% in your browser — nothing is uploaded.
What is
Modular type scale
A modular (geometric) type scale is a set of font sizes generated by repeatedly multiplying a base size by a fixed ratio, so each size is base × ratio raised to a step index. The shared ratio makes the sizes feel visually related, much like intervals in a musical scale.
Yes. Your base size, ratio and viewport settings are just numbers, and the entire scale — px, rem, line-heights and clamp() values — is computed locally on your device. Nothing is uploaded and there is no server or CDN in the processing path.
Everything is 100% client-side. The tool holds your inputs (base size in px, the ratio, how many steps up and down, the rem root size and the fluid viewport range) as plain numbers and runs the scale maths right in your browser tab. The px and rem sizes, the suggested line-heights, and every clamp() string are derived on your device, and the live specimen is ordinary DOM text the browser renders. There is no network call in the processing path, so it works offline once the page is cached.
For text-heavy pages a smaller ratio like the minor third (1.2) or major third (1.25) keeps the steps close and readable; for expressive, display-led designs a larger ratio such as the perfect fourth (1.333) or golden ratio (1.618) gives dramatic contrast. Pick the smallest ratio that still gives clear hierarchy.
The ratio controls how fast sizes grow between steps. The minor third (1.2) and major third (1.25) are the most common web choices because the gaps stay gentle enough for long-form reading while still separating headings from body text. The perfect fourth (1.333), augmented fourth (1.414), perfect fifth (1.5) and golden ratio (1.618) create bolder jumps that suit landing pages and editorial layouts but can leave awkward gaps in the middle of the scale. This tool lets you try all eight named ratios and see the result live, so you can pick the smallest ratio that still gives a clear hierarchy.
rem sizes scale with the user’s browser font-size setting, so people who increase their default text size get larger type everywhere — which px does not allow and which WCAG’s resize-text requirement expects.
A rem is relative to the root font size (16px by default), so 1.5rem is 24px at the default but grows if a user raises their browser’s base size for readability. Fixing type in px ignores that preference and can block zooming of text independently of the layout, which is why WCAG SC 1.4.4 (Resize text) expects relative units. This tool anchors your base in px for clarity but outputs each step in rem against a configurable root size, and it exposes that root size so you can honestly see how the conversion works.
It builds a CSS clamp(min, preferred, max) value per step so the font size grows smoothly with the viewport between a minimum and maximum width — replacing a stack of media-query breakpoints with one line.
Fluid typography interpolates a size between two viewport widths using clamp(): below the minimum width you get the small size, above the maximum you get the large size, and in between the size scales linearly. This tool computes the preferred term as an intercept in rem plus a vw coefficient (from the slope between your min and max viewport widths) and clamps it with the small and large rem bounds, so you can paste one declaration instead of maintaining breakpoints. Always test the result at very small (~320px) and very large (~2560px) viewports.
Detailed Explanation
⚙️Methodology
How the Typography Scale Calculator Generates Sizes
A modular (geometric) type scale is built by repeatedly multiplying a base font size by a fixed ratio: the size at any step is base × ratio^step, where positive steps grow above the body size and negative steps shrink below it. This tool’s engine (typeScaleEngine.ts) computes each step from a base size in px, one of eight named ratios (or a custom value), and a count of steps up and down, then converts every px size to rem against a configurable root font size (16px is the browser default). The maths is pure and deterministic, so the same inputs always produce the same scale.
size(step) = base × ratio^step — the core modular-scale formula
Eight named ratios: minor second 1.067 → golden 1.618
Positive steps grow headings; negative steps shrink small/caption text
Each px size is converted to rem against a configurable root size
Optional whole-pixel rounding avoids subpixel drift across browsers
📋Use Cases
Line-Height and Letter-Spacing Suggestions
Good leading depends on size: body and small text read best with generous line-height (about 1.5, the common readability floor), while large display headings want tighter leading (down toward ~1.1) or they look gappy. The engine interpolates a suggested unitless line-height on the px size between those anchors, and nudges letter-spacing slightly negative for large display sizes where the default tracking looks loose. These are sensible starting points, not absolutes — the ideal value depends on the actual typeface, measure and language.
Body/small text → ~1.5 line-height; large display → ~1.1
Line-height is interpolated on the pixel size between those anchors
Large sizes (≥32px) get a small negative letter-spacing suggestion
Suggestions are unitless so they scale with the font size
Values are starting points; tune per typeface, measure and language
🔧Technical Details
Fluid Type with the clamp() Generator
The optional fluid mode emits a CSS clamp(min, preferred, max) value per step so type scales smoothly with the viewport instead of jumping at breakpoints. The engine derives the small end as a fraction of the large end, then computes the preferred term by linear interpolation between your minimum and maximum viewport widths: preferred = intercept(rem) + slope·100vw, where slope = (maxRem − minRem) / (maxVw − minVw). Below the minimum width the min size holds; above the maximum the max size holds. One declaration replaces a stack of media queries.
clamp(min, preferred, max) scales type between two viewport widths
Replaces breakpoint-based font-size media queries with one line
Test the result at ~320px and ~2560px viewports
⚠️Limitations
Honest Limitations: Rounding and rem Base
A modular scale produces fractional pixels (e.g. 31.25px, 39.063px) because it multiplies by an irrational-looking ratio. Browsers round subpixels differently, so this tool offers whole-pixel rounding and flags when rounding changed a value — but rounding breaks the exact geometric relationship slightly. The rem output assumes a specific root size (16px unless you change it); if your project sets html { font-size } differently, re-check the conversions. The tool suggests sizes and leading, it does not choose or embed fonts, judge readability, or validate your full type system.
Whole-pixel rounding slightly breaks the exact geometric ratio
rem output depends on the root font size you set (16px by default)
Suggestions are heuristics — verify readability with real content
The tool does not embed fonts or validate a whole design system
🔒Privacy & Security
Private by Design
Everything happens on the user’s device. The base size, ratio, step counts, root size and viewport range are just numbers, and the whole scale — px, rem, line-heights and every clamp() string — is computed locally in the browser tab. There is no server call and no CDN in the processing path; the live specimen is ordinary DOM text the browser renders, and the CSS/Tailwind/JSON exports are plain text copied to the clipboard. Nothing is uploaded, logged or stored, and the tool works offline once loaded.
The entire scale is computed in the browser — no server, no CDN
Inputs are plain numbers; nothing is uploaded, logged or stored
The specimen is real DOM text rendered with local system fonts
Exports are plain CSS / Tailwind / JSON copied locally
Works offline after first load
Common modular-scale ratios and when to use them
Ratio name
Value
Character
Good for
Minor second
1.067
Very subtle steps
Dense dashboards, data tables
Minor third
1.200
Gentle, readable
Long-form / text-heavy pages
Major third
1.250
Balanced
General web UI (a safe default)
Perfect fourth
1.333
Clear contrast
Marketing pages, blogs
Perfect fifth
1.500
Bold hierarchy
Landing pages, editorial
Golden ratio
1.618
Dramatic
Expressive, display-led design
Pick the smallest ratio that still gives a clear hierarchy; larger ratios can leave awkward gaps in the middle of the scale. As of July 2026.