A Figma plugin that streamlines the process of using SVGs in web projects by automating the export, optimisation, and conversion to base64-encoded data URIs for both CSS and HTML.
| Choose between a HTML or CSS (background/mask) | Embedding as a CSS mask allows you to create things like custom lists |
If you've ever needed to embed SVGs directly in your code, you know the process can be tedious:
- Export the SVG from Figma
- Optimise it with a tool like SVGO
- Convert it to base64
- Format it properly for CSS or HTML
This plugin automates the entire workflow with a single click. Select any frame or element in Figma and instantly copy optimised, base64-encoded SVGs ready to use as:
- HTML
<img>tags - CSS
background-imageproperties - CSS
mask-imageproperties (with customisable colors)
Base64-encoded SVGs are particularly useful for:
- Email templates where external images may be blocked or filtered
- CSS backgrounds and decorative elements when you want to avoid additional HTTP requests
- Custom list markers that need to maintain consistency across email clients
- Icon systems where you need a small number of icons without the overhead of an icon font
- Mask images in CSS when you need a shape with a customisable fill color
- Offline applications or environments with limited connectivity
- Performance optimisation for small, frequently used graphics
In these scenarios, embedding SVGs directly in your code eliminates HTTP requests, avoids CORS issues, and ensures visual elements display correctly regardless of external resource availability.
The easiest way to install this plugin is through the Figma Plugin Store.
- Open Figma
- Click on "Resources" or "Plugins"
- Search for "b64-encoder"
- Click "Install"
If you want to extend or modify the plugin, follow these development setup instructions:
This plugin was created with Plugma using the React framework.
-
Install the dependencies and watch for changes while developing:
npm install npm run dev
-
Open the Figma desktop app and import the plugin:
- Open a file in Figma.
- Search for "Import plugin from manifest..." using the Quick Actions bar.
- Choose the
manifest.jsonfile from thedistfolder.
-
Manage
manifestdetails from insidepackage.json.
Run this command to preview your plugin in the browser during development.
npm run previewMake sure the plugin is open in the Figma desktop app.
Before publishing your plugin, make sure to create a build. If not, it will still point to the dev server and won't work properly for users.
npm run buildNow you can publish the plugin from the Figma desktop app.
See the Plugma docs for further information.
- Select one or more elements in your Figma document
- Launch the plugin and choose whether you want HTML or CSS output
- For CSS, select between background image or mask image (with customisable color)
- Click the respective button to copy the optimised code to your clipboard
- Paste directly into your code
Under the hood, the plugin:
- Exports the selected element as an SVG
- Runs it through SVGO for optimisation
- Converts it to a base64 data URI
- Formats it as either CSS or HTML markup
- Copies the result to your clipboard
- Built with Plugma
- SVG optimisation powered by SVGO
- Logo font adapted from work by Brian Kent (Ænigma Fonts)