Building a Typography Scale System
To build a typography scale, set body text at 1rem (16px in a default browser), pick one ratio such as 1.2 or 1.25, and multiply up for each heading step and divide down for small text. Write the results as rem-based tokens, pair each size with a unitless line-height, and make headings fluid with clamp() only after checking that they still grow when a reader zooms to 200%.
That is the whole method. The rest of this page is the detail that decides whether a scale survives a real product: which ratio fits which kind of interface, how to derive clamp() values instead of copying them, what two shipping design systems actually do, and the zoom arithmetic most fluid-type tutorials skip.
If you would rather generate the numbers than work them by hand, the typography scale calculator runs this exact formula for steps -2 to 5, converts each step to rem against your root size, and writes the CSS variables and the fluid clamp() heading sizes for you. The tables below let you check its output.
Why a scale beats eyeballed sizes
When every size is chosen on its own, a codebase collects near-duplicates: 13px in one card, 14px in a table, 15px in a sidebar. None of them is wrong in isolation, but together they erase hierarchy, because readers cannot tell which differences are meaningful. A scale removes the choice. Every size is the base times the ratio raised to some whole-number power, so two pieces of text are either the same size or at least one full step apart.
The constraint also settles arguments. When someone asks for a card title "a little bigger", the only options are the current step and the next one. That conversation takes thirty seconds instead of a design review, and the answer is the same next month when someone else asks.
Choosing a ratio
Most of the common named ratios take their names from musical intervals; the golden ratio is the exception. Their values are plain fractions, so you can check them with a calculator:
| Ratio name | Fraction | Value | Step from 16px | Five steps above 16px | Where it tends to fit |
|---|---|---|---|---|---|
| Minor second | 16/15 | 1.067 | 17.07px | 22.1px | Dense data tables, admin tools |
| Major second | 9/8 | 1.125 | 18px | 28.8px | Quiet product UI with many levels |
| Minor third | 6/5 | 1.200 | 19.2px | 39.8px | General product UI, documentation |
| Major third | 5/4 | 1.250 | 20px | 48.8px | Product plus marketing pages |
| Perfect fourth | 4/3 | 1.333 | 21.33px | 67.4px | Editorial layouts, landing pages |
| Golden ratio | (1+√5)/2 | 1.618 | 25.89px | 177.4px | Posters and single hero statements |
The "five steps above" column is the useful one. It shows how big your largest heading gets if you need five levels. At 1.618 the fifth step is 177px, which no interface can use, so golden-ratio scales only work when you need two or three levels. At 1.067 the fifth step is 22px, barely bigger than body text, so the hierarchy has to come from weight and color instead of size.
Our editorial default for interfaces is 1.2 to 1.25. That is a judgment, not a standard: no specification names a best ratio. Pick lower when the screen is crowded with small text, higher when the page is mostly reading and big headlines.
Building the scale step by step
Pick a base and a ratio. Each step up multiplies by the ratio; each step down divides by it. With a 16px base and a 1.25 ratio:
| Step | Calculation | Exact px | rem (at a 16px root) | Typical role |
|---|---|---|---|---|
| -2 | 16 ÷ 1.25 ÷ 1.25 | 10.24 | 0.64 | Rarely used, too small for most text |
| -1 | 16 ÷ 1.25 | 12.8 | 0.8 | Captions, timestamps |
| 0 | base | 16 | 1 | Body text, form inputs |
| 1 | 16 × 1.25 | 20 | 1.25 | h4, card titles |
| 2 | 16 × 1.25² | 25 | 1.5625 | h3 |
| 3 | 16 × 1.25³ | 31.25 | 1.9531 | h2 |
| 4 | 16 × 1.25⁴ | 39.06 | 2.4414 | h1 |
| 5 | 16 × 1.25⁵ | 48.83 | 3.0518 | Display |
Two practical notes. First, round the final tokens. Nobody can see the difference between 39.06px and 39px, and whole numbers are easier to talk about in a review. The relationship between steps is what matters. Second, step -2 at this ratio is 10.24px, which is small enough that we would not ship it for anything a reader has to read. Many teams cut the scale off at -1 and use weight or color for anything that needs to look quieter.
Most products need fewer levels than HTML offers. A realistic set is display, h1, h2, h3, body, small and caption: seven sizes. Map the HTML heading elements to steps in one stylesheet so h2 means the same size everywhere, and keep the element choice (which is about document structure) separate from the visual step (which is about emphasis). A sidebar heading can be an h2 in the outline and still use the h4 visual step.
What shipping design systems actually do
Real systems rarely follow a single pure ratio. They start from a ratio, then hand-tune steps so they land on a grid or read well in a specific typeface. Two documented examples:
| System | Body size | Body line height | One display size | Notes from the official docs |
|---|---|---|---|---|
| Material Design 3 (via Flutter's TextTheme) | bodyLarge 16, bodyMedium 14, bodySmall 12 | 24, 20, 16 | displayLarge 57 (line height 64) | 15 styles: display, headline, title, body and label, each in large, medium and small |
| IBM Carbon | body-01 14px (productive), body-02 16px (expressive) | 20px, 24px | fluid-display-01 at 54px | Productive set for dense product UI, expressive set for web pages with fluid headings |
The Material values come from the Flutter TextTheme reference, which lists sizes and line heights without stating units, so we have left them unitless. Material's own web components expose the same roles as CSS custom properties such as --md-sys-typescale-body-large-size.
Three lessons from those numbers:
- Neither system uses one ratio all the way up. In the Material list, displayLarge to displayMedium is 57 ÷ 45 = 1.27, but headlineLarge to headlineMedium is 32 ÷ 28 = 1.14. A ratio is a starting point you are allowed to adjust.
- Leading shrinks as size grows. Material's display style runs at 64 ÷ 57 = 1.12, while bodyLarge is 24 ÷ 16 = 1.5. Carbon's body-01 is 20 ÷ 14 = 1.43 and body-02 is 24 ÷ 16 = 1.5.
- Dense UI and reading content get different bases. Carbon splits them explicitly at 14px and 16px. If your product has both a data-heavy app and a content site, two sets drawn from one ratio can be cleaner than one compromise base.
Line height, measure and spacing
Size is only one of three settings that make type readable.
Line height. Large text needs less leading, because the gap between lines grows with the font size even at the same ratio. Our working ranges:
- Display and h1: 1.05 to 1.2
- h2 and h3: 1.2 to 1.35
- Body: 1.5 to 1.7
- Small and caption: 1.4 to 1.5
Use unitless values (line-height: 1.5). A unitless value is multiplied by each element's own font size, so a heading that inherits it scales correctly. A pixel value, by contrast, is inherited as a fixed number and squashes any larger text below it.
Measure. Long lines make the eye work to find the start of the next line. WCAG 2.2 success criterion 1.4.8 (Visual Presentation, Level AAA) asks that users can get blocks of text to a width of no more than 80 characters, or 40 for Chinese, Japanese and Korean text. GitHub's Primer typography guidance also recommends keeping lines to about 80 characters. Many editorial designers aim lower, in the 60s, which is a print habit rather than a requirement. In CSS, max-width: 65ch on the article container is a common starting point; check it by counting the characters in a few rendered lines of your real typeface, because character widths vary. Our line length and line height measurements found that 65ch holds 72 to 87 characters across six Google Fonts, so check before you ship it.
Vertical spacing. Rhythm comes from consistent gaps between blocks, not just line height. A paragraph gap of 1em to 1.5em and heading margins that scale with the heading size cover most layouts. Put more space above a heading than below it so it visually belongs to the text it introduces.
Edge case: users who override your spacing
WCAG 2.2 success criterion 1.4.12 (Text Spacing, Level AA) does not require you to use any particular spacing. It requires that nothing breaks when a user forces line height to 1.5 times the font size, paragraph spacing to 2 times, letter spacing to 0.12 times and word spacing to 0.16 times, for example through a browser extension or user stylesheet.
That interacts badly with a tight type scale in three places:
- Fixed-height containers. A button or tab set to
height: 40pxwith a two-line label will clip when the line height jumps from 1.1 to 1.5. Use padding andmin-heightinstead. - Truncated headings. Cards that clamp headings to two lines with
overflow: hiddencan hide words once letter spacing widens. Test the card with the overrides applied. - Absolutely positioned captions. Captions placed over images with fixed offsets overlap the image content when the text grows taller.
None of this changes your scale. It changes how components hold text, which is why the type scale and the component library should be tested together.
Fluid type with clamp()
Fixed sizes force a trade-off: a 48px heading that looks right on a laptop overflows a phone, and a 32px heading that fits a phone looks timid on a wide monitor. clamp() lets one declaration cover both. MDN documents the syntax as clamp(MIN, VAL, MAX), which resolves as max(MIN, min(VAL, MAX)): the preferred value is used while it sits between the two bounds. MDN marks clamp() as Baseline widely available, supported across browsers since July 2020.
Deriving the values instead of copying them
The middle value is a straight line between two points: the minimum size at a narrow viewport and the maximum size at a wide one. You need four inputs and two formulas.
Inputs for this worked example: minimum 32px at a 360px viewport, maximum 48px at a 1280px viewport.
- Slope = (max size − min size) ÷ (max viewport − min viewport) = (48 − 32) ÷ (1280 − 360) = 16 ÷ 920 = 0.017391. Multiply by 100 to express it in vw: 1.7391vw.
- Intercept = min size − slope × min viewport = 32 − (0.017391 × 360) = 32 − 6.261 = 25.739px. Divide by 16 for rem: 1.6087rem.
- Bounds in rem: 32 ÷ 16 = 2rem, 48 ÷ 16 = 3rem.
Result:
h1 {
font-size: clamp(2rem, 1.6087rem + 1.7391vw, 3rem);
}
Check it at both ends. At 360px: 25.739 + (0.017391 × 360) = 32.0px. At 1280px: 25.739 + (0.017391 × 1280) = 48.0px. If either check misses, one of the inputs was typed wrong. Calculators such as Utopia's fluid type scale calculator take the same inputs (minimum and maximum viewport, minimum and maximum size, and a ratio) and output the CSS, but knowing the arithmetic lets you audit what they produce.
Keep body text out of this. Leave it at 1rem so it always equals the reader's own default size. MDN's font-size reference explains why: a value relative to the user's default respects a reader who has set a larger default, while a fixed px font size cannot be changed by the user in some browsers.
The zoom check most tutorials skip
The WCAG failure technique F94 describes text sized mainly with viewport units: zoom does not enlarge it, because vw follows the window, not the text settings. Pairing vw with rem, as above, avoids the outright failure, but it does not make a heading double when the page is zoomed. Only the rem part grows.
The arithmetic is simple. Call the rem part of the preferred value I and the vw part V, both in px at the current window width. At 200% zoom, the rem part doubles and the vw part does not, so the heading grows by a factor of (2I + V) ÷ (I + V), as long as the result stays inside the clamp bounds. Body text at a plain 1rem has V = 0 and grows by exactly 2.
For the h1 above on a 1280px window: I = 25.74px and V = 22.26px. Growth = (51.48 + 22.26) ÷ 48 = 1.54 times. On a 360px phone, the zoomed value falls below the 2rem floor, the floor takes over, and the floor itself doubles, so the heading reaches the full 2 times there.
WCAG 2.2 success criterion 1.4.4 (Resize Text, Level AA) requires that text can be resized up to 200 percent without loss of content or functionality, and its Understanding document says this applies to each responsive layout. MDN's clamp() page adds a rule of thumb: for text, make the maximum a relative unit at least twice the minimum, and test that text can still scale. Auditors read the heading case differently, so the honest advice is to measure your own:
- Zoom to 200% at your widest supported window and compare the rendered heading height with the 100% screenshot.
- If the growth falls short of what your team or auditor requires, reduce the vw share. A smaller slope with a larger rem intercept grows more under zoom.
- Never apply fluid sizing to body text, inputs or labels. Those carry the content that 1.4.4 protects most directly.
Our px vs rem vs em units guide covers the unit rules in more depth, and the WCAG 2.2 compliance guide places 1.4.4 and 1.4.12 among the other Level AA checks.
Shipping the scale as tokens
Tokens make the scale the only option. Every component reads a size from the token set, and nobody writes font-size: 15px in a component file.
:root {
--font-caption: 0.8rem; /* 12.8px, step -1 */
--font-body: 1rem; /* 16px, step 0 */
--font-h4: 1.25rem; /* 20px, step 1 */
--font-h3: clamp(1.4375rem, 1.3152rem + 0.5435vw, 1.75rem);
--font-h2: clamp(1.75rem, 1.5054rem + 1.087vw, 2.375rem);
--font-h1: clamp(2.0625rem, 1.6467rem + 1.8478vw, 3.125rem);
--font-display: clamp(2.5rem, 1.8397rem + 2.9348vw, 4.1875rem);
--leading-tight: 1.1;
--leading-snug: 1.25;
--leading-body: 1.6;
}
The fluid values above come from the worked example in the next section, so every line can be traced back to stated inputs.
The rule that keeps the system alive: no raw font-size declarations in components. If a new size is truly needed, it enters the scale first, gets a name, and is reviewed like any other change. Material's web components show the same idea at a larger size: each of their 15 type styles exposes size, line height, weight and font family as separate system tokens.
If you store tokens outside CSS, the Design Tokens Community Group format has a typography composite type that groups font family, size, weight and line height in one token. Our design system from scratch guide shows that JSON format and how tokens flow from it into CSS.
Worked example: one scale for a SaaS marketing site, blog and app
This is an illustration with chosen inputs, not a client project. Every number in it can be recomputed from the inputs stated below.
The brief. A fictional software company needs one type system for three surfaces: a marketing site that wants big headlines, a blog that needs comfortable long reading, and a logged-in app with dense forms and tables.
Inputs we chose. Viewport range 360px to 1280px. Base 16px. Minimum sizes from a 1.2 ratio (calmer on phones), maximum sizes from a 1.333 ratio (more drama on desktops). Sizes rounded to whole pixels before deriving clamp() values.
| Token | Min (1.2 ratio) | Max (1.333 ratio) | clamp() value | Growth at 200% zoom, 1280px window |
|---|---|---|---|---|
| --font-display | 40px | 67px | clamp(2.5rem, 1.8397rem + 2.9348vw, 4.1875rem) | 1.44× |
| --font-h1 | 33px | 50px | clamp(2.0625rem, 1.6467rem + 1.8478vw, 3.125rem) | 1.53× |
| --font-h2 | 28px | 38px | clamp(1.75rem, 1.5054rem + 1.087vw, 2.375rem) | 1.63× |
| --font-h3 | 23px | 28px | clamp(1.4375rem, 1.3152rem + 0.5435vw, 1.75rem) | 1.75× |
| --font-body | 16px | 16px | 1rem | 2.00× |
| --font-caption | 12.8px | 12.8px | 0.8rem | 2.00× |
How the growth column was computed, using display as the example: intercept I = 29.435px, vw part at 1280px V = 0.029348 × 1280 = 37.565px. Growth = (2 × 29.435 + 37.565) ÷ 67 = 96.435 ÷ 67 = 1.44.
None of these heading tokens meets MDN's rule of thumb that the maximum should be at least twice the minimum: their max-to-min ratios run from about 1.2 (h3) to about 1.7 (display). The growth column shows what that trade costs under zoom, which is the information a team needs to decide whether to accept it.
What the table told the team. The bigger the gap between min and max, the larger the vw share and the less the heading grows under zoom. Display, which marketing wanted most dramatic, is also the weakest under zoom. The team kept it because display text appears only in hero sections, already huge at 67px, but they set a rule that display style is never used for anything a reader must act on, such as form instructions or prices.
Surface-specific choices. The blog uses 1.125rem body text with --leading-body at 1.7 and a 65ch container. The app uses the same tokens but never uses display or h1 inside the logged-in area; its page titles use h2. That keeps dense screens compact without a second scale.
What they refused. Requests for "h2 but slightly smaller" for a pricing card went to h3. A request for a 15px "compact body" for tables became a review item. The team tested 0.875rem (14px) tables against real data, accepted it as a named --font-table token, and documented that it is for tabular data only.
The verification pass. Before shipping, they set a real hero headline, a real 1,200-word blog post and a real settings form in the tokens, then checked: does each heading step look clearly distinct at both 360px and 1280px; does the blog body stay under 80 characters per line; do labels survive the 1.4.12 spacing overrides without clipping; and do headings still grow at 200% zoom on a wide window. The last check is the one that produced the growth column.
Font choice changes how the scale looks
A scale controls size relationships, which are independent of the font. But fonts with the same nominal size can look very different because their lowercase letters are drawn at different heights relative to the font size. A 16px body in a face with a tall x-height reads larger than 16px in a face with a small one. Two consequences:
- Check heading-to-body contrast in the real typeface. A 1.2 ratio that looks right in one family can look flat in another.
- Fallback fonts shift layout. If your web font fails to load and the fallback runs smaller or larger, line breaks and heading wraps change. Our web fonts troubleshooting guide covers why fonts fail and how to reduce the visible shift.
For pairing, the lowest-risk option is one family in several weights, which a variable font can provide from a single file (see our variable fonts guide). Two families work when the contrast is obvious, such as a distinctive display face over a neutral text face. Test pairings with real content, a headline, a paragraph and a button, not in a type specimen. Our guide to choosing fonts for web design goes further on selection and licensing.
Common mistakes and how to fix them
| Mistake | Why it hurts | Fix |
|---|---|---|
| Ten slightly different small sizes | Hierarchy disappears; nobody knows which to use | Lock to caption, small and body; review any new size |
| Font sizes in px | MDN notes px font sizes cannot be changed by the user in some browsers | Write tokens in rem |
| Fluid body text | Body stops matching the reader's default and grows less under zoom | Keep body at 1rem or a fixed rem value |
| Line height in px | Inherited as a fixed number, so larger text below it overlaps | Unitless line heights |
| Fixed-height text containers | Clip when users apply 1.4.12 spacing overrides | Padding plus min-height |
| Copying clamp() values from a blog post | The original viewport range is unknown, so the curve is a guess | Derive from stated min and max viewports |
| Golden ratio for a five-level app | Fifth step reaches about 177px from a 16px base | Use 1.2 to 1.25 for many levels |
| Centered multi-line paragraphs | Ragged left edge makes each line start in a new place | Left-align body; center only short display lines |
Frequently asked questions
What ratio should a product interface start with?
Start with 1.2 if the product has many levels of headings and lots of small text, and 1.25 if it mixes app screens with marketing pages. Then adjust individual steps if they look wrong in your typeface. Material Design 3 and Carbon both hand-tune their published sizes, so a pure ratio is a draft, not a rule.
Is 16px a required minimum for body text?
No WCAG success criterion sets a minimum font size. 16px matters because it is the usual browser default, per MDN, so body text at 1rem matches what the reader's browser would choose. Readers who raised their default get larger text automatically. Setting body text below 1rem overrides that preference for every reader.
How many sizes should a type scale contain?
Six to eight named sizes cover most products: display, h1, h2, h3, body, small or caption, and perhaps one specialist size such as a table font. If you find yourself needing a twelfth size, the usual cause is unclear hierarchy on a specific screen, which a redesign of that screen solves better than a new token.
Does fluid type pass WCAG 1.4.4?
It can, but it is not automatic. Text sized only in vw is a documented failure (F94). Text sized with rem bounds plus a vw middle grows under zoom, but by less than 2 times on wide windows, using the (2I + V) ÷ (I + V) arithmetic shown above. Measure your headings at 200% zoom on your widest layout and reduce the vw share if they fall short.
Should line height be 1.5 everywhere to meet WCAG?
No. Criterion 1.4.12 requires that content still works when a user forces line height to 1.5; it does not require you to set it. The Level AAA criterion 1.4.8 asks for a mechanism to get space-and-a-half line spacing in blocks of text. Tight leading on large headings is fine as long as nothing clips when the override is applied.
Do type tokens belong in rem, px or em?
Use rem for font-size tokens, unitless numbers for line height, and reserve em for spacing that should follow the local font size, such as padding inside a button. MDN explains that em values compound when nested, which is why rem was added and why it is the safer unit for a shared scale.
Type scale sources and check dates
Each figure, rule and version note above was checked against these sources on October 22, 2026:
- MDN, clamp(): syntax, the max(MIN, min(VAL, MAX)) resolution, Baseline status since July 2020, and the guidance to keep the maximum at least twice the minimum for text. https://developer.mozilla.org/en-US/docs/Web/CSS/clamp (checked October 22, 2026)
- MDN, font-size: the usual 16px browser default, em compounding, rem, and the accessibility problem with px font sizes. https://developer.mozilla.org/en-US/docs/Web/CSS/font-size (checked October 22, 2026)
- W3C, Understanding WCAG 2.2 SC 1.4.4 Resize Text. https://www.w3.org/WAI/WCAG22/Understanding/resize-text.html (checked October 22, 2026)
- W3C, WCAG 2.2 failure technique F94, viewport units for text. https://www.w3.org/WAI/WCAG22/Techniques/failures/F94 (checked October 22, 2026)
- W3C, Understanding WCAG 2.2 SC 1.4.12 Text Spacing. https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html (checked October 22, 2026)
- W3C, Understanding WCAG 2.2 SC 1.4.8 Visual Presentation. https://www.w3.org/WAI/WCAG22/Understanding/visual-presentation.html (checked October 22, 2026)
- Flutter API reference, TextTheme class: the 15 Material 3 text styles with sizes and line heights. https://api.flutter.dev/flutter/material/TextTheme-class.html (checked October 22, 2026)
- Material Web, typography theming docs: typescale roles and token naming. https://github.com/material-components/material-web/blob/main/docs/theming/typography.md (checked October 22, 2026)
- IBM Carbon Design System, type sets: productive and expressive sets, body-01 and body-02 sizes. https://carbondesignsystem.com/elements/typography/type-sets/ (checked October 22, 2026)
- GitHub Primer, typography foundations: rem tokens and the roughly 80-character line guidance. https://primer.style/foundations/typography (checked October 22, 2026)
- Utopia fluid type scale calculator. https://utopia.fyi/type/calculator/ (checked October 22, 2026)
Next step
The scale only works once it lives in a token set that the whole team reads from. Our design system from scratch guide shows where these type tokens sit next to color, spacing and component tokens, and how to stop new one-off sizes from creeping back in.