Design Token Generator

Generate a design token JSON file from your brand colors, fonts, and spacing.

Result
Design Tokens (JSON)
{ "color": { "primary": { "value": "#3b82f6", "type": "color" }, "secondary": { "value": "#8b5cf6", "type": "color" }, "neutral": { "value": "#64748b", "type": "color" }, "background": { "value": "#ffffff", "type": "color" }, "surface": { "value": "#f8fafc", "type": "color" }, "text": { "value": "#0f172a", "type": "color" }, "text-muted": { "value": "#64748b", "type": "color" } }, "typography": { "fontFamily": { "value": "Inter, system-ui, sans-serif", "type": "fontFamily" }, "fontSize": { "xs": { "value": "12px", "type": "fontSize" }, "sm": { "value": "14px", "type": "fontSize" }, "base": { "value": "16px", "type": "fontSize" }, "lg": { "value": "18px", "type": "fontSize" }, "xl": { "value": "20px", "type": "fontSize" }, "2xl": { "value": "24px", "type": "fontSize" }, "3xl": { "value": "30px", "type": "fontSize" } } }, "spacing": { "0": { "value": "0px", "type": "spacing" }, "1": { "value": "4px", "type": "spacing" }, "2": { "value": "8px", "type": "spacing" }, "3": { "value": "12px", "type": "spacing" }, "4": { "value": "16px", "type": "spacing" }, "6": { "value": "24px", "type": "spacing" }, "8": { "value": "32px", "type": "spacing" }, "12": { "value": "48px", "type": "spacing" }, "16": { "value": "64px", "type": "spacing" } }, "borderRadius": { "none": { "value": "0px", "type": "borderRadius" }, "sm": { "value": "4px", "type": "borderRadius" }, "md": { "value": "8px", "type": "borderRadius" }, "lg": { "value": "12px", "type": "borderRadius" }, "full": { "value": "9999px", "type": "borderRadius" } } }
CSS Variables
:root { --color-primary: #3b82f6; --color-secondary: #8b5cf6; --color-neutral: #64748b; --font-family: Inter, system-ui, sans-serif; --font-size-base: 16px; --radius: 8px; }
Summary7 colors, 7 sizes, 9 spacings

About This Tool

Drop in your brand colors, font stack, type scale, and spacing values — out comes a design tokens JSON file that you can hand to any framework or design tool that reads the W3C tokens format.

The output is structured by category (color, typography, spacing, radius, shadow) with semantic and primitive layers separated. Primitives hold raw values; semantic tokens reference them by purpose (color.action.primary, color.surface.muted) so a brand refresh only touches the primitives.

Feed the JSON into Style Dictionary, Tokens Studio, or directly into Tailwind's config to keep design and code in sync.

Under the hood: the generator emits the W3C Design Tokens Community Group schema. Each token is an object with a $value (the literal value) and a $type (color, dimension, fontFamily, etc.). Semantic tokens reference primitives via the {primitive.path.notation} alias syntax — when a tool resolves the token tree, aliases get replaced with the underlying value. That's how you keep a single source of truth: change color.brand.500 once and every semantic token referencing it updates everywhere.

Worked example: define color.gray.900 = #0f172a (primitive), then color.text.primary = {color.gray.900} (semantic). Your Button component reads color.text.primary, never color.gray.900 directly. Decide later that text should be slightly warmer? Point color.text.primary at color.stone.900 instead. One token edit, every Button updates. Spacing follows the same pattern: space.4 = 16px (primitive), space.gutter = {space.4} (semantic), and your layout reads space.gutter.

Where it falls short: tokens don't capture relational logic. Hover states, focus rings, and motion timing curves often need conditional rules a flat token tree can't express. Most teams pair tokens with a small layer of CSS variables or component-level styles to handle the dynamic parts. Don't try to encode every state into the token file — you'll end up with a 4,000-line JSON that nobody can navigate.

The categories the generator handles by default: color (with primitive shades and semantic roles like text, surface, action), typography (font family, weight, size, line-height, letter-spacing), spacing (a base scale plus semantic gutters), border-radius, shadow (with x/y/blur/spread/color decomposition), z-index, and motion (duration and easing curves). Each category emits as its own subtree under the root tokens object, with $type set to the W3C-defined value type so downstream consumers can validate.

Worked workflow: design hands off Figma file with color and typography variables. Export those via Tokens Studio. Run through the generator to produce a clean primitive/semantic split. Pipe through Style Dictionary to emit tailwind.config.js, CSS custom properties, iOS Swift constants, and Android XML resources from the same source. One token edit, all four platforms update next build.

The about text and FAQ on this page were drafted with AI assistance and reviewed by a member of the Coherence Daddy team before publishing. See our Content Policy for editorial standards.

Frequently Asked Questions