Skip to content

Token converter

Convert design tokens between DTCG 2025.10 JSON, CSS custom properties and Tailwind CSS v4 @theme. Check your token file for broken references and type errors, map groups to Tailwind namespaces, write light, dark and other modes from a DTCG resolver, and copy or download the result. Everything runs in your browser.

Runs in your browserDTCG 2025.10Resolver modes

Input

Detected: DTCG JSON
Format

Paste tokens, choose .json, .tokens or .css files (up to 2 MB each), or drop them onto this card. For a resolver, choose it with the token files it references. Files stay in your browser.

Options

Added to CSS variable names, such as --ds-color-brand, and removed when reading CSS. Tailwind theme names keep their namespace.

Colour output

Write aliases as var(--target) instead of their resolved value.

Write $description and $deprecated notes as CSS comments.

When reading CSS or Tailwind, nest --color-brand-500 as color.brand.500.

Add --<namespace>-*: initial for each namespace the file fills (never --spacing-*: initial, which also clears --spacing).

The link carries the options and this file, compressed after the #, so it never reaches a server.

Report

21 converted
color: 8dimension: 5fontFamily: 2fontWeight: 2cubicBezier: 1shadow: 1border: 1typography: 1
Every token passed validation with no warnings or skipped values.

Tailwind v4 namespaces

Each top-level group is placed in a Tailwind @theme namespace based on its token type and group name. Move a group to :root when you want custom properties without utility classes.

  • color (8)

    color

    Writes --color-*. Utilities: bg-*, text-*, border-*.

  • spacing (1)

    dimension

    Writes --spacing-*. Utilities: p-*, m-*, gap-*.

  • radius (4)

    dimension

    Writes --radius-*. Utilities: rounded-*.

  • font (2)

    fontFamily

    Writes --font-*. Utilities: font-*.

  • font-weight (2)

    fontWeight

    Writes --font-weight-*. Utilities: font-*.

  • ease (1)

    cubicBezier

    Writes --ease-*. Utilities: ease-*.

  • shadow (1)

    shadow

    Writes --shadow-*. Utilities: shadow-*.

  • border (1)

    border

    CSS variables only, no utilities.

  • typography (1)

    typography

    Writes --text-*, --font-*. Utilities: text-*, font-*.

Output

21 valid tokens included
tokens-theme.css
@theme {
  --color-brand: oklch(0.52 0.23 272);
  --color-brand-foreground: oklch(0.985 0 0);
  --color-brand-muted: oklch(0.96 0.03 272);
  --color-background: oklch(1 0 0);
  --color-foreground: oklch(0.145 0 0);
  --color-muted-foreground: oklch(0.556 0 0);
  --color-border: oklch(0.922 0 0);
  /* Focus rings use the brand colour. */
  --color-focus: var(--color-brand);
  /* Tailwind multiplies this unit: p-4 is 4 × 0.25rem. */
  --spacing: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.625rem;
  --radius-xl: 0.875rem;
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0px 1px 2px 0px oklch(0.145 0 0 / 0.06), 0px 4px 12px -2px oklch(0.145 0 0 / 0.08);
  --font-heading: var(--font-sans);
  --text-heading: 2.25rem;
  --text-heading--font-weight: var(--font-weight-semibold);
  --text-heading--letter-spacing: -0.025rem;
  --text-heading--line-height: 1.15;
}

/* Tokens no Tailwind namespace fits: variables only, no utilities. */
:root {
  --border-default: 1px solid var(--color-border);
}

Tokens

21 / 21 (21 total)

Showing 21 of 21 matching tokens (21 total).

Converted design tokens with their path, type, visual preview, resolved value and CSS variable name.
TokenTypePreviewValueCSS nameCopy
color.brand.$rootcolorcolor.brand.$rootoklch(0.52 0.23 272)--color-brand
color.brand.foregroundcolorcolor.brand.foregroundoklch(0.985 0 0)--color-brand-foreground
color.brand.mutedcolorcolor.brand.mutedoklch(0.96 0.03 272)--color-brand-muted
color.backgroundcolorcolor.backgroundoklch(1 0 0)--color-background
color.foregroundcolorcolor.foregroundoklch(0.145 0 0)--color-foreground
color.muted-foregroundcolorcolor.muted-foregroundoklch(0.556 0 0)--color-muted-foreground
color.bordercolorcolor.borderoklch(0.922 0 0)--color-border
color.focus→ color.brand.$rootcolorcolor.focusoklch(0.52 0.23 272)--color-focus
spacing.$rootdimensionspacing.$root0.25rem--spacing
radius.smdimensionradius.sm0.375rem--radius-sm
radius.mddimensionradius.md0.5rem--radius-md
radius.lgdimensionradius.lg0.625rem--radius-lg
radius.xldimensionradius.xl0.875rem--radius-xl
font.sansfontFamilyfont.sans"Geist", ui-sans-serif, system-ui, sans-serif--font-sans
font.monofontFamilyfont.mono"Geist Mono", ui-monospace, monospace--font-mono
font-weight.mediumfontWeightfont-weight.medium500--font-weight-medium
font-weight.semiboldfontWeightfont-weight.semibold600--font-weight-semibold
ease.outcubicBezierease.outcubic-bezier(0.16, 1, 0.3, 1)--ease-out
shadow.cardshadowshadow.card0px 1px 2px 0px oklch(0.145 0 0 / 0.06), 0px 4px 12px -2px oklch(0.145 0 0 / 0.08)--shadow-card
border.defaultborderborder.default1px solid oklch(0.922 0 0)--border-default
typography.headingtypographytypography.heading2.25rem / 1.15 · 600 · "Geist", ui-sans-serif, system-ui, sans-serif--typography-heading

How it works

Three formats, one token tree

Whether you start from a DTCG 2025.10 .tokens.json file (MIME type application/design-tokens+json), a :root block of CSS custom properties, or a Tailwind CSS v4 @theme block, the converter parses your input into one internal token tree. From there, it writes the other two formats plus a normalised copy of the input format in file order.

DTCG 2025.10 validation

The converter checks the structure, names, types, values and references that the Design Tokens Format and Color modules define, and ties every problem to its JSON path and line number. Following section 6.7.3 of the Format module, a token without a $type on itself, its group (after resolving $extends) or an ancestor group is rejected rather than guessed. Both curly-brace aliases ({color.brand.500}) and within-document JSON Pointer $ref targets (to a whole token or its $value) are resolved, and cycles in aliases or $extends are reported on every item in the chain.

Several examples in the published specification include JavaScript comments, trailing commas or "unit": "%", none of which is valid in DTCG 2025.10 JSON. The parser flags comments, trailing commas and duplicate keys with their exact line.

Colours and gamut mapping

All 14 colour spaces from the DTCG Color module are supported. By default, CSS and Tailwind outputs keep each colour in its authored space using CSS Color 4 functions (oklch(), oklab(), lab(), lch(), hsl(), hwb(), or color() for the RGB and XYZ spaces). Switching colour output to Hex converts colours to sRGB and maps wide-gamut colours into sRGB using CSS Color 4 gamut mapping, listing every mapped token in the report.

Tailwind CSS v4 mapping

In Tailwind v4, a variable inside @theme creates utility classes only when its name starts with one of Tailwind's theme namespaces. The mapping table assigns each top-level group a default namespace based on its token type and group name, and lets you move a group to another compatible namespace or to :root when you want CSS variables without utility classes.

Composite typography tokens expand into --text-<name> with --line-height, --letter-spacing and --font-weight sub-properties alongside --font-<name>, so a single text-<name> class sets size, line height, tracking and weight. Aliases between tokens stay plain var() references inside @theme, and Tailwind still emits the variables they point to. A shadow alias works too, but colour utilities such as shadow-red-500 can't recolour it, because the colour sits inside the referenced variable. Tokens that fit no namespace go into a separate :root block. And as on the spacing scale, --spacing-*: initial is never written, because it also clears --spacing.

Reading CSS and Tailwind

When reading CSS or @theme declarations, the converter infers each token's DTCG type from its value and namespace and marks those types as inferred. Pure numeric calc() ratios (such as Tailwind's calc(1 / 0.75)) are evaluated to numbers. CSS values that have no DTCG 2025.10 type, such as em, %, vw, clamp() or mixed calc(), are skipped and listed with the reason.

Light, dark and other modes

A DTCG resolver (opens in a new tab) document (.resolver.json) lists sets of tokens and modifiers, such as a theme with light and dark contexts. Choose it together with the token files it references: each $ref is matched by its path, then by its file name. Every combination of contexts is merged in resolutionOrder (the last occurrence wins), aliases are resolved after the merge, and the usual checks run on each one, so a problem names the input it occurs in, such as theme=dark. Up to 64 combinations are checked one by one.

The default contexts go in :root or @theme, and each other context gets a block with the variables it changes, as a data attribute, a class, the system setting or light-dark(). A var() resolves on the element that declares it, so an alias whose target changes is declared again in that block, which keeps a dark area inside a light page right. Where two contexts together would give the wrong value through the cascade alone, a combined block such as [data-theme="dark"][data-contrast="more"] fixes just those variables. In Tailwind output the blocks sit after @theme, never inside it: Tailwind would move a nested @theme to :root without an error.

CSS works the other way too. Variables under .dark, [data-theme="dark"], the dark prefers-color-scheme query, another [data-*] value or inside light-dark() become contexts, and the DTCG output is a resolver document with every set inline.

Not covered yet

  • Fetching a $ref URL. The page never makes a network request for a file's content: choose the file instead.
  • Another resolver document as a source, which the resolver module doesn't define.
  • $defs in a resolver, which has no defined meaning there. It is ignored with a note.
  • JSONC and JSON5. Files are read as plain JSON.
  • One output file per combination. The DTCG tab writes the tokens for the combination being previewed.
  • Removing a token in a context. The resolver only merges, so a context can add or override a token but not delete one.
  • CSS selectors that combine contexts, such as two attributes together. They are skipped and listed.
  • The older Tokens Studio / Style Dictionary format (value and type without a $ prefix), Tokens Studio $themes.json and Figma variable modes. They are not converted.
  • SCSS, Less, JavaScript/TypeScript, Swift, Android or Figma Variables output.
  • Saving token sets to a workspace project (coming in the Design Context Hub).