Category: Developer tools

Fluid Spacing Scale Generator

System ideaMissing a tool?

Generate a full set of clamp()-based --space-* spacing variables

Enter narrow and wide viewport base spacing plus a ratio to generate --space-* clamp() variables ready for :root. Runs locally.

TokenOutput
--space-3xsclamp(0.0988rem, 0.0601rem + 0.1718vw, 0.1975rem)
--space-2xsclamp(0.1481rem, 0.0902rem + 0.2576vw, 0.2963rem)
--space-xsclamp(0.2222rem, 0.1353rem + 0.3865vw, 0.4444rem)
--space-smclamp(0.3333rem, 0.2029rem + 0.5797vw, 0.6667rem)
--space-mdclamp(0.5rem, 0.3043rem + 0.8696vw, 1rem)
--space-lgclamp(0.75rem, 0.4565rem + 1.3043vw, 1.5rem)
--space-xlclamp(1.125rem, 0.6848rem + 1.9565vw, 2.25rem)
--space-2xlclamp(1.6875rem, 1.0272rem + 2.9348vw, 3.375rem)
--space-3xlclamp(2.5313rem, 1.5408rem + 4.4022vw, 5.0625rem)
Output
:root {
  --space-3xs: clamp(0.0988rem, 0.0601rem + 0.1718vw, 0.1975rem);
  --space-2xs: clamp(0.1481rem, 0.0902rem + 0.2576vw, 0.2963rem);
  --space-xs: clamp(0.2222rem, 0.1353rem + 0.3865vw, 0.4444rem);
  --space-sm: clamp(0.3333rem, 0.2029rem + 0.5797vw, 0.6667rem);
  --space-md: clamp(0.5rem, 0.3043rem + 0.8696vw, 1rem);
  --space-lg: clamp(0.75rem, 0.4565rem + 1.3043vw, 1.5rem);
  --space-xl: clamp(1.125rem, 0.6848rem + 1.9565vw, 2.25rem);
  --space-2xl: clamp(1.6875rem, 1.0272rem + 2.9348vw, 3.375rem);
  --space-3xl: clamp(2.5313rem, 1.5408rem + 4.4022vw, 5.0625rem);
}

Each token is its own clamp(), so every step scales smoothly between the two viewport widths.

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This Fluid Spacing Scale Generator takes a base spacing value at a narrow viewport, a base value at a wide viewport, and a ratio between steps. It outputs a set of --space-* custom properties, each as its own clamp() that scales smoothly between the two viewport sizes, ready to paste into :root. It helps prepare consistent layout spacing tokens, but it does not sync with Figma or a design system, export JSON/Sass/Tailwind configs, analyze existing CSS, or generate a full breakpoint system. Settings and results stay in the browser.

How to use it

  1. Set the base spacing size at narrow and wide viewport widths.
  2. Enter the scale ratio between spacing steps.
  3. Copy the generated :root block of --space-* clamp() properties.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

How do I generate a full fluid spacing scale with clamp()?
Enter the two viewport widths, the base spacing at each end, and the ratio; the tool creates a clamp() for each --space-* token.
What min and max viewport values do fluid spacing tokens need?
They need a narrow and wide viewport width plus the base spacing size at each end, which defines the smooth scaling range.
Can I paste the output directly into :root?
Yes. The output is organized as CSS custom properties in a :root block for pasting into a stylesheet.
Does this Fluid Spacing Scale Generator upload my settings?
No. Viewport values, spacing sizes, ratio, and generated CSS are processed locally in your browser and are not uploaded to LocalTools.
What design-token outputs does it not support?
It does not support Figma sync, design-system sync, JSON/Sass/Tailwind export, existing-CSS analysis, or full layout breakpoint generation.