Modular Type Scale Generator
Choose a base size and a musical-interval ratio, and this generator builds a modular type scale where each step multiplies the one below it by the ratio. It lists every step in px and rem with a live preview and outputs ready-to-paste CSS custom properties. Eight named ratios from a subtle minor second up to the golden ratio cover everything from dense dashboards to editorial headlines.
How to generate a type scale
- Set the Base size (px) field, usually 16 to match the browser default.
- Pick a ratio from the Ratio dropdown, such as Major third (1.25) or Perfect fourth (1.333).
- Enter how many rungs you want in Steps up for larger sizes.
- Enter Steps down for smaller sizes like captions and fine print.
- Read the px, rem and preview columns, then copy the CSS custom properties block below.
Examples
Major third from 16px, 3 up and 1 down
Base 16px, ratio 1.25, steps up 3, steps down 1
px steps: 12.8, 16, 20, 25, 31.25
Perfect fifth from 16px, 2 up and 0 down
Base 16px, ratio 1.5, steps up 2, steps down 0
px steps: 16, 24, 36
Golden ratio from 16px, 1 up and 1 down
Base 16px, ratio 1.618, steps up 1, steps down 1
px steps: 9.89, 16, 25.89
Frequently asked questions
What is a modular type scale?
A modular scale sizes type by repeatedly multiplying a base size by a fixed ratio. The formula for each rung is base size times the ratio raised to the step number, so the shared ratio keeps headings and body text visually consistent.
Which ratios can I choose?
Eight named ratios are offered: minor second 1.067, major second 1.125, minor third 1.2, major third 1.25, perfect fourth 1.333, augmented fourth 1.414, perfect fifth 1.5 and golden ratio 1.618.
Which ratio should I use?
Smaller ratios such as the minor third 1.2 suit dense interfaces and long lists, while larger ones like the perfect fourth 1.333 or golden ratio 1.618 create bold, editorial contrast between headings and body text.
How is the rem value calculated?
Each rem figure is the pixel size divided by 16, the default browser root font size, rounded to four decimals. Using rem keeps your scale responsive to a reader's own font-size preference.
How are the numbers rounded?
Pixel values are rounded to two decimal places and rem values to four. So a major third from 16 gives 20, 25 and 31.25 pixels going up, and 12.8 pixels one step down.
What does step 0 mean?
Step 0 is your base size itself. Positive steps climb upward for headings and hero text, while negative steps descend for small print, labels and captions.
What are the CSS custom properties for?
The block at the bottom lists each rung as a variable like --step-2 with its rem value and a pixel comment. Copy it into your stylesheet and reference the variables so every size in your design comes from one scale.
Can I add more steps later?
Yes. Increase Steps up or Steps down at any time and the table and CSS regenerate instantly. Both fields floor to whole numbers and never go below zero, so fractional or negative entries are clamped.
Is anything uploaded?
No. The whole scale is computed in your browser as you adjust the inputs, so nothing is ever sent to a server.
Learn more
- Choosing a modular scale ratio for your interface
How to pick between a minor third, major third, perfect fourth and the golden ratio, and how base size and step count shape the result.
Related tools
CSS Unit Converter
Convert between CSS units px, rem, em and pt online. Set the root font size, enter a value, and get the result in every unit instantly.
Golden Ratio Calculator
Split any length by the golden ratio (phi, 1.618). Enter the whole, the longer or the shorter segment and get the matching golden proportions instantly.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
ASCII Table
Full ASCII table for all 128 codes with decimal, hex, octal and binary values, character names and descriptions. Search by code, hex or character.
Aspect Ratio Box Generator
Generate CSS for a responsive aspect-ratio container. Use the modern aspect-ratio property or the padding-top fallback, then copy the ready code.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.