CSS Fluid Typography Scale & Clamp Generator

Design a complete responsive type system with CSS clamp() — dual-ratio scale, multi-viewport preview, line-height & spacing tokens, WCAG check, and one-click export.

100% Client-Side Math Engine: All clamp() calculations, scale ratio interpolations, and token generation run entirely in your browser. No data is uploaded to any server — your design system stays private.
Total Steps
8
inc. negative steps
Min Size (@min vp)
10px
Max Size (@max vp)
80px
Viewport Span
1120px
320 → 1440px
WCAG Flags
0
steps below min threshold
Scale Factor
×5.0
max/min size ratio
Multi-Viewport Snapshot Pixel-accurate at each breakpoint
Interactive Resize Preview
Width: 768px
Fluid Slope Visualizer — px at every viewport width
Mathematical Resolution Table
Step Role @320px @768px @1280px @1920px WCAG clamp() output
/* Calculating... */
/* Calculating... */
/* Calculating... */
/* Calculating... */

1What is Fluid Typography & Why Does It Matter?

Traditional responsive typography uses media query breakpoints to jump between two hard-coded static sizes — for example, 24px on mobile, 48px above 768px. The result is a jarring, instantaneous size change at the exact breakpoint pixel. On every viewport width between those two values, text is either oversized or undersized. Tablets and landscape phones — the widths between 600px and 1024px — are chronically underserved by this approach.

Fluid typography eliminates those jumps completely. Using the CSS clamp() function, text mathematically scales as a smooth linear function of viewport width — growing or shrinking continuously, with hard stops at your chosen minimum and maximum. Every pixel width between your bounds is covered with exactly the right size, without a single media query.

0
Media Queries Needed
1
CSS Property Per Step
Viewport Widths Covered
AA
WCAG 2.1 Compliant
The tablet gap problem: Devices at 768–1024px (tablets, landscape phones, small laptops) represent a major share of web traffic. Traditional breakpoint typography either serves them an oversized desktop size or an undersized mobile size. Fluid clamp() hits the mathematically correct size at every intermediate width automatically.

The Modular Type Scale Concept

A type scale is a set of font sizes derived by repeatedly multiplying a base size by a fixed ratio. Musical ratios — the Perfect Fourth (1.333), Major Third (1.250), Major Second (1.125) — produce harmonically pleasing progressions. The key insight of this tool is computing two separate scales (one for mobile, one for desktop), then wrapping each step pair in a clamp() that interpolates between them. The hierarchy is simultaneously tight on phones and dramatic on wide screens without any conditional logic.

2The clamp() Formula — Complete Mathematics

The clamp(MIN, PREFERRED, MAX) function accepts three arguments. MIN and MAX are hard rem boundaries. PREFERRED is a viewport-relative linear equation that creates smooth scaling between them. The generator's calcClamp(minPx, maxPx, minVp, maxVp) function derives all three arguments from your settings:

Step-by-step calcClamp() walkthrough:

1. Convert to rem: minR = minPx / rootPx  |  maxR = maxPx / rootPx

2. Static guard: if |minPx − maxPx| < 0.001 → output plain rem (no clamp needed)

3. Slope: (maxR − minR) / (maxVp/rootPx − minVp/rootPx)

4. Y-intercept: yi = minR − (minVp / rootPx) × slope

5. PREFERRED: slope×100vw + yi rem (or slope×100cqi + yi rem in Container Query mode)

6. Direction guard: if minR > maxR → auto-swap bounds (valid decreasing clamp)

Worked Example (Body Text)

Base: 16px at 320px viewport → 20px at 1440px. Root = 16px.

  • minR = 1rem, maxR = 1.25rem
  • Slope = (1.25−1) / (90−20) = 0.25/70 ≈ 0.003571
  • vwCoeff = 0.003571 × 100 = 0.357
  • yi = 1 − 20 × 0.003571 ≈ 0.929rem
  • Output: clamp(1rem, 0.929rem + 0.357vw, 1.25rem)

At 320px: 0.929 + 0.357×3.2 = 0.929 + 1.142 = 2.071 → clamped to 1rem = 16px ✓
At 1440px: 0.929 + 0.357×14.4 = 0.929 + 5.141 = 6.07 → clamped to 1.25rem = 20px ✓

Edge case handling: If your min and max sizes are identical, the generator outputs a plain static rem value. If max < min, it auto-flips the clamp bounds, producing a valid decreasing function — useful for elements intentionally smaller on larger screens.

3Dual-Ratio Scaling Engine

A typographic ratio governs how aggressively each step multiplies from the base. At Golden Ratio 1.618 with 6 steps: 16 × 1.618⁵ ≈ 110px — majestic on 4K, completely unusable on a 375px iPhone where it spans the full screen before a single word fits.

The dual-ratio method solves this by assigning a tight ratio to mobile and a dramatic ratio to desktop. For each step N, the engine computes:

  • minPx = baseMin × ratioMinN  (tight mobile ratio)
  • maxPx = baseMax × ratioMaxN  (dramatic desktop ratio)
  • → Wrapped in calcClamp(minPx, maxPx)

Result: step-5 might be ~32px at mobile (compact, readable) and ~90px at desktop (dramatic, impactful). The hierarchy feels right at every viewport with zero breakpoints.

Minor Second — 1.067

Extremely tight. Minimal visual jump between steps. Best for dense dashboards and admin UIs where compactness is critical.

Major Second — 1.125

The standard mobile choice. Subtle hierarchy that works at all screen sizes. Preferred by Apple HIG and Material Design mobile guidelines.

Major Third — 1.250

Clear, confident hierarchy. The Tailwind CSS default scale. Balanced between compact and dramatic. Excellent for SaaS landing pages.

Perfect Fourth — 1.333

Strong escalating sizes. Headlines grow quickly. Best for editorial and blog content where large display headings are a primary design element.

Augmented Fourth — 1.414

Aggressive and bold. Ideal for marketing hero sections. Use as the desktop ratio paired with a tight 1.125–1.200 mobile ratio.

Golden Ratio — 1.618

Maximum drama. Desktop-only. At 6+ steps and 16px base, step-5 ≈ 110px. Never use as mobile ratio — always pair with 1.067–1.200 for mobile.

4Negative Steps

Best practice: Use --step-2 for captions (10–12px min), --step-1 for helper text (12–14px min). Never use negative steps for body content — WCAG requires 14px minimum for normal text passages.

5The Interactive Typography Sandbox

Evaluating typography requires realistic context. Rather than forcing engineers to constantly export and reload code, this visualizer implements a Live DOM-Mutating Sandbox.

Instead of reloading an isolated <iframe>, the JavaScript engine generates a dynamic <style id="live-fluid-vars"> block upon every interaction. It maps the generated clamp() logic to the live CSS variables (e.g., --step-3, --step-1-lh) and immediately repaints the hidden blog layout. This allows engineers to see exactly how their fluid variables interpolate across H1–H6 elements and standard prose text as they resize their native browser window, providing unparalleled accuracy.

6Legacy Fallback: Bridging Modern CSS and Legacy Clients

While the modern clamp() function enjoys over 93% global browser support, it catastrophically fails in strict HTML email environments (such as Microsoft Outlook desktop) and legacy enterprise systems like Internet Explorer 11.

To ensure total backward compatibility without sacrificing fluid rendering, the engine calculates the absolute pixel values at the extreme ends of the interpolation. By enabling the Legacy Fallback mode, the generator wraps these strict pixel boundaries within a scaffold of @media (max-width) and @media (min-width) rules. When a legacy rendering engine drops the unparsable clamp() declaration, it gracefully falls back to the exact static pixel size intended for that viewport range, preserving structural integrity.

5The Interactive Typography Sandbox

Evaluating typography requires realistic context. Rather than forcing engineers to constantly export and reload code, this visualizer implements a Live DOM-Mutating Sandbox.

Instead of reloading an isolated <iframe>, the JavaScript engine generates a dynamic <style id="live-fluid-vars"> block upon every interaction. It maps the generated clamp() logic to the live CSS variables (e.g., --step-3, --step-1-lh) and immediately repaints the hidden blog layout. This allows engineers to see exactly how their fluid variables interpolate across H1–H6 elements and standard prose text as they resize their native browser window, providing unparalleled accuracy.

6Legacy Fallback: Bridging Modern CSS and Legacy Clients

While the modern clamp() function enjoys over 93% global browser support, it catastrophically fails in strict HTML email environments (such as Microsoft Outlook desktop) and legacy enterprise systems like Internet Explorer 11.

To ensure total backward compatibility without sacrificing fluid rendering, the engine calculates the absolute pixel values at the extreme ends of the interpolation. By enabling the Legacy Fallback mode, the generator wraps these strict pixel boundaries within a scaffold of @media (max-width) and @media (min-width) rules. When a legacy rendering engine drops the unparsable clamp() declaration, it gracefully falls back to the exact static pixel size intended for that viewport range, preserving structural integrity.

7Accessibility: REM Units Are Non-Negotiable

Never use px inside clamp() — Code like clamp(16px, 2vw, 32px) violates WCAG 1.4.4 (SC 1.4.4). If a visually impaired user has increased their browser default to 24px, your px-clamped value overrides it and forces text back to 16px — ignoring their accessibility setting entirely.

This generator always outputs boundaries in rem units. Because 1rem equals the user's chosen browser font size, your clamp values automatically scale when a user increases their browser text size — achieving WCAG 2.1 Level AA compliance automatically. The WCAG flag column in the Resolution Table checks that your minimum clamp value doesn't fall below the configurable threshold.

8Fluid Line-Height & Letter-Spacing Tokens

A complete typography system requires more than just font-size. This generator also outputs line-height and letter-spacing tokens that scale with the type hierarchy:

  • Line-height: Large display headings look best at 1.1–1.2 (tight). Body text needs 1.6–1.75 (loose) for comfortable reading. The generator assigns a line-height that decreases as step size increases.
  • Letter-spacing: Display headings conventionally use slight negative tracking (−0.02em to −0.04em) to optically compensate for expanded letterforms at large sizes. Body text benefits from 0 to +0.01em.

9Interactive SVG Data Visualization

Fluid interpolation is mathematically abstract. To ground it in reality, the generator plots every step against an interactive SVG slope chart. The JavaScript engine listens to native mousemove events and translates the client mouse coordinates (e.clientX) against the internal SVG viewBox.

By mapping this position along the X-axis (representing viewport width), the engine reverse-engineers the precise font-size at that intersection (the Y-axis). The dynamic crosshairs provide immediate, tangible proof of how the font-size behaves at any arbitrary pixel width along the interpolated slope.

10Container Query Mode (cqi Units)

Standard vw-based fluid typography breaks inside narrow CSS Grid columns on wide screens. A 20vw font on a 2560px monitor would be enormous, even if the card it's inside is only 300px wide.

Switching to Container Query mode replaces vw with cqi (Container Query Inline) units. The font now scales relative to its container width, not the viewport. This makes truly modular, reusable components possible. Requires container-type: inline-size on the parent element. Browser support is now excellent (Chrome 105+, Firefox 110+, Safari 16+).

11Mathematical Framework Presets

The generator features pre-computed mathematical models that perfectly align with industry-standard design frameworks, translated into fluid variables:

  • Apple HIG: Employs a highly conservative Major Second (1.125) mobile ratio, gently escalating to 1.200 on desktop. This prevents massive UI shifts and guarantees maximum density and legibility on mobile viewports.
  • Tailwind CSS: Built on a rigid Major Third (1.250) typographic scale. Standard Tailwind implementations rely on hard-coded breakpoints to swap classes. This preset approximates that identical mathematical curve, but delivers it purely via fluid scaling.
  • Material Design 3: Optimized for Android device density, it utilizes an 8-step hierarchy carefully crafted to ensure contrast and readability on high-DPI displays.

12Native CodePen API & Design Handoff

Design handoff is notoriously difficult when working with abstract fluid variables. To solve this, the generator utilizes the native CodePen Define API.

Clicking the CodePen export button triggers the engine to bundle your generated CSS tokens along with a pre-configured HTML template into a single, serialized JSON payload. This payload is securely POSTed directly to CodePen, instantly launching a live, shareable environment. Engineers can share this live sandbox link with stakeholders or clients to definitively prove the resilience and beauty of the underlying fluid scale before writing a single line of production code.

13Figma Integration & Design Token Workflow

Figma does not natively render fluid clamp() values — designers still work with static frame sizes. Here is the recommended handoff workflow:

  1. Designer provides two pixel values per step — one from the 375px mobile frame, one from the 1440px desktop frame.
  2. Enter those exact values as your base size and viewport boundaries in this generator.
  3. Check the Resolution Table — verify the generated clamp() hits those exact pixels at both viewport widths.
  4. Export Figma JSON — paste directly into Figma's Tokens Studio plugin (formerly "Figma Tokens") as a ready-to-apply token set.
  5. Export CSS Custom Properties into your design token file. Reference with font-size: var(--step-3).

Design Token

A named variable that stores a single design decision (e.g. font-size for a heading). Tokens enable consistent, cross-platform design systems.

W3C Token Format

The official W3C Design Tokens Community Group specification for a JSON schema that is interoperable across tools.

Tokens Studio

A Figma plugin that applies JSON design tokens directly to Figma components — enabling single-source-of-truth design systems.

14Common Mistakes & Edge Cases

  • Min = Max value: If your min and max sizes are equal, the generator correctly outputs a static rem value instead of a nonsensical clamp(1rem, 0vw + 1rem, 1rem).
  • Negative slope: If max size is smaller than min size, the generator detects this and flips the clamp boundaries, producing a valid shrinking function — useful for elements that should be smaller on large screens.
  • Extremely large ratios on mobile: A Golden Ratio (1.618) applied to 6 positive steps gives a top step of ~110px at mobile base 16px. This overflows most phone screens. Always use tight mobile ratios (1.067–1.250) and check the multi-viewport preview.
  • Not checking the WCAG column: Negative steps, especially at high ratios, can produce minimum sizes below 9px — physically illegible text that also fails WCAG 1.4.4.

FAQFrequently Asked Questions

What exactly is fluid typography and how is it different from responsive typography?

Responsive typography uses CSS media queries to jump abruptly between two hardcoded sizes at a fixed breakpoint — for example, font-size: 24px below 768px and font-size: 48px above it. At exactly 767px you get 24px. At exactly 768px you get 48px. The jump is instantaneous and jarring.

Fluid typography uses the CSS clamp() function to make text grow or shrink continuously as a smooth linear function of viewport width — with no breakpoints at all. At 320px you get your minimum. At 1440px you get your maximum. At every single pixel in between, the font is mathematically exactly right. No jumps. No awkward in-between states. This completely eliminates the “tablet gap” where devices at 600–1024px are served an oversized mobile size or an undersized desktop size.

What is a modular type scale and why is it built on ratios?

A modular type scale is a set of font sizes generated by repeatedly multiplying a single base size by a constant ratio. The ratio governs how dramatically each step grows from the previous one. For example, with a base of 16px and a ratio of 1.25 (Major Third): step-0 = 16px → step-1 = 20px → step-2 = 25px → step-3 = 31.25px → step-4 = 39px.

Using ratios creates visual harmony — the same mathematical relationship between each size creates a sense of rhythm and hierarchy, similar to musical intervals (which is why ratios like Perfect Fourth 1.333 and Golden Ratio 1.618 appear in both music theory and typographic design). This tool computes two separate scales — one for mobile with a tight ratio, one for desktop with a dramatic ratio — and wraps each pair in a clamp() to interpolate between them fluidly.

What are positive steps vs negative steps in a type scale?

In this generator, step 0 is your base body size — typically 16–20px. Positive steps (step-1, step-2, step-3…) are progressively larger sizes used for subheadings, headings, display text, and hero text. Negative steps (step-1, step-2…) are sizes smaller than your body, derived by dividing the base by the ratio rather than multiplying.

Negative steps are essential for a complete type system: --step--1 is ideal for image captions, form helper text, and timestamps (typically 12–14px). --step--2 is for legal fine print, metadata, and badge labels (10–12px). Be cautious — on mobile with a ratio of 1.250+, step-2 can drop below 10px and become illegible. Always verify negative steps against the WCAG minimum column in the Resolution Table.

How does CSS clamp() actually calculate fluid font sizes? What is the exact formula?

The CSS clamp(MIN, PREFERRED, MAX) function returns: the value PREFERRED, but never smaller than MIN and never larger than MAX. For fluid typography, the formula to derive the three arguments from your viewport and size settings is the slope-intercept method:

  1. Convert to rem: minR = minPx / rootPx, maxR = maxPx / rootPx
  2. Calculate slope: slope = (maxR − minR) / (maxVp/rootPx − minVp/rootPx)
  3. Calculate y-intercept: yi = minR − slope × (minVp / rootPx)
  4. Build PREFERRED: slope × 100vw + yi rem
  5. Final output: clamp(minR rem, slope×100vw + yi rem, maxR rem)

Worked example — 16px at 320px viewport to 20px at 1440px, root 16px: slope = (1.25−1)/(90−20) = 0.003571 → vwCoeff = 0.357 → yi = 1 − 20×0.003571 = 0.929rem → clamp(1rem, 0.929rem + 0.357vw, 1.25rem)

What is a dual-ratio type scale and when should I use different mobile vs desktop ratios?

A dual-ratio scale assigns a conservative ratio to mobile and a dramatic ratio to desktop. This solves a critical problem: applying the Golden Ratio (1.618) to 6 steps produces a top step of ~110px at 16px base — magnificent on 4K but physically wider than an iPhone screen before a single word fits.

How it works: For each step N, the engine computes minPx = baseMin × ratioMin^N (tight mobile ratio) and maxPx = baseMax × ratioMax^N (dramatic desktop ratio), then wraps them in clamp(). Result: your H1 might be 32px on mobile (readable) and 90px on desktop (impactful) — with perfect scaling at every intermediate viewport.

Recommended pairings: Mobile 1.125 (Major Second) + Desktop 1.414 (Augmented Fourth) for marketing sites. Mobile 1.067 (Minor Second) + Desktop 1.250 (Major Third) for dense dashboards. Mobile 1.125 + Desktop 1.618 (Golden Ratio) only if you keep step count ≤ 5.

How are line-height and letter-spacing tokens calculated alongside font-size?

Typography is multi-dimensional. Large display text requires tight leading and tracking; small body text requires loose leading. This generator auto-calculates companion tokens for every step:

Line-height interpolates linearly from lhMax (for negative steps) down to lhMin (for the highest positive step). Default: 1.75 for body copy down to 1.1 for display headings. The formula maps each step's position in the range [−stepsNeg, stepsPos] to the [lhMax, lhMin] line-height range.

Letter-spacing interpolates from lsBody (for step 0 and below) to lsHeading (for the top step). Default: 0em body, −0.02em headings — mimicking the optical tracking adjustments used by Apple, Google, and IBM in their design systems. Both values are exported as part of every token format (CSS custom properties, Tailwind fontSize config, SCSS map, Figma JSON, and W3C tokens).

Why is using px inside clamp() an accessibility failure? What WCAG criterion does it violate?

Using pixel values inside clamp() — e.g., clamp(16px, 2vw, 32px) — violates WCAG 2.1 Success Criterion 1.4.4 (Resize Text, Level AA), which requires that text can be resized up to 200% without loss of content or functionality.

Here is exactly why it fails: A visually impaired user sets their browser default font size to 24px. CSS rem units are relative to this setting — 1rem = 24px for them. But 16px is an absolute unit — it ignores browser settings entirely. Your clamp(16px, ...) locks their minimum at 16px regardless of their preference, preventing them from exercising their accessibility setting.

This generator always outputs boundaries in rem units. When a user has set their browser font to 24px, your clamp(1rem, ...) becomes clamp(24px, ...) on their device, correctly scaling up. This achieves WCAG 1.4.4 compliance automatically. The WCAG checker in the Resolution Table flags any step where the minimum clamp value (at your minimum viewport) falls below your configured pixel threshold.

What is the WCAG minimum font size and how does the checker in this tool work?

WCAG 2.1 does not specify an absolute minimum pixel size — the standard is relative (200% resizability). However, practical readability research and the W3C Accessibility Guidelines Understanding documents suggest 14px as the absolute floor for body text and 9px for decorative/supplementary text. Major browsers flag sub-11px text as a usability concern in Lighthouse audits.

This tool's WCAG checker evaluates each step's minimum clamp value — the size that will render at your smallest viewport (e.g., 320px) — against your configured threshold (default: 11px). The threshold is configurable in the Advanced tab via the WCAG Min slider so you can match your project's specific accessibility requirements. Flagged steps appear with a red ⚠ warning in the Resolution Table. The most common failures are --step--2 with aggressive ratios, where a 1.414 ratio applied to 16px base produces a step-2 value of ~8px.

What is Container Query mode (cqi units) and when should I use it instead of vw?

Standard vw-based fluid typography scales text relative to the browser window width. This breaks in component-driven layouts: a card in a 3-column CSS Grid on a 2560px monitor has a container ~800px wide, but its vw-based heading sees the full 2560px viewport — producing enormous text that overflows the card.

Container Query mode replaces vw with cqi (Container Query Inline units). The text now scales relative to its nearest sized container width, not the viewport. This makes components truly modular and reusable. A card heading will scale correctly whether it's in a sidebar or a full-width hero.

Requirements: The parent element must have container-type: inline-size (or size) applied. Browser support is excellent: Chrome 105+, Firefox 110+, Safari 16+ (96%+ global support as of 2025). Use vw for page-level typographic elements like hero sections and article bodies. Use cqi for reusable components like cards, sidebars, and modals.

How does the custom CSS variable prefix and root px setting affect the output?

CSS Variable Prefix (default: --step) controls the naming of your generated custom properties. Changing it to --fs gives you --fs-0, --fs-1, etc. Changing to --type gives --type-0. This matters for design system consistency — if your existing system uses --text-size-, change the prefix to match and the output drops in as-is with zero renaming.

Root PX (default: 16) tells the calculator what 1rem equals in pixels when performing the slope-intercept math. It does not change what gets output — the output is always in rem. It only affects the mathematical conversion from the pixel values you enter in the controls. If your project sets html { font-size: 18px; }, change Root PX to 18 so the generated clamp() values precisely hit your intended pixel sizes at each viewport boundary. Verify by checking the Resolution Table — it shows the rendered pixel size at 4 viewport widths.

How do I use the Slope Visualisation Chart and what do crossing lines mean?

The Slope Chart plots the rendered pixel size of each type scale step against viewport width (x-axis: your min-VP to max-VP range, y-axis: rendered size in pixels). Each coloured line represents one step. A healthy chart shows all lines parallel and non-overlapping — larger steps stay above smaller steps at every viewport width.

Crossing lines mean a higher-numbered step is temporarily rendering smaller than a lower-numbered step at some viewport width. This creates an incoherent visual hierarchy at that viewport. It typically happens when your mobile ratio is much tighter than your desktop ratio with many steps — the aggressive desktop ratio causes high steps to “outrun” their slope relative to lower steps.

To fix crossing lines: (1) Reduce the number of positive steps — fewer steps = less opportunity to cross. (2) Bring your mobile and desktop ratios closer together. (3) Increase your base size gap (baseMax − baseMin) to give more room for the slopes to separate. The Resolution Table will also show numerically where crossings occur.

How do I integrate the generated CSS custom properties into my project?

Copy the CSS Variables export and paste it into your project's root stylesheet (typically :root { }). Each custom property is then available globally:

:root {
  --step--2: clamp(0.64rem, 0.60rem + 0.19vw, 0.78rem);
  --step--1: clamp(0.80rem, 0.75rem + 0.24vw, 0.98rem);
  --step-0:  clamp(1rem, 0.93rem + 0.36vw, 1.25rem);
  --step-1:  clamp(1.25rem, 1.14rem + 0.55vw, 1.56rem);
  --step-2:  clamp(1.56rem, 1.38rem + 0.93vw, 1.95rem);
  --step-3:  clamp(1.95rem, 1.65rem + 1.51vw, 2.44rem);
}

Then apply them with standard CSS: font-size: var(--step-3);. For Tailwind, paste the Tailwind Config export into your tailwind.config.js under theme.extend.fontSize. For SCSS, use the SCSS Map export with the included @mixin fluid-type(). All exports include line-height and letter-spacing alongside font-size.

How do I export this fluid type scale to Figma for design system handoff?

Figma does not natively render CSS clamp() — designers work with static frame sizes. The recommended workflow for design-development alignment is:

  1. Designer identifies pixel values: On the 375px mobile frame, measure the heading size (e.g., 32px). On the 1440px desktop frame, measure the same heading (e.g., 72px).
  2. Enter those values as base sizes and viewport bounds in this generator.
  3. Verify in the Resolution Table — confirm the clamp() output hits exactly 32px at 375px and 72px at 1440px viewport.
  4. Export Figma JSON — click “Export Tokens” and select the Figma JSON tab. This outputs a structured JSON compatible with the Tokens Studio Figma plugin.
  5. In Figma: Open Tokens Studio → Import → paste the JSON. Token values are now linked to your Figma text styles.

Note: Figma will show the raw clamp() string as the token value, not a resolved number. This is expected — the token is the source of truth consumed by the CSS build, not Figma's renderer.

What is the W3C Design Token format and how does it fit into a design system pipeline?

The W3C Design Tokens Community Group (DTCG) format is a standardised JSON specification for design tokens that enables platform-agnostic token distribution. Each token has a , a , and an optional .

Exporting to W3C format lets you pipe your fluid type scale into build pipelines such as:

  • Style Dictionary (Amazon) — transforms tokens into CSS, Android XML, iOS Swift, and more
  • Cobalt — W3C-native token transformer with multi-platform output
  • Specify — syncs tokens between Figma and code repositories automatically
  • Theo (Salesforce) — transforms into any platform format

The W3C export from this tool includes font-size (as the clamp() string), line-height, and a human-readable for each step. This makes your fluid typography scale a true single-source-of-truth that can be consumed by both designers (via Tokens Studio) and developers (via Style Dictionary pipelines).

My clamp() output looks correct in the tool but the font size doesn't change on my website — why?

There are four common reasons fluid typography stops working on the live site:

  1. A competing font-size rule overwrites it. If a component's CSS sets a static font-size: 18px after your custom property assignment, it wins. Check browser DevTools → Computed tab for the element — struck-through declarations indicate overridden rules.
  2. The custom property is applied to the wrong element. CSS custom properties cascade — if --step-2 is defined in :root but you apply font-size: var(--step-2) inside a Shadow DOM, the variable won't be inherited. Define tokens at a level that reaches your component.
  3. The root font-size is different from 16px. If your CSS has html { font-size: 62.5% } (a common 10px trick), 1rem = 10px. Your clamp output is based on 16px rem, so all sizes will be 62.5% of what you expect. Either remove the root font-size override or set the Root PX setting in the Advanced tab to 10.
  4. Browser zoom vs font size preference. Browser zoom scales everything equally (including vw units). User font size preference only affects rem. Both are supported by this tool's output.
What is the static guard and direction guard in the clamp() generator?

Two edge-case guards prevent the generator from producing invalid or nonsensical clamp() output:

Static Guard: If your minimum and maximum pixel sizes are equal (or differ by less than 0.001px), the generator detects that no fluid scaling is needed and outputs a plain rem value instead of clamp(X, Yvw + Zrem, X). A zero-slope clamp is syntactically valid but wasteful and confusing — the plain rem is cleaner and semantically correct.

Direction Guard: If maxPx < minPx — meaning your font shrinks as the viewport grows — the generator detects the inversion and swaps the clamp bounds. The output produces a valid decreasing clamp: clamp(maxR, slope×vw + yi rem, minR). This is intentional behaviour useful for decorative elements that should be proportionally smaller on larger screens (e.g., small caps labels, icon labels). Both guards are applied per-step, so a scale can have some steps growing and some static without any issues.

Does CSS clamp() work in all browsers? What is the fallback strategy?

As of mid-2025, clamp() has 97%+ global browser support (Chrome 79+, Firefox 75+, Safari 13.1+, Edge 79+). It is safe to use in production without fallbacks for all modern projects.

For legacy enterprise environments supporting Internet Explorer 11 or older Safari (pre-13.1), add a static fallback rule immediately before the fluid rule in your CSS:

h1 {
  font-size: 2rem;                        /* IE11 fallback */
  font-size: clamp(1.5rem, 3vw + 1rem, 3rem); /* Modern */
}

CSS parsers in unsupporting browsers silently ignore rules with unknown functions. The fallback rule is parsed first and applies. The fluid rule is then parsed — if the browser supports clamp(), it overrides the fallback; otherwise the static rem value holds. The CSS Variables export from this tool does not include static fallbacks by default, so you would need to manually add them if you need IE11 support (which is now below 0.3% global traffic).

Rate CSS Fluid Typography Scale

Help us improve by rating this tool.

4.7/5
574 reviews