Skip to content

CSS variables to Figma variables

CSS Variables to Figma Variables, Named Like Your Code

Convert CSS variables to Figma variables from any URL: --brand-primary becomes brand/primary, with text and shadow styles reused when values match.

  • --brand-primary arrives as brand/primary in a Colors · <domain> collection
  • Up to 96 color variables, 48 text styles and sm/md/lg/xl shadow styles
  • Reuses your file's variables and styles when values match
  • Import the same site twice and nothing new is created

EUREKA! · · 5 min read

CSS Variables to Figma Variables, Named Like Your Code

Moving CSS variables to Figma variables is usually manual work: you import a site and get hundreds of layers with hard-coded hex values, none of them linked. HTML to Frames does it at import time, so the colors a site defines in code arrive in your file as real Figma variables, named the way its developers named them. Changing the brand blue no longer means hunting through every frame.

With Styles & variables turned on, HTML to Frames reads the page's CSS custom properties and the colors it actually uses, builds a color variable collection plus text and shadow styles, and binds the imported layers to them. You get a page you can restyle from the Variables panel instead of layer by layer.

What Styles & variables does

One option, three kinds of design-system output:

  • Color variables. Colors used at least twice on the page, and colors that match one of the site's CSS custom properties, become variables. Up to 96 per import, in a collection called Colors · <domain>.
  • Text styles. Typography settings used at least twice, or set at 20 px and above, become text styles. Up to 48 per import.
  • Shadow styles. Shadows that repeat become effect styles named by size: sm, md, lg and xl.

Fills, strokes and text colors on the imported layers are bound to those variables, and text layers use the new text styles. The layers panel still looks like the page; the difference is that it now points at tokens.

CSS variables to Figma variables: an imported page with Auto Layout, color variables, text styles and components
Import result with variables and styles applied

Names come from the code

When a site defines its palette in CSS, those names are used:

CSS custom propertyFigma variable
--brand-primarybrand/primary
--gray-900gray/900
--wp--preset--color--accent (WordPress)wp/accent

A prefix shared by every token (a library namespace, for example) is dropped, so names stay short. Colors that have no custom property get a descriptive name such as blue/500 or neutral/900. Text styles follow <domain>/Heading|Body|Small/<size>/<line height> <weight>, for example example.com/Heading/48/56 Bold, and shadows become <domain>/Shadow/md.

How it works

  1. Capture. The page is rendered in a real browser. Along with the layers, the capture service sends the color tokens declared on :root.
  2. Count usage. Every fill, stroke and text color on the page is counted. Colors used twice or more, and colors that match a token, qualify; the most used come first, up to 96.
  3. Fold near-duplicates. Auto-named colors that differ by no more than 2/255 per channel (#000000 and #010101) are merged into one variable, since nobody can see the difference.
  4. Look in your file first. Before creating anything, the plugin searches the file's local variables and styles. A color variable within 2/255 is reused, including variables from your own design system. A text style is reused when family, weight, size, line height, letter spacing, case and decoration all match. A shadow style is reused when its effects are identical.
  5. Create what's missing. New variables go into Colors · <domain>. Each one gets scopes that fit how the site used it (fill, text or stroke), so the variable picker offers it in sensible places.
  6. Bind. Layers are linked to the variables and styles, then the rest of the build continues: Auto Layout, components, prototype links.

Because step 4 always runs, importing the same site twice creates nothing new: the second import finds every variable and style from the first and links to them. Ten pages of one site end up sharing a single collection.

The results screen sums it up in one line, for example "Linked to … color variables (… reused from this file), … text styles, … shadow styles".

Reused when values match, snapped when they’re close

Why it's different

Several tools now connect imported pages to a design system. They take different routes:

ToolWhat the public docs describe (October 2026)
HTML to FramesColor variables named after the site's CSS custom properties, text styles, shadow styles; your file's matching variables and styles are reused first (Pro)
html.to.designCreates color and text styles from the page, or applies your file's local styles (also on its Free plan)
Figma's own Chrome extensionBinds captured layers to the variables already in your file (paid Figma plans, beta)

The practical difference is the source of the names. In the public docs we reviewed (October 2026), we didn't find another importer that names variables after the site's CSS custom properties. For a design-system team, that matters: brand/primary in Figma and --brand-primary in code are the same conversation. Builder.io, Codia, Anima and html2design focus on layers and layout; their public pages we reviewed don't describe variable creation from CSS tokens.

To be fair to html.to.design: its Free plan includes styles, while in HTML to Frames this is a Pro feature. What Pro adds is variables (not only styles), code-derived names, shadow styles and reuse that makes repeat imports clean.

How to use it

  1. Open HTML to Frames in Figma and paste a URL into the Link tab (or use Multiple, Local file or Browser).
  2. Under Options, make sure Styles & variables is on. It's on by default on Pro and Team.
  3. Optionally turn on Snap to my file's styles to reuse your design system's nearest values (see the related article below).
  4. Press Import.
  5. Open Figma's Variables panel: the Colors · <domain> collection is there, and the text and shadow styles are in the local styles list.
Plugin options list with Styles & variables, Snap to my file's styles and Components & hover states
Styles & variables sits at the top of the Options list

On the Free plan the option shows a PRO badge. Pro is $7/month at launch and is bought inside Figma; Team includes it for five seats.

When it helps most

  • Design-system audits. Import the production site and see which colors and type sizes actually ship, grouped and named.
  • Agency onboarding. A new client's brand palette lands as variables named like their codebase, ready for a redesign proposal.
  • Redesigns. Change brand/primary once and every imported page follows.
  • Design-to-dev conversations. When designers and developers use the same token names, handoff questions get shorter.
  • Multi-page imports. Import ten pages with Multiple and they all share one collection instead of ten copies of the palette.

Good to know

  • Limits per import: 96 color variables and 48 text styles. Only repeated shadows become shadow styles.
  • Transparency stays on the paint as opacity, and gradient stops are not bound to variables.
  • Reuse looks at the file's local variables and styles, so import into the file where your tokens live.
  • If your Figma plan's variable limit is reached, the plugin stops adding variables and the remaining colors keep plain values.
  • Sites without CSS custom properties still get variables, just with descriptive names like blue/500.
  • Styles & variables is a Pro and Team feature.

Get the plugin and import a site you know well: open the Variables panel and you'll recognise the names.

Frequently asked questions

Can I convert CSS variables to Figma variables automatically?
Yes. With Styles & variables on, HTML to Frames reads the color custom properties a page declares and creates Figma color variables named after them, so --brand-primary becomes brand/primary. Colors used at least twice are included too, up to 96 variables in a Colors · <domain> collection.
What happens if I import the same site twice?
Nothing new is created. Before making a variable or style, the plugin looks for one with the same value in your file and reuses it. The second import links to the variables and styles from the first, so multi-page imports share a single collection.
Does it use my existing design system variables?
When a value matches, yes. A local color variable within 2/255 per channel is reused, and text and shadow styles are reused when their settings match exactly. For values that are close but not equal, turn on Snap to my file's styles.
What if the site doesn't use CSS custom properties?
You still get variables. Colors used at least twice are turned into variables with descriptive names such as blue/500 or neutral/900. Text and shadow styles are created the same way either way.
Which plan includes Styles & variables?
Styles & variables is included in Pro and Team. Pro is $7 per month at launch and is bought inside Figma. On the Free plan the option is visible with a PRO badge.

Stop redrawing the web.

Paste a link and get real, editable, responsive Figma layers in seconds. Free to start — 10 imports every month.

Stop redrawing the web.

Paste a link and get real, editable, responsive Figma layers in seconds. Free to start — 10 imports every month.

No credit card. Pro is bought inside Figma.

Coming soon to Figma Community