Skip to main content
AllDevToolsHub
🖋️

Type Scale Generator

100% Local

Calculate harmonious typography scales for your design systems.

Type Scale Generator
Type Scale Generator
Build a harmonious typography system based on mathematical scales.
Common: 16px

"A modular scale is a sequence of numbers that relate to one another in a meaningful way."

Visual Hierarchy Preview

Ratio: 1.25
H1

2.441rem

The quick brown fox jumps over the lazy dog
H2

1.953rem

The quick brown fox jumps over the lazy dog
H3

1.563rem

The quick brown fox jumps over the lazy dog
H4

1.250rem

The quick brown fox jumps over the lazy dog
Body

1.000rem

The quick brown fox jumps over the lazy dog
Small

0.800rem

The quick brown fox jumps over the lazy dog
Tiny

0.640rem

The quick brown fox jumps over the lazy dog

Heading Demo with Major Third

This preview demonstrates how your typography will look in a real content block. Good typography is about the relationship between sizes.

Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Set a base size and ratio (major third, perfect fourth, etc.). The scale generates with rem values.

Overview

What is Type Scale Generator?

Design consistent visual hierarchies using mathematical scales like the Golden Ratio or Major Third. Preview font sizes live and export CSS variables to ship.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

DESIGN TOOLS

Type Scale Generator

Design consistent visual hierarchies using mathematical scales like the Golden Ratio or Major Third. Preview your font sizes in real-time and export CSS variables for your project.

🎨

Pixel-Precise Output

Generates CSS, tokens, or assets that match what your design system expects.

👀

Live Visual Preview

See changes the moment you make them, no copy-paste cycle between tool and IDE.

📋

Copy-Paste Ready

Output is formatted for direct use in stylesheets, Tailwind configs, or Figma tokens.

Type Scales: Math Applied to Typography

A type scale is a set of font sizes related by a fixed ratio. Pick a base (commonly 16px), pick a ratio (commonly 1.25), and each step multiplies: 16 → 20 → 25 → 31.25 → 39.06 → 48.83. The result is a hierarchy that feels intentional rather than arbitrary, because the same ratios that produce harmonious musical intervals also produce harmonious typographic ones.

This tool generates a scale, previews it on sample text, and exports the values as CSS variables or a Tailwind config, so you skip the calculator step.

The Ratios

Name Ratio Where it comes from
Minor Second 1.067 Adjacent piano keys (semitone)
Major Second 1.125 Whole tone interval
Minor Third 1.2 Three semitones
Major Third 1.25 Four semitones, the most popular for UI
Perfect Fourth 1.333 Five semitones
Augmented Fourth 1.414 √2, the tritone
Perfect Fifth 1.5 Seven semitones, first overtone
Golden Ratio (φ) 1.618 Math's most famous irrational
Major Sixth 1.667
Octave 2.0 Double frequency

The names come from music theory (interval ratios), but the math works for any scaled set.

Why these specific ratios feel good

They're whole-number ratios of small integers (1.5 = 3:2, 1.333 = 4:3, 1.25 = 5:4) or famous irrationals (φ, √2). Human perception evolved to prefer them, most music, classical architecture, and visual art uses them. Typography follows.

Building a Scale

Pick:

  1. Base size: usually 16px (1rem) for web. 18px for content-heavy sites. 14px for dense data tables.
  2. Ratio: 1.25 default; 1.333 for content; 1.5+ for editorial.
  3. Steps: how many sizes you need above and below base.
Example: 1.25 ratio, base 16px
Step Size rem
-2 10.24px 0.64rem
-1 12.8px 0.8rem
0 16px 1rem
1 20px 1.25rem
2 25px 1.5625rem
3 31.25px 1.953rem
4 39.06px 2.441rem
5 48.83px 3.052rem
Round or keep fractional?

Rounding to whole pixels: helps with crisp rendering at common sizes, but loses the precise mathematical relationship. Modern browsers handle fractional values well (especially at high-DPI). Recommend: round to 2 decimals in rem (avoid 6-decimal noise) but don't force whole pixels.

Naming
Step T-shirt name Semantic name
-2 xs / 2xs caption / overline
-1 sm small
0 base / md body
1 lg h5 / subtitle
2 xl h4
3 2xl h3
4 3xl h2
5 4xl h1

T-shirt names are flexible (Tailwind convention). Semantic names tie to content structure (Material Design). Pick one and stick with it.

Export Formats

CSS custom properties
Tailwind config
Sass variables

Line Heights

Line heights vary inversely with font size:

Size Recommended line-height
Display (h1, 48px+) 1.0 – 1.2
Headings (h2-h4, 20-40px) 1.2 – 1.4
Body (16-18px) 1.5 – 1.6
Small / caption (12-14px) 1.5 – 1.7

Larger text fills more horizontal space; doesn't need as much vertical breathing room. Small text is harder to read; needs more.

Setting both
Unitless vs numeric line-height

line-height: 1.5 (unitless) multiplies by element's font-size, scales correctly. line-height: 24px is absolute, doesn't scale. Use unitless.

Letter Spacing

Inverse of line-height: larger sizes can have tighter spacing; smaller sizes wider.

Size Letter-spacing
Display (h1) -0.02em to -0.04em
Headings (h2-h4) -0.01em to 0
Body 0
Small / caption 0.01em to 0.025em
All-caps labels 0.05em to 0.1em
CSS custom properties

Fluid Typography with `clamp()`

Static type scales break on mobile (h1 too large) or desktop (h1 too small). clamp() solves it:

clamp(min, preferred, max), interpolates smoothly between min and max based on viewport width.

Generator formula

For a min size Min at viewport Vmin and max size Max at viewport Vmax:

There are calculators (utopia.fyi) for this; manual math gets tedious.

Why fluid type wins
  • No media queries.
  • No hard breakpoints in size (smooth interpolation).
  • Mobile-first works automatically.
  • Less code overall.

Trade: harder to read the CSS; designers must specify min/max instead of "20px at this breakpoint."

Common Mistakes

Using `px` for body text

Px overrides user accessibility settings. Some users set 20px default for readability; px-defined sites ignore them.

Too many sizes

A scale with 12+ sizes invites inconsistency. Pick 5–8. If you need more for a one-off, set inline rather than adding to the system.

Inconsistent ratios

Don't mix ratios within one scale. If using 1.25, don't add an arbitrary "this should be 23px", it breaks the mathematical relationship.

Display sizes too dramatic on mobile

A 1.5 ratio at base 16px gives h1 = ~80px. On mobile, that's screen-filling. Use fluid type or a separate mobile scale.

Forgetting line-height adjustment

Same line-height for body and display = display feels cramped (line-height too tight) or body too airy (line-height too loose). Vary inversely.

Letter-spacing for ALL CAPS body text

Body text in ALL CAPS at default letter-spacing reads as one blur. Always add tracking (letter-spacing: 0.05em) to all-caps to make individual letters distinguishable.

Practical Setup

CSS Variables file
Tailwind theme

Tailwind's font-size utility takes [size, { lineHeight }] tuples, pairs size with appropriate leading.

Material Design type scale (reference)

Material's 2014–2018 spec used 13 styles:

Headline 1-6, Subtitle 1-2, Body 1-2, Button, Caption, Overline.

More granular than most apps need, but solid as a reference for what professional type systems include.

Privacy

The generator is local math: base * ratio^step for each step, rendered as CSS / Tailwind / Sass text. Open DevTools Network during use: zero outbound requests. Type scale parameters aren't sensitive content, but the principle of "work locally unless you ask to upload" applies, there's no reason to send these values to a server. The tool runs in your browser.

You Might Also Need