Modular Scale Generator
Our typography & graphic design calculator teaches modular scale step by step. Perfect for students, teachers, and self-learners.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Modular Scale Generator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Value = Base x Ratio^Step
Worked example โ 9 values from 10.24px to 61.04px | Range: 5.96x | Major Third ratio
Formula
Value = Base x Ratio^Step
Each value in the modular scale is calculated by raising the ratio to the power of the step number and multiplying by the base value. Step 0 is the base value, positive steps generate larger values, and negative steps generate smaller values. The ratio determines how dramatically values change between consecutive steps.
Worked Examples
Example 1: Design System Type Scale
Problem:Create a modular scale for a design system with 16px base, Major Third ratio (1.25), 6 steps up and 2 steps down. What are all the values?
Solution:Base: 16px, Ratio: 1.25 (Major Third / 4:5) Step -2 (xs): 16 x 1.25^-2 = 10.24px (0.64rem) Step -1 (sm): 16 x 1.25^-1 = 12.80px (0.80rem) Step 0 (base): 16.00px (1.00rem) Step 1 (lg): 16 x 1.25^1 = 20.00px (1.25rem) Step 2 (xl): 16 x 1.25^2 = 25.00px (1.5625rem) Step 3 (2xl): 16 x 1.25^3 = 31.25px (1.9531rem) Step 4 (3xl): 16 x 1.25^4 = 39.06px (2.4414rem) Step 5 (4xl): 16 x 1.25^5 = 48.83px (3.0518rem) Step 6 (5xl): 16 x 1.25^6 = 61.04px (3.8147rem) Total range: 61.04 / 10.24 = 5.96x
Result:9 values from 10.24px to 61.04px | Range: 5.96x | Major Third ratio
Example 2: Double-Stranded Scale for Editorial Layout
Problem:An editorial website needs a richer scale. Use bases of 16px and 20px with a Perfect Fourth ratio (1.333), 4 steps up. Generate the merged scale.
Solution:Primary strand (base 16): 16 x 1.333^0 = 16.00px 16 x 1.333^1 = 21.33px 16 x 1.333^2 = 28.43px 16 x 1.333^3 = 37.90px 16 x 1.333^4 = 50.52px Secondary strand (base 20): 20 x 1.333^0 = 20.00px 20 x 1.333^1 = 26.66px 20 x 1.333^2 = 35.54px 20 x 1.333^3 = 47.37px 20 x 1.333^4 = 63.14px Merged (sorted): 16, 20, 21.33, 26.66, 28.43, 35.54, 37.90, 47.37, 50.52, 63.14 10 distinct values providing finer granularity.
Result:10 values from 16px to 63.14px | Double-stranded provides 5 additional intermediate sizes
Frequently Asked Questions
What is a modular scale in design?
A modular scale is a sequence of numbers that relate to one another through a consistent ratio, creating a harmonious set of proportions for design decisions. Rooted in musical theory (where notes relate through mathematical ratios), modular scales provide designers with predetermined values for typography, spacing, layout, and other dimensional decisions. Instead of choosing arbitrary numbers, a designer picks a base value and a ratio, then generates all sizes mathematically. For example, with a base of 16px and a ratio of 1.25, the scale produces 16, 20, 25, 31.25, 39.06, and so on. This mathematical foundation creates visual harmony because all values share proportional relationships.
How do I choose the right ratio for my modular scale?
The ratio should match the visual character and practical needs of your project. Smaller ratios like Minor Second (1.067) or Major Second (1.125) produce subtle differences between steps, ideal for data-dense interfaces, dashboards, and applications where many distinct but similar sizes are needed. Medium ratios like Minor Third (1.2) and Major Third (1.25) offer a good balance for most web projects, providing enough contrast for clear hierarchy without extreme size jumps. Larger ratios like Perfect Fifth (1.5) or Golden Ratio (1.618) create dramatic, editorial-style contrasts suitable for marketing sites, portfolios, and print design where visual impact takes priority over information density.
What is a double-stranded modular scale?
A double-stranded modular scale uses two base values with the same ratio, creating a richer set of proportional values. For example, using bases of 16px and 18px with a 1.25 ratio generates two interleaved scales that provide more size options while maintaining mathematical harmony. This technique was popularized by designer Tim Brown and is useful when a single-stranded scale does not provide enough intermediate values. The second base might be derived from a meaningful proportion in the design, such as the body text size and the sidebar width. The resulting merged scale offers more flexibility while preserving the proportional relationships that make modular scales visually coherent.
How do modular scales relate to musical intervals?
Modular scales in design borrow directly from musical harmony, where notes relate through mathematical frequency ratios. The Perfect Fifth (2:3 ratio, or 1.5) produces the same proportional relationship between design values as between musical notes a fifth apart. The Golden Ratio (approximately 1.618) appears throughout nature and art. The Octave (2:1) doubles the value with each step, creating the most dramatic contrast. These musical intervals have been recognized as pleasing proportions for centuries, and their application to typography and layout leverages the same innate human preference for harmonic relationships. The terminology helps designers communicate about proportional systems using shared musical vocabulary.
How do I implement a modular scale in CSS?
The most maintainable CSS implementation uses custom properties (variables) on the root element. Define each scale value as a variable: --scale-0: 1rem; --scale-1: 1.25rem; --scale-2: 1.5625rem, and so on. Reference these throughout your stylesheet for font-size, margin, padding, and gap values. CSS preprocessors like Sass can calculate scale values automatically using a function. For example, you can create a Sass function that takes a step number and returns baseValue * pow(ratio, step). Modern CSS with calc() can approximate this but lacks a native power function. Several CSS frameworks and PostCSS plugins like postcss-modular-scale automate this process entirely.
Can modular scales be used for spacing and layout, not just typography?
Absolutely. While modular scales are most commonly associated with typography, applying the same scale values to spacing (margins, padding, gaps) and layout dimensions creates a unified proportional system across the entire design. Using scale values for component padding, section margins, grid gaps, and border radii ensures that every dimensional decision reinforces the same visual rhythm. For example, if your type scale step-2 equals 25px, using 25px as a standard spacing unit creates visual alignment between text hierarchy and spatial organization. This holistic approach to proportional design is a hallmark of well-crafted design systems and creates a subtle but perceptible sense of visual order.
What are the limitations of modular scales?
Modular scales have practical limitations that designers should understand. The mathematical rigidity can produce values that do not match practical needs. For instance, a scale might not include a size that works well for navigation text or button labels. The exponential growth of larger ratios can produce impractically large heading sizes. Single-stranded scales may have too few intermediate values for complex interfaces. Fractional pixel values can cause subpixel rendering issues in browsers. Additionally, strict adherence to a modular scale can prioritize mathematical purity over practical usability. Experienced designers treat modular scales as guidelines rather than rules, rounding values to practical numbers and adding exceptions where the design demands it.
How do popular design systems use modular scales?
Major design systems adapt modular scale principles with practical modifications. Material Design uses a custom type scale with specific size and weight combinations that approximate a modular scale but includes manual adjustments for usability. Tailwind CSS provides a type scale (text-xs through text-9xl) based loosely on a Major Third ratio with rounded values. IBM Carbon Design System uses a custom ratio with specific breakpoint adjustments. Bootstrap uses a simplified scale for headings. Most production design systems start with a modular scale foundation but round values to whole pixels, adjust specific sizes for practical needs, and add responsive modifications. The scale provides the proportional starting point, not the final specification.
How do I adjust a modular scale for responsive design?
Responsive modular scales typically use a tighter ratio for small screens and a wider ratio for large screens. For mobile (320-768px), a Minor Third (1.2) or Major Second (1.125) ratio prevents headings from overwhelming the small viewport. For desktop (1024px+), a Major Third (1.25) or Perfect Fourth (1.333) ratio creates more dramatic hierarchy appropriate for larger screens. The base value may also increase from 14-16px on mobile to 16-18px on desktop. CSS clamp() can create fluid transitions between these scales without breakpoints. Alternatively, define separate scale custom properties at each breakpoint. The Utopia fluid type scale calculator automates this approach for web projects.
What base value should I use for a modular scale?
The base value should be your primary body text size, as all other values in the scale will be derived from it. For web design, 16px (the browser default) is the most common base value, providing comfortable readability and clean mathematical relationships. Some designers prefer 18px for content-heavy sites or 14px for data-dense applications. If you know specific dimensions in your design (like a sidebar width or image size), these can serve as secondary bases in a double-stranded scale. The base value in a modular scale is analogous to the tonic note in music, serving as the reference point from which all other proportional values derive their meaning and relationship.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎArchitectural Scale Converter
Calculate architectural scale converter with inputs, formulas, and instant results.
๐งฎFloor Plan Scale Estimator
Calculate floor plan scale estimator with inputs, formulas, and instant results.
๐งฎInterior Design Scale Calculator
Calculate interior design scale with inputs, formulas, and instant results.
๐งฎProportion Scale Calculator
Calculate proportion scale with inputs, formulas, and instant results.
๐งฎDesign Layout Golden Grid Generator
Calculate design layout golden grid generator with inputs, formulas, and instant results.
๐งฎGrading Scale Converter
Calculate grading scale converter with inputs, formulas, and instant results.
๐งฎCitation Generator
Calculate citation generator with inputs, formulas, and instant results.
๐งฎCollege GPA Calculator (4.0 Scale + Target Grade)
Calculate college gpa with inputs, formulas, and instant results.