Modular Scale Generator

Build a harmonious type scale from a base size and ratio.

Free modular scale generator. Pick a base size and a typographic ratio to generate a harmonious font-size scale in px and rem, with steps up and down. Runs entirely in your browser — nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is a modular scale?

A modular scale is a sequence of sizes derived by repeatedly multiplying a base value by a fixed ratio. It produces font sizes that feel harmonious because each step shares the same proportional relationship.

A modular scale is a sequence of font sizes built by repeatedly multiplying a base size by a fixed ratio, so every step shares the same proportion and the typography feels coherent. This generator outputs the full scale in both px and rem, for designers and front-end developers setting up a type system.

How it works

Step 0 is the base size; each step is the base multiplied by the ratio raised to the step number:

size at step n = base × ratio to the power n

Positive steps grow larger, negative steps shrink below the base. The rem value is each size divided by the base. Pick a base, choose a named ratio (minor second 1.067 through the golden ratio 1.618), and set how many steps up and down you need.

Worked example — major third at 16px

With a 16px base and the major third ratio (1.25):

StepCalculationpxremTypical use
316 × 1.25³31.251.953H1
216 × 1.25²251.5625H2
116 × 1.25¹201.25H3 / lead text
016 × 1.25⁰161Body (base)
-116 ÷ 1.2512.80.8Caption / label

The jump from step 0 to step 3 gives a headline roughly twice the base — visually distinct without being jarring. Smaller ratios like 1.2 keep sizes closer together (good for dense UIs), while larger ratios like 1.618 create bolder contrast (good for editorial pages with clear hierarchy).

Choosing the right ratio

Ratio nameValueCharacter
Minor second1.067Very subtle — tight, information-dense layouts
Major second1.125Compact — forms, tables, dashboards
Minor third1.2Moderate — general-purpose web apps
Major third1.25Common default — balanced contrast
Perfect fourth1.333Noticeable hierarchy — marketing sites
Golden ratio1.618Dramatic — editorial, portfolios

Larger ratios mean fewer steps fit between body text and a usable smallest size. If you use 1.618 and need six heading levels, the top levels quickly become impractically large. Major third (1.25) or perfect fourth (1.333) are the most-used choices for typical web projects.

Applying the scale in CSS

The most maintainable approach is to define the scale as CSS custom properties, then assign semantic names:

:root {
  --text-xs:   0.8rem;   /* step -1 */
  --text-sm:   1rem;     /* step 0 (base) */
  --text-md:   1.25rem;  /* step 1 */
  --text-lg:   1.5625rem;/* step 2 */
  --text-xl:   1.953rem; /* step 3 */
  --text-2xl:  2.441rem; /* step 4 */
}

Components use the semantic names (var(--text-lg)) rather than raw pixel values, so swapping to a different ratio or base only requires updating the root block.

The full scale is generated instantly, all in your browser.