Spacing Token Designer

Spacing Token Designer

Plan component spacing and density. Sample width warnings and minimum heights do not replace final UI testing.

1. Spacing steps

CSS pixels at a default 16px root. Steps 1–6 must be positive integers and each step must exceed the previous one.

Spacing at both viewport bounds
TokenMinimum valueMaximum value
--space-00px0px
--space-1
--space-2
--space-3
--space-4
--space-5
--space-6
Component sample requirements
ComponentMinimum content width (1–2000 px)Content height (1–400 px)
Button
Input field
List row
Card

These planning values apply to both densities. Height sets the preview’s minimum size; real text can wrap beyond it. Width warnings compare inner space with your minimum.

Changing settings updates the table and preview.

2. Spacing by viewport

Calculated pixel values at the default 16px root. Space 0 is fixed at zero.

Token320px880px1440px
--space-00px0px0px
--space-14px5px6px
--space-28px10px12px
--space-312px15px18px
--space-416px20px24px
--space-524px30px36px
--space-632px40px48px

Cross-width density audit

Checks all four components in both densities at the minimum, midpoint and maximum widths using your sample requirements. Counts show content-width shortages and minimum-height expansion.

ViewportPreview densityContent width shortMinimum-height growth
320pxCompact03
320pxComfortable03
880pxCompact03
880pxComfortable01
1440pxCompact03
1440pxComfortable00

3. Component density and constraints

Both densities assign different padding and gap steps from the same tokens. Your sample requirements drive the checks and preview minimum heights.

Button · Comfortable
Save changes
Input field · Comfortable
NameExample value
List row · Comfortable
Preferences item
Card · Comfortable
Project cardCheck component spacing alongside real content.Updated
Component usage at 360px
ComponentVertical / horizontal paddingGapEstimated heightConstraint check
Button8.14px / 12.21px4.07px44pxExpanded to touch target
Input field8.14px / 12.21px8.14px44pxExpanded to touch target
List row8.14px / 12.21px8.14px44pxExpanded to touch target
Card16.29px / 16.29px12.21px128.57pxPass

4. Export CSS and JSON

CSS includes --space-0–6 and component rules for both densities; comments record your planning sample sizes. JSON includes the scale, samples and assignments. Test actual fonts, labels and zoom.

/* Pixel examples assume a 16px root. rem bounds follow user font settings; test browser zoom and text wrapping in the final layout. */
:root {
  --space-0: 0;
  --space-1: clamp(0.25rem, calc(0.214286rem + 0.178571vw), 0.375rem);
  --space-2: clamp(0.5rem, calc(0.428571rem + 0.357143vw), 0.75rem);
  --space-3: clamp(0.75rem, calc(0.642857rem + 0.535714vw), 1.125rem);
  --space-4: clamp(1rem, calc(0.857143rem + 0.714286vw), 1.5rem);
  --space-5: clamp(1.5rem, calc(1.285714rem + 1.071429vw), 2.25rem);
  --space-6: clamp(2rem, calc(1.714286rem + 1.428571vw), 3rem);
}
/* Apply data-density="compact" or "comfortable" to a .spacing-kit ancestor. */
/* button sample requirement: 96px minimum content width; 20px content height. Planning values only. */
/* field sample requirement: 128px minimum content width; 24px content height. Planning values only. */
/* list sample requirement: 144px minimum content width; 24px content height. Planning values only. */
/* card sample requirement: 160px minimum content width; 96px content height. Planning values only. */
.spacing-kit { box-sizing: border-box; padding-inline: var(--space-2); }
.spacing-kit * { box-sizing: border-box; min-width: 0; }
.spacing-kit :is(.space-button, .space-field, .space-list, .space-card) { display: flex; }
.spacing-kit :is(.space-button, .space-field, .space-list) { align-items: center; }
.spacing-kit .space-card { flex-direction: column; }
.spacing-kit[data-density="compact"] .space-button { padding: var(--space-1) var(--space-2); gap: var(--space-1); min-height: 44px; }
.spacing-kit[data-density="compact"] .space-field { padding: var(--space-1) var(--space-2); gap: var(--space-1); min-height: 44px; }
.spacing-kit[data-density="compact"] .space-list { padding: var(--space-1) var(--space-2); gap: var(--space-1); min-height: 44px; }
.spacing-kit[data-density="compact"] .space-card { padding: var(--space-3) var(--space-3); gap: var(--space-2); }
.spacing-kit[data-density="comfortable"] .space-button { padding: var(--space-2) var(--space-3); gap: var(--space-1); min-height: 44px; }
.spacing-kit[data-density="comfortable"] .space-field { padding: var(--space-2) var(--space-3); gap: var(--space-2); min-height: 44px; }
.spacing-kit[data-density="comfortable"] .space-list { padding: var(--space-2) var(--space-3); gap: var(--space-2); min-height: 44px; }
.spacing-kit[data-density="comfortable"] .space-card { padding: var(--space-4) var(--space-4); gap: var(--space-3); }

Comments & questions

Spacing Token Designer

A list of spacing values alone does not show whether a button becomes crowded or a card wastes room. Enter six spacing steps at minimum and maximum viewport widths, and check for zero, negative, out-of-order or shrinking values. Set minimum content width and content height for each button, field, list row and card sample. Intermediate sizes are linearly interpolated. Compare compact and comfortable assignments across the four components, including your sample requirements and a 44px minimum touch height. Export CSS rules and a JSON plan. Width warnings use your planning thresholds; test real labels, fonts, browser zoom and accessibility in the finished product.

Key features

  • Fixed zero token plus six positive, ordered and non-shrinking steps
  • Editable minimum content width and height for four component samples
  • Spacing and density audit at minimum, midpoint and maximum viewport widths
  • Compact and comfortable previews with 44px touch-height signals
  • Copy or download CSS clamp tokens, or download the settings as JSON

How to use

  1. Set minimum and maximum viewport widths and enter spacing steps 1–6 in pixels at each bound.
  2. Set each component sample’s minimum content width and content height.
  3. Resolve invalid viewport, step or sample values.
  4. Review the width table and switch between compact and comfortable component density.
  5. Change the preview width and inspect touch-height and content-width signals.
  6. Copy or download CSS, or download JSON; then test with real labels and browser zoom.

Use cases

  • Organize recurring gaps in a design system
  • Compare mobile and desktop form and list density
  • Spot cramped buttons and cards before building the final interface

Frequently asked questions

Why can I not edit the zero step?

--space-0 is fixed at zero for elements that need no gap. Each of the other six steps must be positive and larger than the preceding step.

How do values change between viewport bounds?

The corresponding values at the two bounds are linearly interpolated. At the default 16px root, CSS clamp holds a bound value outside the configured interval.

What changes between compact and comfortable density?

Both use the same spacing scale. They assign different token steps to padding and gaps for button, field, list and card components. The exported CSS includes both.

Does the minimum height guarantee an accessible touch target?

The sample button, field and row rules have a 44px CSS minimum height. Verify the actual clickable area, text wrapping and zoom settings in the finished interface.

Is a content-width warning a measured overflow error?

No. It compares calculated inner width with the minimum content width you enter for each sample. Real text, icons and font metrics may need a different width.

Privacy

The settings and CSS calculations stay in your browser. This tool does not submit them to a server API.

Related Tools

Responsive Type SystemCSS Grid PlaygroundFlex Layout PlaygroundWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDatabase Migration PlannerDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerPackaging Dieline DesignerSVG Icon Sprite PackerRegex Equivalence LabMarkdown Repository AuditorLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphState Machine TesterPetri Net SimulatorGit History VisualizerCurl Request WorkbenchBinary Protocol DesignerHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerER Diagram DesignerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationJSON ↔ YAML ConverterXML ↔ JSON ConverterHTML FormatterJavaScript MinifierMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageXML FormatterHTTP Status Code LookupMIME Type LookupJS & SQL String EscapeCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterNumber Base ConverterUnicode Escape ConverterUnicode InspectorJSON Structure DiffMarkdown Table GeneratorBase64 EncoderJSON FormatterURL EncoderSQL FormatterCron Expression GeneratorRegex TesterUUID GeneratorHash GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewCSS MinifierMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →