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.
Quick steps
Select everything on the page
Click the canvas and press ⌘A (Mac) or Ctrl+A (Windows). The detach command only affects what's selected.
Run Detach deleted variables
Open the actions menu with ⌘K or Ctrl+K, search for Detach, and run Detach deleted variables.
Repeat on every page
The command works on the current selection, so switch pages and run it again.
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.
Check components and hidden layers
Open main components and unhide hidden layers. Leftovers there don't show in a normal selection.
Remove libraries you don't need
In the Assets tab, right-click the library and choose Remove library from file.
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.
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.
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.
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.
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 2026Frequently 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.
More in Variables & styles
- How to Export Figma Variables to JSON (and CSS, Tailwind or CSV)Export Figma variables to JSON natively, convert them to CSS or Tailwind with Style Dictionary, and move variables between files with Variable Master.
- Figma Variables Not Showing? Here's Why and How to Fix ItFigma variables now open from the Variables tab in the left nav. If one won't appear in a picker, check its type, scoping and library. Mode switch fixes too.
- How to Toggle a Boolean Variable to Show and Hide Layers in FigmaBind a boolean variable to layer visibility, then toggle it on click with Set variable and a not expression. Plus why boolean variables stop working in Figma.
- How to Change Variable Modes in Figma and Build Dark ModeSet up Light and Dark modes in one Figma color collection, switch a frame or page with Apply variable mode, and fix modes that won't change in prototypes.
- How to Create Text Styles and Color Styles in FigmaCreate text and color styles in Figma, organise them into folders, edit or delete them, fix styles not showing in other files, and know when to use variables.
- How to Create Variables in FigmaCreate Figma variables from the Variables tab, pick the right type, group and duplicate them, delete the ones you don't need and clear leftover used variables.
- How to Create and Publish a Library in FigmaCreate a Figma library: build components, styles or variables in one file, then Assets → Libraries → Publish. Plan and seat rules, drafts, hiding assets.
- How to Make Design Specs in FigmaWhat a Figma design spec should include, how to build a component spec template by hand, what Dev Mode already covers, and how to generate specs with Autospec.
- How to Generate All Component Variants in FigmaFigma shows only the variants you draw. Here's how to lay out every combination of variant, boolean and nested props as a matrix, by hand or with Instancer.
- How to Make a Skeleton Loader in FigmaHow to design a skeleton loader in Figma: grey blocks with auto layout, a component with variants, a Smart Animate shimmer, and a plugin that converts frames.
