Type Scale Calculator
Type Scale Calculator
Presets are the exact intervals (4:3, not 1.333); the box shows them to three decimals. Rem values are pixels ÷ the root size, 16px unless your site changes the html font-size. With rounding on, the table and the snippets use the rounded sizes, and the "× previous" column shows the ratio that is left.
| Token | Step | Pixels | Rem | × previous | Preview |
|---|
📋 CSS Custom Properties
⚡ Tailwind CSS v4 (@theme in your CSS)
⚡ Tailwind CSS v3 (tailwind.config.js)
How to use the Type Scale Calculator
Set your base size (usually 16px)
The base size is your body text — the size everything else scales from. Browsers usually default to 16px (MDN), and readers can change that default, which is why the output is in rem. Pick a smaller or larger base if your design calls for it; the ratios stay the same.
Pick a ratio
The ratio determines how dramatic the size jumps are. Smaller ratios (Major Second 1.125) give subtle steps suitable for content-heavy sites; larger ratios (Perfect Fifth 1.500, Golden 1.618) give dramatic steps for editorial design. Major Third 1.250 and Perfect Fourth 1.333 sit in between. The names come from the frequency ratios of musical intervals, but they are labels: what the scale does on the page is make every size the same multiple of the one below it.
Choose steps up + down, and rounding
"Steps up" generates larger sizes (h1, h2, h3, hero headlines). "Steps down" generates smaller sizes (captions, labels, footnotes); 0 steps down is allowed. 5-6 up + 1-2 down is a common starting point. Tokens follow Tailwind's names — sm and xs below base, then lg, xl, 2xl and up. The table shows every size; the "Preview" column renders actual text at each size. If your design system snaps sizes to whole pixels or a rem grid, set "Round sizes to" and the table flags any neighbouring steps that land on the same size.
Copy CSS or Tailwind config
CSS Custom Properties (--text-base, --text-lg, etc.) drop into any vanilla project; reference them via var(--text-lg). Tailwind v4 reads the same --text-* names from an @theme block in your CSS; Tailwind v3 takes them in tailwind.config.js under theme.fontSize. All three use rem (pixels ÷ the root size, 16px by default), so they follow the reader's browser font-size setting as long as your site leaves the html font-size relative.
Modular type scales, musical ratios and what rounding does to them
A modular type scale is a typography system where every font size relates to a base size by a consistent ratio. Instead of sizes picked one at a time, you get a geometric progression: 16, 20, 25, 31.25, 39.0625, 48.83 with a 1.25 ratio, each size 1.25 times the one below. Tim Brown wrote about modular scales for the web in "More Meaningful Typography" (A List Apart, 2011), working his example in the golden ratio and crediting Robert Bringhurst. The preset names and values are the open-source modularscale-sass library's ratios up to the octave (13 of its 19). Most of those names are musical intervals, which are frequency ratios — a perfect fourth is 4:3, a fifth 3:2, an octave 2:1.
Which presets are really musical intervals
Most presets are just-intonation ratios of whole numbers, and each appears in the Huygens-Fokker Foundation's list of intervals: 16:15, 9:8, 6:5, 5:4, 4:3, 3:2, 8:5, 5:3, 15:8 and 2:1. The list sometimes uses another name than the library does — 16:15 is its "minor diatonic semitone", 9:8 its "major whole tone", 15:8 its "classic major seventh". Three presets need a note. The minor seventh 16:9 is the Pythagorean minor seventh; the same list gives 9:5 as the just minor seventh. The augmented fourth here is √2 ≈ 1.414, the tritone of twelve-tone equal temperament (26/12), not a whole-number ratio. The golden ratio φ ≈ 1.618 is not a musical interval at all.
What rounding to a grid does
The table shows sizes to two decimals, and at that precision no two steps share a size. Many design systems round further, to whole pixels or a 4px grid, and then small ratios lose steps. This calculator rounds half up (a size exactly halfway between two grid values goes up). Two neighbours can round to the same value only while the smaller one is below grid ÷ (ratio − 1): for a minor second that is 15px on a 1px grid and 60px on a 4px grid, for a major third 4px and 16px. On the default 16px base with 2 steps down and 6 up, a minor second rounded half up to 0.25rem gives nine tokens only three sizes (16, 16, 16, 16, 20, 20, 20, 24, 24). Many sizes land exactly halfway between grid values, so a different tie rule (half even, half down) can change which steps merge. Even where nothing merges, rounding bends the ratio: a major third rounded to whole pixels steps by anything from 1.231 to 1.300. Set "Round sizes to" above to see it for your own scale.
Choosing the right ratio for your design
Smaller ratios (1.067 Minor Second, 1.125 Major Second) produce subtle, conservative scales — suited to content-heavy interfaces where size differences should be felt rather than seen (long-form articles, documentation, dashboards). Mid-range ratios (1.20 Minor Third, 1.25 Major Third, 1.333 Perfect Fourth) give a clear hierarchy without very large headings. Larger ratios (1.5 Perfect Fifth, 1.618 Golden, 2.0 Octave) create dramatic hierarchy suitable for marketing pages, magazine layouts, hero sections where text dominates the design.
A type scale isn't just font sizes — it's a system of relationships. Once your scale exists, every typography decision becomes "which step?" instead of "what number?"
Why rem units beat pixels
The output uses rem units rather than pixels. 1rem is the font-size of the root html element, which is the reader's browser default (usually 16px) unless the site changes it. This matters for accessibility: users with low vision can increase their browser's default font size in settings, and rem-based designs scale proportionally. Text set in pixels ignores that setting (page zoom still enlarges it, but MDN warns that some browsers give the user no other way to change a pixel font size). WCAG 2.1 SC 1.4.4 asks that text can be resized to 200% without loss of content or function, and honouring the reader's default size is the simplest way to start. Modern best practice: declare font sizes in rem (especially for body + headings); pixel units are fine for borders, fixed UI element heights, and decorative elements that shouldn't scale.
Browser default headings are not a modular scale
The WHATWG HTML standard's rendering section sets h1 at 2em, h2 1.5em, h3 1.17em, h4 1em, h5 0.83em and h6 0.67em. Read upwards from h6, each heading is 1.239, 1.205, 1.170, 1.282 and 1.333 times the one below: near a major third on average, but no single ratio. h1 to h2 is exactly 4:3. Replace the defaults with a scale from this page and every heading moves by the same step.
Multilingual typography
Sites that mix scripts need more than one scale decision. Chinese, Japanese, Thai and other scripts set at the same pixel size as Latin text do not look the same size, and the difference depends on the fonts: compare your actual Latin and CJK faces side by side at the base size before deciding whether a locale needs its own base. A scale is a set of ratios, so the same ratios can sit on a different base per locale — the hierarchy stays consistent even when the base moves.
Musical ratios, rounding grids, the 16px browser default and clamp() under zoom
Modular type scale: every font size = base × ratiostep, so each size is the same multiple of the one below.
The preset names are musical intervals: Minor Third 6:5 (1.2), Perfect Fourth 4:3 (1.333), Perfect Fifth 3:2, Octave 2:1. The Minor Seventh 16:9 is the Pythagorean one (Huygens-Fokker); √2 is equal-tempered and φ is not musical. The names are modularscale-sass's.
At a 1.25 ratio and a 16px base, the steps are 16, 20, 25, 31.25, 39.06, 48.83 — each 1.25 times the last.
16px is the default font size in most browsers (MDN), which is why 1rem is usually 16px.
Rem units scale with user preferences; pixel units don't. Use rem for accessibility, especially for font sizes.
WCAG 2.1 SC 1.4.4 asks that text resize to 200% without loss of content — rem-based sizes follow the reader's setting.
Tim Brown wrote about modular scales for the web in "More Meaningful Typography" (A List Apart, May 2011), with his calculator at modularscale.com, pointing readers to Robert Bringhurst's The Elements of Typographic Style. His worked example is the golden ratio; the article names no musical interval.
Rounded half up to a 4px grid, a minor-second scale on 16px (2 down, 6 up) keeps only 3 distinct sizes for 9 tokens. Neighbours can merge only below grid ÷ (ratio − 1): 60px for a minor second.
CSS clamp() makes fluid type, but its vw part does not grow with zoom. Worked from the CSS definition, clamp(1rem, 2vw + 0.5rem, 1.5rem) in an 800px-wide window grows only 1.33× (24px → 32px) at 200% zoom: it already sits at its 1.5rem cap, and zooming halves the vw part.
Browser default headings (WHATWG: h1 2em … h6 0.67em) are not one ratio: from h6 up, each is 1.239, 1.205, 1.170, 1.282 and 1.333 times the last.
Frequently Asked Questions
-
A typography system where every font size relates to a base size by a consistent ratio. Sizes form a geometric progression: 16, 20, 25, 31.25, 39.06... (1.25 ratio). Each size is the same multiple of the one below, so the steps are consistent instead of chosen one by one. Tim Brown wrote about modular scales for the web (A List Apart, 3 May 2011), building on Robert Bringhurst's The Elements of Typographic Style.
-
Depends on your design's voice. Subtle (1.125 Major Second): documentation, dashboards, content-heavy interfaces. Mid-range (1.2 Minor Third, 1.25 Major Third, 1.333 Perfect Fourth): general web design. Dramatic (1.5 Perfect Fifth, 1.618 Golden): marketing pages, editorial, magazine layouts where typography is a primary visual element. Start with 1.25; bump to 1.333 if you want stronger hierarchy; drop to 1.2 if your design is content-dense.
-
1rem is the font-size of the root
htmlelement. If your site leaves that alone, it is the reader's browser default (usually 16px, and adjustable in browser settings), which readers with low vision may raise. Rem-based typography scales with that preference; pixel-based typography ignores it. Setting text in rem (not px) is a small change that serves every one of them. Pixels are still fine for borders, fixed UI heights, decorative elements that shouldn't scale — but font sizes should use rem. -
Two approaches: (1) Different scales at different breakpoints — mobile uses a tighter scale (1.2), desktop uses a wider scale (1.333). Define each via media queries. (2) Fluid typography using CSS clamp() — sizes scale smoothly with viewport width. Example: clamp(1rem, 2vw + 0.5rem, 1.5rem) sets a font-size that grows between 1rem and 1.5rem as the viewport widens. One caution: the vw part does not grow when the reader zooms or raises their default font size. Worked from the CSS definition (not measured in a browser), that example reaches the full 2× only in windows up to 400px or from 1,600px wide; in between it grows less, down to 1.33× at 800px, where the unzoomed size already sits at the 1.5rem cap. WCAG technique F94 (under SC 1.4.4) explains the mechanism: viewport units do not grow with zoom or text size. Keep enough of the preferred value in rem, and test at 200% zoom. This calculator generates a static scale; apply responsive logic in your CSS layer.
-
Mostly yes — that's the point of having a scale. But: hero headlines often want one step BIGGER than your h1 to feel exceptional. Marketing pages can break the scale for impact. The scale gives you defaults; designers can override deliberately. The mistake is using off-scale sizes for normal content (h2 at 27px when your scale says 25px) — that creates "almost but not quite" feeling that looks broken. Either follow the scale or break it on purpose; the in-between is bad.
-
This calculator sets font sizes only; line-height is a separate decision in your CSS. A unitless line-height (for example
line-height: 1.5) is multiplied by each element's own font size, so one value follows every step of the scale, and large headings can take a tighter value of their own. -
Most are musical intervals, which are frequency ratios — Minor Second 16:15 ≈ 1.067, Major Second 9:8 = 1.125, Minor Third 6:5 = 1.2, Major Third 5:4 = 1.25, Perfect Fourth 4:3 ≈ 1.333, Perfect Fifth 3:2 = 1.5, Minor Sixth 8:5 = 1.6, Major Sixth 5:3 ≈ 1.667, Minor Seventh 16:9 ≈ 1.778, Major Seventh 15:8 = 1.875, Octave 2:1. The preset names and values are the open-source modularscale-sass library's ratios up to the octave, 13 of its 19 (Scott Kellum, Adam Stacoviak and Mason Wendell). The frequency ratios all appear in the Huygens-Fokker Foundation's list of intervals, which gives 16:9 as the Pythagorean minor seventh (9:5 is the just one). Tim Brown's 2011 article works its example in the golden ratio and names no musical interval. The Augmented Fourth preset is √2 ≈ 1.414, the equal-tempered tritone, and the Golden Ratio φ ≈ 1.618 is not a musical interval; neither is a whole-number ratio. The calculator raises the exact ratio, not the rounded label — at +6 steps on 16px, 4:3 gives 89.90px where 1.333 would give 89.76px.
-
Copy the Tailwind config snippet into your tailwind.config.js's theme.fontSize section — overrides Tailwind's defaults with your scale. For design tokens (Style Dictionary, Tokens Studio): export the values to your tokens JSON, then transform to platform-specific outputs (Figma plugin, CSS variables, iOS / Android constants). For vanilla CSS, copy the CSS Custom Properties block into your :root selector. The CSS uses rem units; your reset / base stylesheet should set html { font-size: 100%; } to honor user preferences.
-
No. The scale is calculated in your browser, no request the page makes carries your inputs, and nothing is saved when you leave. The page still loads the site's usual analytics and advertising scripts, so DevTools → Network will show requests, but none of them contains your base size, ratio or tokens.
-
Keep the ratios and decide the base per script. Chinese, Japanese, Korean, Thai and other scripts set at the same pixel size as Latin text do not look the same size, and which way the difference goes depends on the fonts involved — so compare your actual faces side by side before choosing a per-locale base, then apply it with a
:lang()selector. The hierarchy stays consistent because the ratio does.
Method & sources
How it computes
Each step is base × ratio^step, presets raised as the exact fractions (16:15 … 2:1, √2, φ) behind modularscale-sass's decimals, or a custom ratio > 1; rem = px ÷ the root size. Optional rounding (half up) to 0.5px, 1px, 0.125rem or 0.25rem flags neighbouring steps that merge (possible only below grid ÷ (ratio − 1)) and shows the ratios left. Output in px and rem on Tailwind's token ladder, as CSS variables, a Tailwind v4 @theme block and a v3 config.
What this tool implements
- Modular scale as Tim Brown describes it for the web ("More Meaningful Typography", A List Apart, 3 May 2011): multiply by the ratio for each step up, divide for each step down. His worked example is the golden ratio, he credits Bringhurst, and the article names no musical interval. Corrected 2026-11-06: an FAQ credited him with making the interval names common, and the page called him the one who brought or popularised modular scales, a priority claim with no source.
- Preset names and values are modularscale-sass's ratios up to the octave, 13 of the 19 in _vars.scss (it also ships major tenth 2.5, major eleventh 2.667, major twelfth 3, double octave 4 and π). The library stores decimals (minor second 1.066666667, fourth 1.333333333, augmented fourth 1.41421, phi 1.618034); the page raises the exact fractions behind them. Frequency ratios per the Huygens-Fokker Foundation list of intervals, which sometimes names them differently (16/15 minor diatonic semitone, 9/8 major whole tone, 15/8 classic major seventh): 16/9 is the Pythagorean minor seventh (9/5 the just one), now labelled so; √2 is the 12-tone equal-tempered tritone, not a whole-number ratio; φ is not a musical interval.
- Rounding: sizes rounded half up to the chosen grid, after snapping float error below 1e-9 (√2^−2 evaluates to 0.4999999999999999, which turned a true 6px tie on 12px into a round-down); two neighbours can merge only while the smaller is below grid ÷ (ratio − 1). Worked: minor second on 16px (2 down, 6 up) at 0.25rem gives 16, 16, 16, 16, 20, 20, 20, 24, 24; major third at whole px steps by 1.231–1.300. Over 13 presets × bases 12–20px × steps −2…+6, half up merges 100 of 936 neighbouring pairs at 0.25rem and 34 at 0.125rem; another tie rule changes the count.
- rem = px ÷ root; 1rem is the root element's font-size, the browser default (MDN: "usually 16px") unless the site changes it. WCAG SC 1.4.4 asks that text resize to 200% without loss of content. Fluid caveat, arithmetic from the clamp() definition, not a browser test: clamp(1rem, 2vw + 0.5rem, 1.5rem) grows only 1.33× at an 800px window under 200% zoom or a doubled default size, where the unzoomed size already sits at the 1.5rem cap; the full 2× only at 400px or narrower and 1,600px or wider. WCAG technique F94 explains the mechanism (viewport units do not grow with zoom or text size); no conformance verdict is made.
- Browser default headings per the WHATWG HTML rendering section (h1 2em, h2 1.5em, h3 1.17em, h4 1em, h5 0.83em, h6 0.67em): ratios from h6 up 1.239, 1.205, 1.170, 1.282, 1.333, so not one modular scale.
- Corrected 2026-11-06: "zero outbound requests" did not describe the page's own analytics and ads (no request carries the inputs); unsourced lines on dissonant intervals, a 14px body floor and line-height multiples were removed; steps outside 1–10 up or 0–5 down are now announced instead of silently clamped. Corrected 2026-10-25: presets raised as rounded labels, "0 steps down" gave two, step +1 named md.
Sources
- Brown T. More Meaningful Typography. A List Apart, Issue 327, 3 May 2011. https://alistapart.com/article/more-meaningful-typography/
- Kellum S, Stacoviak A, Wendell M. modularscale-sass v3.0.10: stylesheets/modularscale/_vars.scss (ratio values). MIT licence. https://github.com/modularscale/modularscale-sass/blob/master/sty…
- Op de Coul M (comp.). List of intervals. Huygens-Fokker Foundation. https://www.huygens-fokker.org/docs/intervals.html
- WHATWG. HTML Living Standard, §15.3.6 Sections and headings (rendering). https://html.spec.whatwg.org/multipage/rendering.html#sections-an…
- MDN Web Docs. font-size (default browser font size; px and accessibility). https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
- W3C. Understanding WCAG 2.2, Success Criterion 1.4.4 Resize Text. https://www.w3.org/WAI/WCAG22/Understanding/resize-text.html
- W3C. WCAG Technique F94: Failure of Success Criterion 1.4.4 due to incorrect use of viewport units to resize text. https://www.w3.org/WAI/WCAG22/Techniques/failures/F94
- Tailwind CSS. font-size (utility ladder and --text-* theme variables). https://tailwindcss.com/docs/font-size
Show 1 more
- Tailwind CSS. Theme variables (resetting a namespace with --text-*: initial). https://tailwindcss.com/docs/theme
What can make this go out of date
- None at runtime; nothing the reader enters leaves the page.