How to use Spacing Scale Generator
- Choose a base size and Add one base size per step or Multiply by the factor. The 4px steps and 8px steps buttons fill linear examples.
- Set the number of increments after the base. Six increments produce seven values, including the base; the scale does not add a zero-valued token.
- Enter the actual root font size used by the page where you will apply rem values.
- Select Generate spacing scale. Compare the table and preview, then copy the :root custom properties into your stylesheet.
Example: Spacing Scale Generator
Start at 4px and double six times to produce seven spacing values from 4px through 256px.
Options
- Linear or factor growth
- Linear mode adds one base size each time: a 4px base gives 4, 8, 12 and so on. Factor mode multiplies: base 4 and factor 2 give 4, 8, 16 and so on. The factor changes geometric growth, not linear increments.
- Number of values
- The step setting counts increments after the base, so the output contains one more value than the number entered. Tokens are named --space-1 onward, with a corresponding -rem variable for each.
- Root size and units
- The root-size input defaults to 16px. Each rem value divides the spacing in pixels by your entered root size. In the consuming page, rem uses the actual root font size, which can differ with CSS or visitor settings. Pixels are rounded to two decimals and rem values to four.
- Preview and use
- Bars are clipped to the preview width, so a large token does not widen the page. Copy the values that suit your layout; generating a scale does not apply margins, padding or breakpoints automatically.
Supported inputs and limits
- Base size 1 to 64px, factor 1.1 to 4, 1 to 10 increments after the base, and an entered root size of 8 to 24px.
- The result contains 2 to 11 positive values in px and rem.
- The factor must stay within its accepted range even when linear mode does not use it in the calculation.
- Values are CSS text and a comparison table; no stylesheet file download or automatic layout update is provided.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Name tokens for their role when useful
A numeric scale is easy to compare. In your stylesheet, a semantic alias such as a section gap can point to one scale value, so the role stays clear when the value changes.
Questions about Spacing Scale Generator
How does linear spacing differ from geometric spacing?
Linear spacing grows by a fixed increment. Geometric spacing multiplies by a fixed factor at each step.
Can I use these tokens for every margin?
Use them where they fit the content. A scale is a reference, not a reason to add space that the layout does not need.
Do rem tokens track the root font size?
Yes. The browser uses the page’s actual root font size; this tool uses your entered root size when converting.