Golden Ratio & Modular Typography Scale Calculator

Generate a harmonious type scale from a base font size and ratio, such as the golden ratio (1.618) or a perfect fourth, with CSS custom properties.

Updated · Free · Runs in your browser

px
H1 —
H2 —
H3 —
Body —
Small text —
Line length —
CSS variables —
    Was this calculator helpful?

    Type scale

    The formula

    Size at step k = base size × ratio^k (k = −2 … 7)
    Golden ratio φ = (1 + √5) ÷ 2 ≈ 1.618
    Line height (px) = font size × line-height ratio
    Comfortable line length ≈ 45–75 characters (about 66 is often cited as ideal)

    Worked example

    1. Base 16px with a major third ratio (1.25):
    2. lg = 20px, xl = 25px, 2xl = 31.25px, 3xl = 39.06px, 4xl = 48.83px and 5xl (H1) = 61.04px.
    3. Smaller steps: sm = 12.8px, xs = 10.24px.
    4. With a 1.5 line height, body text has 24px lines. With the golden ratio instead, H1 would be 16 × 1.618⁶ = 287px — far too large, so steep ratios suit fewer heading levels.

    What a modular type scale is

    A modular scale is a sequence of font sizes where each size is the previous one multiplied by the same ratio. Starting from a 16px body size and a ratio of 1.25, the sizes go 16, 20, 25, 31.25 and so on. Because every size is related to every other by the same proportion, headings, body text and captions feel like part of one system. Designers borrowed the idea from music, where intervals such as the perfect fourth and perfect fifth have simple frequency ratios, which is why many scale names are musical.

    Choosing a ratio

    Small ratios such as the minor second (1.067) or major second (1.125) create subtle differences, suited to dense interfaces, dashboards and long-form reading on small screens. Medium ratios such as the minor third (1.2) and major third (1.25) are popular general-purpose choices. Large ratios such as the perfect fifth (1.5) and golden ratio (1.618) create dramatic contrast, best for marketing pages and editorial layouts with few heading levels. Many responsive designs use a smaller ratio on mobile and a larger one on desktop.

    The golden ratio

    The golden ratio, φ ≈ 1.618, appears in geometry, the Fibonacci sequence and, by many accounts, in classical art and architecture, though some historical claims are exaggerated. In typography it creates strong hierarchy, but it grows quickly: just three steps up from 16px is 67.8px. Use it with few heading levels, or apply it to layout proportions, such as content and sidebar widths, rather than to every font size. A golden line height, 1.618, gives airy, readable body text for wide columns.

    Line height and line length

    Body text is most comfortable with a line height of about 1.4–1.6 times the font size; headings need less, often 1.1–1.3, because large text with wide spacing looks disjointed. Line length matters just as much: around 45–75 characters per line, with 66 often cited as ideal, keeps the eye from getting lost when returning to the next line. The calculator estimates a comfortable column width for your body size. In CSS, max-width: 66ch is a quick way to set it.

    Using the CSS output

    The calculator outputs CSS custom properties in rem, such as --text-lg: 1.25rem, which you can paste into a :root rule and use throughout your stylesheet. Rounding sizes to whole or half pixels is common and harmless. For responsive designs, you can combine scale steps with clamp() so sizes grow smoothly between a mobile and a desktop scale. Our px to rem converter handles one-off conversions.

    Fluid type scales

    A fluid scale interpolates between a small-screen and a large-screen scale using CSS clamp() and viewport units, so headings grow smoothly as the window widens rather than jumping at breakpoints. For example, an H1 could run from 2rem on a 360px phone to 3.8rem on a 1,280px desktop. Keep body text close to fixed, and let larger steps scale more, since big headings are where screen-size differences matter most.

    Accessible, readable type

    Whatever scale you choose, keep body text at least 16px on screen, ensure sufficient contrast with our WCAG contrast checker, and use rem units so text respects users' font-size settings. Clear hierarchy also helps search engines and screen readers when it matches proper heading tags. For checking the readability of your copy itself, try the Flesch–Kincaid calculator, and for print layouts, the DPI calculator.

    Frequently asked questions

    What is a good type scale ratio?
    For most websites, 1.2 (minor third) to 1.333 (perfect fourth). Use smaller ratios for data-heavy apps and larger ones for marketing pages with few heading levels.
    How do I use the golden ratio in typography?
    Multiply your base font size by 1.618 for each step up the hierarchy. For a 16px base, the next sizes are about 25.9px and 41.9px.
    What line height should body text have?
    Around 1.4–1.6 times the font size. 1.5 is a common default for web body text.
    What is the ideal line length?
    Around 45–75 characters per line, with about 66 characters often recommended for comfortable reading.
    Should headings use rem or px?
    Rem, so they scale with the user's font-size preference along with body text.

    ↑↓ to navigate · Enter to open