Spacing Scale Generator
About this tool
About Spacing Scale Generator
Consistent spacing is what makes a layout feel calm. Instead of choosing padding and margins one component at a time, define a small set of spacing tokens and use only those. This generator builds that set three ways. Linear gives you multiples of a base unit, the classic 8-point grid where 1 is 8px, 2 is 16px and so on. T-shirt sizes give a curated range from 3xs to 7xl built from the base unit, with small steps at the low end where fine adjustments matter and big jumps at the top for section spacing. Ratio grows each step by a factor such as 1.5 for a geometric scale. Each token is drawn as a bar so you can see the rhythm, and any value that falls off the 4px grid is flagged. Copy the result as CSS custom properties with your own prefix, as a Tailwind spacing config, or as JSON for a design token pipeline, in rem or px. Nothing leaves your browser. Templates cover 21 spacing systems, including 4-pt and 8-pt grids, t-shirt tokens, modular ratios and product presets.
Built and maintained by Abhi JainUpdated
How to Build a Spacing Scale
- 1
Pick a scale type
Choose Linear (n × base), T-shirt sizes or Ratio.
- 2
Set the base unit
Use the 4-pt or 8-pt button or type a base unit, then choose how many steps you need.
- 3
Review the bars
Check the visual bars and look for any value marked off-grid.
- 4
Copy the output
Choose rem or px and a variable prefix, then copy CSS variables, Tailwind or JSON.
Spacing Scale Generator: questions and answers
What is the 8-point grid?
It's a convention where every size and spacing value is a multiple of 8px (with 4px allowed for small details). Most screen sizes divide evenly by 8, so layouts scale cleanly and designers and developers share one predictable set of numbers.
Should spacing tokens be in rem or px?
Rem spacing grows with the visitor's font-size setting, keeping text and space in proportion. Px spacing stays fixed. Many design systems use rem for padding around text and px for borders and hairlines.
How many spacing tokens do I need?
Most products manage with 8 to 12. Too few and people invent one-off values; too many and the choice between neighbouring tokens becomes arbitrary.
How do I use the tokens in Tailwind CSS?
Copy the Tailwind output into theme.extend.spacing. Every token then works with p-, m-, gap-, space- and size utilities, for example p-md or gap-3.
Are there spacing scale templates?
Yes. 21 templates set the scale type, base unit, step count, ratio and variable prefix: 4, 6, 8 and 10-pt grids, t-shirt token sets for apps, marketing and email, golden, fifth, fourth and octave ratios, and presets for dashboards, mobile, print and layout sections.
Related Tools
- Type Scale GeneratorModular type scale with ratio presets, a live specimen and CSS or Tailwind output.
- Grid CalculatorColumn width, spans and CSS for a column grid on an 8-point baseline.
- PX to REM ConverterConvert px to rem and back, see a reference table and convert whole stylesheets.
- Box Shadow GeneratorLayered CSS box shadows with inset, presets and a live preview.