Figma Token ConverterJSON to CSS, Tailwind & SCSS

Paste token JSON from Figma or Tokens Studio and get CSS variables, a Tailwind theme.extend config, and SCSS variables. Preview light and dark modes before you copy.

Your input is never sent anywhere.

Details

Design token JSON

Convert Figma design tokens to CSS variables, Tailwind, and SCSS

This converter reads design token JSON exported from Figma plugins such as Tokens Studio and outputs three formats: CSS custom properties, a Tailwind theme.extend object, and SCSS variables. Paste the JSON or open a .json file, and the output updates as you edit.

If the JSON has top-level light and dark keys, the tool pairs them and writes dark overrides only for values that differ from light. The preview shows colors, type, spacing, radius, and shadows, and you can flip between light and dark to check each token.

Set a variable prefix, choose kebab-case, camelCase, or snake_case, and pick how dark mode is scoped: a .dark class, a data-theme attribute, or a prefers-color-scheme media query. The Tailwind tab can output CommonJS or an ES module.

Use cases: design handoff, theming, Tailwind setup

Handing a Figma design system to developers

Turn the color, spacing, and type tokens a designer maintains into CSS variables a front-end project can import as is.

Adding dark mode to an existing stylesheet

Provide a light and a dark set of tokens and get the :root block plus a dark override block, so you do not write the overrides by hand.

Wiring tokens into a Tailwind theme

Generate a theme.extend object whose values point to your CSS variables, so classes like bg-primary follow the active theme.

Checking tokens before you commit them

Review swatches, type samples, spacing bars, radii, and shadows in the preview to confirm each token name matches what you expect.

How to convert Tokens Studio JSON to CSS variables in 4 steps

  1. Paste your token JSON into the input box, or choose a .json file. Select Load sample to try the tool first.
  2. Check the preview. Use the Light and Dark buttons, the category filters, and the search box to review tokens. Click a color swatch to copy its value.
  3. Under Options, set a prefix, naming style, dark mode method, and Tailwind module format.
  4. Open the CSS variables, Tailwind config, or SCSS variables tab, then select Copy or Download (tokens.css, tailwind.tokens.js, or _tokens.scss).

Note: The output regenerates whenever you edit the JSON or change an option, so you can keep the page open while you adjust tokens in Figma.

Limits and behavior to know before you copy the output

  • Token type comes from the type or $type field first. Without one, the tool guesses from the value (color formats) and then from words in the key path. Tokens it cannot place are listed as Other.
  • Dark mode is detected from top-level light and dark keys. Without them, only one set of values is written and there is no dark block. A token that exists only under dark is written to :root with its dark value, so it has no override.
  • Token references such as {color.primary} are not resolved. They are copied as literal text, so replace them with real values first.
  • An object value, such as a typography or shadow token with several fields, is split into one token per field. Arrays are skipped. For shadows, a single CSS string like 0 1px 2px rgba(0,0,0,0.1) works best.
  • In the Tailwind output, the first key in a token's path is used as the group and dropped from the class name, so color.primary becomes primary under colors. Tokens in the Other category are left out.
  • Your JSON is processed in your browser and this tool does not upload it.

Token type to Tailwind theme key mapping

Type values the converter recognizes (case-insensitive) and the theme.extend key each one is written to.

Token typeCommon type valueTailwind theme key
Colorcolorcolors
Spacing and sizingspacing / sizingspacing
Border radiusborderRadiusborderRadius
ShadowboxShadowboxShadow
Opacityopacityopacity
Font sizefontSizes / fontSizefontSize
Font familyfontFamilies / fontFamilyfontFamily
Font weightfontWeights / fontWeightfontWeight
Line heightlineHeights / lineHeightlineHeight
Letter spacingletterSpacingletterSpacing

When there is no type field
For JSON such as {"colors":{"primary":"#2563eb"}}, the tool checks the value first: hex, rgb(), rgba(), hsl(), and hsla() values count as colors. Otherwise it checks the key path for shadow, radius, opacity, font-related words, then spacing-related words, then color words, in that order. A typography token without a type is written to fontSize in Tailwind. Add a type field to control the result.

Theming with CSS custom properties: what to know

A short background on naming, dark mode, and Tailwind when you move tokens from Figma into code.

Keep raw values and meaning separate

A raw value such as #2563eb and a meaningful name such as color-primary are different things. Components should reference the name. For dark mode, change what the name points to in each theme instead of editing the raw palette.

What a token export looks like

Tokens Studio stores each token as an object with value and type. The W3C design tokens format spells these $value and $type. This converter accepts both spellings, so either export can be pasted in.

Dark mode with CSS variables

Define variables on :root and override them inside a dark selector such as .dark or [data-theme="dark"]. Use an @media (prefers-color-scheme: dark) block when the theme should follow the operating system setting. Component CSS only references the variable names and stays the same in both themes.

Tailwind classes backed by CSS variables

Adding tokens to theme.extend gives you classes like bg-primary. Because each value is a var(--...) reference, the browser resolves it at runtime, so switching themes only changes the variables and not the class names.

Why your tokens come out wrong (and how to fix it)

A token lands in Other or the wrong Tailwind group

Without a type field, a key like base or default matches nothing and is listed as Other, which Tailwind leaves out. A typography token with no type, such as a font weight, is written to the fontSize group.

💡 See the solution▼
Export with a type for every token (color, spacing, fontSizes, fontWeights, and so on), or add the type field by hand. The type always wins over the key-name guess.

Dark mode values are missing for some tokens

A token that exists only under light gets no dark override and keeps its light value in dark mode. A token that exists only under dark is written to :root with its dark value, so it never switches.

💡 See the solution▼
Give light and dark the same keys and nesting. Switch the preview between Light and Dark to confirm every token changes where you expect.

Tailwind classes show no color or have unexpected names

The Tailwind output points to CSS variables, so colors stay empty when those variables are not loaded. Class names can also differ from what you expect, because the first key in each token's path is dropped.

💡 See the solution▼
Add the generated CSS variables to your global stylesheet along with the Tailwind config. Put spacing, radius, and font tokens under a top-level group key such as spacing or radius, as in the sample, so classes read p-md instead of p-spacing-md.

SCSS dark values do not switch on their own

The SCSS output writes dark values as separate variables ending in -dark, such as $color-primary-dark. SCSS variables are compiled in advance and do not follow a theme at runtime.

💡 See the solution▼
Use the CSS variables output for runtime theme switching. Use the SCSS dark variables only if your build generates a separate dark stylesheet or uses them in your own mixins.

FAQ: JSON formats, dark mode, and Tailwind output

Q.What JSON formats does the converter accept?

Q.

A. It reads nested JSON where each token is an object with value and type (or $value and $type), and flat JSON that is just keys and values. If the root has light and dark keys, they are treated as a light/dark pair. Arrays are skipped, and an object value is split into one token per sub-field.

Q.How does it decide if a token is a color, spacing, or font size?

Q.

A. It uses the type or $type field first. If there is none, it checks whether the value looks like a color (hex, rgb(), rgba(), hsl(), hsla()), then looks for words such as shadow, radius, opacity, font, spacing, or color in the token's key path. Tokens that match nothing are listed as Other and left out of the Tailwind output. Add a type field to the JSON when the guess is wrong.

Q.How do I set up light and dark mode?

Q.

A. Put your tokens under top-level light and dark keys, using the same structure in both. The key names are not case-sensitive. Tokens that do not change between modes, such as spacing or radius, go under any other top-level key. The CSS output writes dark overrides only for tokens whose dark value differs from the light value.

Q.How can dark mode be scoped in the CSS output?

Q.

A. You can choose a .dark class, a :root[data-theme="dark"] attribute selector, or an @media (prefers-color-scheme: dark) block. The default is the data-theme attribute. Switching the option rewrites the dark block immediately.

Q.Can I paste the Tailwind output straight into my config?

Q.

A. The output is a theme.extend object wrapped in a CommonJS module.exports, or an ES module export default if you pick that option. Copy the theme.extend contents into your own config. Every value is written as var(--your-variable), so the generated CSS variables must also be loaded in your global stylesheet.

Q.Does it resolve token references like {color.primary}?

Q.

A. No. Values are copied exactly as written, so a reference such as {color.primary} appears in the output as that literal text. Replace references with their actual values before you paste the JSON.

Q.How are the variable names built?

Q.

A. The key path is joined with hyphens, so color.primary becomes --color-primary. A prefix is added in front, so a prefix of tkl gives --tkl-color-primary. The naming style option converts the name to kebab-case, camelCase (--colorPrimary), or snake_case (--color_primary).

Q.Is my JSON uploaded anywhere?

Q.

A. No. The JSON is parsed and converted in your browser, and this tool does not send it to a server. Opening a .json file also reads it locally. Closing the page clears the input.

User Feedback & Request

Your feedback
makes this tool better.

Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.

Send feedback