Spacing Token Generator
Set a base unit and ratio to generate named CSS spacing tokens (--space-xs, --space-sm, etc.) ready to paste into your design system.
Tailwind default is 4px. Common: 4, 8.
Each step multiplied by this ratio.
e.g. --space, --spacing, --gap
Browser default is 16px. Used for rem values.
Token Preview
base 4px · ratio 2×| Token | px | rem | Visual |
|---|
Copy-Ready Output
Usage Example
Copied!
Summary
Set a base unit and ratio to generate named CSS spacing tokens (--space-xs, --space-sm, etc.) ready to paste into your design system.
How it works
- Enter a base unit in pixels — 4px and 8px are common design system defaults.
- Choose a scale ratio: 1 gives linear steps, 1.5 or 2 gives exponential growth.
- Select a naming scheme: T-shirt sizes (xs → 3xl) or numeric (1–9).
- Set a token prefix such as --space or --spacing to match your codebase convention.
- Pick CSS custom properties, SCSS variables, or Tailwind config as output format.
- Click Copy to grab the complete token block and paste it into your project.
Use cases
- Bootstrap a spacing system for a new design system or component library.
- Generate margin and padding tokens that match a Figma spacing scale.
- Export CSS variables to use as --space-sm, --space-md across a stylesheet.
- Create Tailwind-compatible spacing tokens with semantic names instead of numbers.
- Preview how a ratio-based scale grows before committing to it in production.
- Quickly produce SCSS variables to share with a Sass-based stylesheet.
- Match a 4px or 8px grid system with consistent named spacing tokens.
Frequently Asked Questions
Last updated: 2026-07-01 ·
Reviewed by Nham Vu