0
100
200
300
400
500
600
700
800
900
1000
1100
0
100
200
300
400
500
600
700
800
900
1000
1100
Guide · Variables & styles

How to Remove Unused Variables and Libraries in Figma

To remove leftover variables in Figma, select everything on the page (⌘A / Ctrl+A), open the actions menu (⌘K / Ctrl+K) and run Detach deleted variables. Repeat on each page. Whatever still shows after that is in use somewhere, usually inside a component, a hidden layer or an old colour style, and has to be found and detached by hand.

Figma has no built-in "delete unused" button for variables or styles. For colours that come from a library, delete them in the library file, or right-click the library in the Assets tab and choose Remove library from file.

Updated Sep 27, 20266 min read
On this page

Three different problems get lumped together here, so work out which one you have first:

  • Ghost variables. You deleted a collection or a variable, but it still shows under used variables or in the modes list. That's references still sitting on layers.
  • Unused variables. They exist in your local collections and nothing uses them. That's plain clutter.
  • Library colours you don't want. Colours or styles from another file show up in your pickers. That's a library connection, not something in your file.

Creating, grouping and deleting single variables is covered in how to create variables in Figma. This guide is about the cleanup.

6 steps

Quick steps

1

Select everything on the page

Click the canvas and press ⌘A (Mac) or Ctrl+A (Windows). The detach command only affects what's selected.

2

Run Detach deleted variables

Open the actions menu with ⌘K or Ctrl+K, search for Detach, and run Detach deleted variables.

3

Repeat on every page

The command works on the current selection, so switch pages and run it again.

4

Find what's left with Selection colors

Select a frame and look at Selection colors in the right sidebar. Click the target icon next to a leftover variable to select every layer using it, then detach or replace it.

5

Check components and hidden layers

Open main components and unhide hidden layers. Leftovers there don't show in a normal selection.

6

Remove libraries you don't need

In the Assets tab, right-click the library and choose Remove library from file.

01

How to clear used variables that don't exist anymore

When you delete a collection, Figma disconnects the layers that used it, but references can survive in places a delete doesn't reach. The forum thread on clearing used variables that don't exist anymore runs to over 100 replies. Figma Community Support's answer there has two parts: run Detach deleted variables, and if anything remains, it's still used inside components or old colour styles and has to be removed by hand.

Detach deleted variables isn't documented in the help center, so its exact behaviour isn't spelled out. Users report it only touches the current selection, so select all first and run it once per page.

Where the leftovers usually hide

  • Main components. An instance may look clean while its main component still binds the old variable. Fix the main component and the instances follow.
  • Hidden layers and hidden fills. Selection colors skips hidden fills, and bulk actions don't reach hidden layers. Unhide, fix, hide again.
  • Old colour styles. A style can be built on a variable. Deleting the collection leaves the style pointing at nothing. Edit or delete the style.
  • Strokes and effects. A shadow colour or stroke bound to a variable is easy to miss when you only check fills.
  • Boolean and merged shapes. In the thread on deleted collections and modes that don't disappear, one user's stubborn collection finally went away after they found merged shape layers still holding references.

Use Selection colors to hunt them down

Select a frame, or a whole page with ⌘A / Ctrl+A. Selection colors in the right sidebar groups every colour in the selection by variable, style and plain fill. Hover a leftover and click the target icon to select every layer using it. From there, click Detach, or pick a new variable for all of them at once. It doesn't list image, video or pattern fills, hidden fills or masks.

If nothing works, Figma support can look at the file. Community Support in the same thread asks people to send a support ticket with the file link rather than keep deleting layers at random.

02

Deleted collections and modes still showing

Old modes show up in the Apply variable mode menu and in the page's mode settings for the same reason: something on the canvas still uses a variable from that collection. Clear the references with the steps above and the collection should drop out of the list. Remember that deleting a collection deletes all of its variables, and Figma can only bring them back through an immediate undo or version history.

03

How to find and delete unused variables

Figma doesn't flag variables that nothing uses. You can delete them one by one (right-click → Delete variable), but first you need to know which ones are safe. Two ways to check:

  • Per variable, by hand. Select all on a page and look for the variable in Selection colors. That only works for colour variables, and only on one page at a time.
  • With a plugin. Find Variables lists the variables used on a page and selects the layers using each one. Variable Master's Find Unused Variables checks the whole file and lists variables that aren't bound to any layer, so you can review them before deleting.
If the file is a published library, a variable that's unused in the library file may still be used in files that consume it. Check library analytics, or hide it from publishing first and delete it later.
04

How to remove a colour library from a Figma file

The forum question "How to delete these color libraries?" has about 41.6k views. The fix depends on where the colours come from:

  • They're local to this file. Delete the variables in the Variables tab, or the colour styles in the right sidebar with nothing selected (select them, then Delete style). Layers using a deleted style keep their colour but lose the link.
  • They come from a library you added. In the Assets tab, right-click the library and choose Remove library from file. Colours you've already used stay on the canvas. They just stop appearing as options.
  • They come from a library you have access to but never added. Open the library file, click Share, click your access level and choose Leave. Its styles stop appearing in your pickers, though they may still show in search while you can open the file.
  • You want to replace them with another set. Swap library moves styles, components and variables to matching names in another library. Anything without a match stays linked to the old one.

Removing a library doesn't remove its colours from layers. If you want those gone too, use Selection colors to select the layers and detach or reassign them before you remove the library. More on library connections in Figma library not showing.

05

How to delete unused styles

There's no native check for unused styles either. With nothing selected, the right sidebar lists the file's local styles; Shift-click or ⌘/Ctrl-click to select several, then Delete style. Library styles can only be deleted in the library file, then published. If you'd rather strip styles off layers first, Styler can remove or detach styles from a selection. Figma styles covers editing and publishing them.

Ranked listThe best Figma design token and variables plugins in 2026
FAQ

Frequently asked questions

How do I delete unused variables in Figma?

Figma has no native unused-variable finder. Delete variables one at a time with right-click → Delete variable, after checking they're unused with Selection colors or a plugin that lists unbound variables.

Why do deleted variables still show in my Figma file?

Layers still reference them, often inside components, hidden layers, strokes, effects or old colour styles. Select all, run Detach deleted variables from the actions menu on each page, then fix what's left by hand.

How do I remove a library from a Figma file?

Open the Assets tab, right-click the library and choose Remove library from file. Anything you already used from it stays on the canvas.

Can I undo deleting a variable collection?

Only with an immediate undo or by restoring an earlier version from version history. Deleting a collection deletes every variable in it.

Keep learning

More in Variables & styles

All guides in Variables & styles