ImageToSVG

How to Build a Figma Plugin for SVG Export

Build a custom Figma plugin that automates exporting selected design layers as optimized SVG files.

Preset:
Colors:
VTracer vectorization + SVGO optimizationPrivacy protected

Accessing Selected Layers via the Plugin API

Use Figma's Plugin API to read the current selection, then call the exportAsync method on each node with SVG format settings to retrieve the raw SVG markup programmatically.

  • Use figma.currentPage.selection to get the active selection
  • Call node.exportAsync({format: 'SVG'}) to retrieve SVG bytes
  • Loop through multiple selected nodes for batch export

Post-Processing Exported SVG

After exporting raw SVG from Figma, run it through an optimization step (like SVGO) within your plugin or as a follow-up build step to remove unnecessary metadata and reduce file size before delivery.

  • Run exported SVG through SVGO for size and cleanup optimization
  • Strip Figma-specific metadata not needed in production
  • Provide a download or clipboard-copy action for the cleaned SVG

Frequently Asked Questions

Can a Figma plugin export multiple icons at once?

Yes — loop through all currently selected nodes, calling exportAsync on each, then bundle the resulting SVGs into a zip or batch download from your plugin.

Why optimize SVG after exporting from Figma?

Figma's raw SVG export often includes extra metadata and unoptimized path data — running it through SVGO significantly reduces file size for production use.

Related guides

Ready to Convert Your Image to SVG?

Free online converter — no sign-up, no watermarks, results in under 3 seconds.

Try It Free — Convert Image to SVG