Modular Typography Scale Calculator
This modular typography scale calculator generates mathematically harmonious font-size systems using musical ratios. Set a base size (16px) and ratio (golden ratio 1.618, perfect fourth 1.333, major third 1.25), and it calculates H1 through body text sizes automatically. Outputs production-ready CSS in rem, em, or px with live visual previews. Designers use this to create consistent typographic hierarchies without guessing sizes. Eliminates visual inconsistency, speeds up design handoffs, and ensures accessibility-friendly proportions. Free with instant CSS export. Method details for Modular Typography Scale Calculator: The generator uses deterministic layout, grid, and typography rules, tracks contrast and palette decisions, and preserves gradient/pixel/vector fidelity in the output.
Typography Scale
Visual Preview
CSS Code
How to Use This Tool
- Set Base Size - Enter your body text size (default 16px for web). This becomes the anchor for all other sizes
- Choose Scale Ratio - Select a musical ratio: Golden Ratio (1.618) for dramatic contrast, Perfect Fourth (1.333) for moderate hierarchy, or Major Third (1.25) for subtle differences
- Select Unit - Pick rem (recommended for responsive design), em (relative to parent), or px (fixed sizing)
- Copy CSS & Preview - View live size previews, then click Copy CSS to grab ready-to-paste stylesheet rules for H1-H6, body, and small text
Why Use This Tool?
Modular scales use geometric progressions to create visual harmony. Instead of arbitrary sizes (H1: 32px, H2: 24px, H3: 19px), you multiply a base by a ratio repeatedly. Base 16px × ratio 1.25 (major third) = 20px (H5), 25px (H4), 31.25px (H3), 39px (H2), 48px (H1). Each step maintains the same proportional relationship, like musical intervals (major third = 5:4 frequency ratio). This creates consistent visual rhythm, the same principle behind Fibonacci sequences in nature and Renaissance architecture.
Designers struggle with inconsistent font sizes across components. One screen has H2 at 24px, another at 28px, creating visual clutter. Modular scales enforce discipline: every heading size is calculated, not guessed. Tailwind CSS uses a preset scale (text-xl, text-2xl), but custom brands need unique ratios. Material Design uses a 1.125 scale, IBM Carbon uses 1.2. A tighter ratio (1.067) suits dense UIs (dashboards), while looser ratios (1.618 golden ratio) suit editorial layouts (magazines, blogs).
This tool uses Math.pow(ratio, power) to calculate each scale step. Power 0 = base size, power 1 = base × ratio, power 4 = base × ratio^4 (H1). The rem unit divides pixel values by 16 (browser default) for scalability. Visual previews render actual HTML heading tags styled with calculated sizes so you see real proportions before committing. Use golden ratio (1.618) for maximum contrast, perfect fifth (1.5) for balanced hierarchy, or minor second (1.067) for tight spacing. Export CSS variables (--font-base) for easy theme switching in design systems.