Spacing Scale Generator

Build a linear or geometric spacing scale and copy paired pixel and rem CSS variables.

On-device No sign-up Free to use

Generate spacing scale controls

?

Used only in factor mode.

?

Turns each step into rem using the entered root size. This input starts at 16px; your page styles and visitor preferences can use a different root font size.

Processed in your browser. Your inputs stay on this device.

Showing an example. Change the fields, then use generate spacing scale to update it.

Result

Showing an example.

Start at 4px and double six times to produce seven spacing values from 4px through 256px.

Generated a 7-step factor scale on a 4px base from 4px to 256px, in px and rem at a 16px root. Copy the custom properties below.

Loading the tool. Your result will appear here.

https://usefreetools.net/spacing-scale-generator · 20 November 2026

Was this helpful?

How to use Spacing Scale Generator

  1. 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.
  2. 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.
  3. Enter the actual root font size used by the page where you will apply rem values.
  4. 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.

You add
Base size (px): 4; How steps grow: factor; Factor: 2; Steps after the base: 6; Root font size (px): 16
You get
Generated a 7-step factor scale on a 4px base from 4px to 256px, in px and rem at a 16px root. Copy the custom properties below.

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.

Page updated · Project managed by Tony Hines · Report a problem with Spacing Scale Generator