Modular Type Scale Generator
Build a typographic ramp from any base and ratio, preview every step, and export CSS variables, Tailwind config, SCSS or JSON. Fluid clamp() lines included.
Export
10 steps · css:root {
--step-xs: 0.56rem;
--step-sm: 0.75rem;
--step-base: 1rem;
--step-lg: 1.33rem;
--step-xl: 1.78rem;
--step-2xl: 2.37rem;
--step-3xl: 3.16rem;
--step-4xl: 4.21rem;
--step-5xl: 5.62rem;
--step-6xl: 7.49rem;
--step-xs-line-height: 1.5;
--step-sm-line-height: 1.5;
--step-base-line-height: 1.5;
--step-lg-line-height: 1.4;
--step-xl-line-height: 1.3;
--step-2xl-line-height: 1.2;
--step-3xl-line-height: 1.12;
--step-4xl-line-height: 1.12;
--step-5xl-line-height: 1.05;
--step-6xl-line-height: 1.05;
}
Ramp
2 down · 7 up · ×1.333| Step | px | rem | Leading |
|---|---|---|---|
| xs(-2) | 9 | 0.56 | 1.5 |
| sm(-1) | 12 | 0.75 | 1.5 |
| base(0) | 16 | 1 | 1.5 |
| lg(1) | 21.33 | 1.33 | 1.4 |
| xl(2) | 28.44 | 1.78 | 1.3 |
| 2xl(3) | 37.93 | 2.37 | 1.2 |
| 3xl(4) | 50.57 | 3.16 | 1.12 |
| 4xl(5) | 67.42 | 4.21 | 1.12 |
| 5xl(6) | 89.9 | 5.62 | 1.05 |
| 6xl(7) | 119.86 | 7.49 | 1.05 |
Preview
Rendered at computed sizesEverything is computed in your browser; nothing is uploaded.
Examples
Perfect fourth
Base 16 px, ratio 4/3, steps −2…+712 px at −1, 21.33 px at +1The ratio is stored as an exact fraction so the classic 12 px sub-step is exact.
10 px root
Base 1.25 rem, root 20 px, ratio 225 px base, 50 px at +1rem inputs are converted through the root field, which is used consistently in exports.
Fluid hierarchy
16→24 px over 375→1440 pxclamp(1rem, 0.824rem + 0.751vw, 1.5rem)The same viewport anchors scale with the ratio for every step in the ramp.
Invalid ratio
Custom ratio 0.5Validation errorRatios must be greater than 1; the ramp and exports are withheld until the input is fixed.
About this tool
The Modular Type Scale Generator builds a repeatable typographic ramp from a base size and a ratio. Named musical intervals cover the usual choices from a minor second to the golden ratio, and a custom ratio field handles anything in between. Each step is computed by repeated multiplication or division from the base, then shown in pixels and rem using a configurable root size.
A live table and preview panel show every step, including a suggested line height that tightens from 1.5 on body text to 1.05 on display sizes. The preview renders real text at the computed size instead of a chart, so you can judge the hierarchy before exporting it.
Fluid mode solves a linear interpolation between two viewport anchors and two base sizes, emitting a clamp() declaration per step. Exports cover CSS custom properties, a Tailwind fontSize theme, an SCSS map and plain JSON tokens; all four use the same rounded values as the on-screen table.
What this tool does not do
- The clamp() output assumes a linear interpolation in px and rounds the emitted rem and vw terms; tiny anchor drift can result at low precision.
- Named presets cover the common Tailwind and heading scales; beyond those steps the tool falls back to numeric names.
- The tool generates sizes and optional line-height suggestions only — it does not set font families, weights or letter spacing.
How to use this tool
Set the base
Enter a base size in px or rem and set the root font size used for rem conversion. Most projects use 16 px.
Pick a ratio
Choose a named interval or enter a custom ratio between 1.001 and 4; larger ratios produce a more dramatic hierarchy.
Choose the range
Use the steps down and steps up sliders for the number of sizes, then pick Tailwind or heading-style names.
Add fluid sizing
Turn on fluid mode and enter the minimum and maximum base sizes plus their viewport anchors to get clamp() lines.
Export
Switch between CSS, Tailwind, SCSS and JSON tabs, then copy or download the active export.
Use cases
Design-system setup
Define a hierarchy once and export tokens for CSS, Tailwind or SCSS without recalculating by hand.
Responsive type
Generate clamp() lines that interpolate smoothly between mobile and desktop anchors.
Design handoff
Share one ramp as JSON tokens so developers and designers work from identical numbers.
Export formats
| Format | What you get |
|---|---|
| CSS variables | :root block with --step-<name> values and optional line-height tokens |
| Tailwind config | fontSize theme entries as rem strings or [size, { lineHeight }] pairs |
| SCSS map | $type-scale map with an optional $type-leading companion map |
| JSON tokens | An array of name, step, px, rem, lineHeight and optional clamp fields |
Decimal precision is shared by the table and exports, so there is no drift between the preview and the generated code.
Common mistakes
Mistake:Using a ratio slider value of exactly 1.
Fix:Every step would be identical; the tool requires a ratio greater than 1.
Mistake:Forgetting to match the rem root to the site's font size.
Fix:Set the root size field to the actual computed root px; a 62.5% root is 10 px.
Mistake:Setting the maximum viewport below the minimum in fluid mode.
Fix:The tool blocks the fluid output and asks you to swap the two anchors.
Frequently asked questions
Which ratio should I pick?
A major third (1.25) is subtle and suits dense interfaces, a perfect fourth (1.333) is the classic balanced choice, and a golden ratio (1.618) gives a dramatic editorial look. Start with the perfect fourth and change one control at a time in the preview.
How does clamp() fluid scaling work here?
You provide a base size at a minimum and a maximum viewport. The tool solves a straight line between those anchors, converts the intercept to rem and the slope to vw, and emits clamp(min, intercept + slope, max). Every step uses the same viewport anchors with its own size pair.
Should a type scale use rem or px?
rem is usually better because it respects the user's browser font-size setting. The base unit control accepts either, and the root size field controls the conversion; with a 10 px root, 1.6rem equals 16 px.
How many steps do I need?
Most sites need six to ten steps: a couple of small sizes for captions, a base size, and four or five display sizes. Steps down and steps up let you generate up to eight in each direction without editing the exports by hand.
Why does my Tailwind export use arrays for some sizes?
Tailwind accepts a [fontSize, { lineHeight }] pair. When line-height tokens are disabled the tool emits a plain rem string; when they are enabled it emits the pair so the suggested leading travels with the size.
Is anything uploaded when I use this tool?
No. The ramp, previews and exports are computed entirely in your browser from the values you type; there is no network call and no account required.
Related tools
Aspect Ratio Calculator
Calculate dimensions and ratios for images and videos.
Border Radius Generator
Visually craft CSS border-radius values — including the advanced 8-value slash syntax for organic blob shapes — with a live preview and one-click copy.
Box Shadow Generator
Visual CSS box-shadow generator. Create beautiful shadows with live preview and copy the CSS code.
CSS :has() Selector Playground
Try the CSS :has() parent selector on live editable HTML and CSS, with ten patterns, dropped-rule detection and specificity notes.
CSS Button Generator
Design buttons with hover, active, focus-visible and disabled states — gradients, shadows, borders, icons — and copy clean CSS or Tailwind.
CSS Clip-Path Generator
Draw clip-path shapes visually: drag polygon points, tune circle/ellipse/inset presets, paste an SVG path and copy responsive CSS.