Skip to content

SVG to Power Fx Converter

SVG images stay sharp at any size, which makes them ideal for icons and logos in Power Apps. The catch is that a canvas app cannot read an SVG file directly: you have to turn the SVG code into a text formula for an Image control. This converter does that for you. Paste or upload an SVG, choose the output style and copy a ready Power Fx formula or a YAML snippet. It also minifies the SVG, fixes quotes and can replace colors with your own variables.

Also known as: svg to power apps, power apps svg image, svg to base64 power apps, power apps svg icon, power fx encodeurl svg.

Output type
Quotes inside the SVG

Your data is processed locally in your browser and is not uploaded to our servers.

Features

  • Power Fx formula with EncodeUrl or Base64
  • YAML snippet for an Image control
  • Minify, single-quote and quote-escape options
  • Dynamic colors from Power Fx variables
  • Live preview, runs in your browser

How to use the SVG to Power Fx Converter

  1. Paste your SVG code, or click Upload .svg and choose a file up to 500 KB.
  2. Keep Minify SVG ticked. It removes comments, the XML header and extra spaces, which makes the formula much shorter.
  3. Choose EncodeUrl (recommended) or Base64, and keep Use single quotes unless your SVG contains apostrophes.
  4. Optional: under Dynamic colors, type a variable name next to a color so that part of the icon follows your app theme.
  5. Copy the formula into the Image property of an Image control, or copy the YAML and use Paste code in Power Apps Studio.

Real-world use case: a navigation menu whose icons follow your app theme

A typical canvas app has a side menu with six or seven icons. PNG images mean one file per icon and per color, plus blurry edges on high-resolution screens. With SVG, every icon is one formula, and it scales cleanly on a phone, a tablet and a wide monitor.

Here is the workflow. Export the icon from your design tool or an icon library as SVG, paste it here and open Dynamic colors. The tool lists every color in the SVG, for example #742774. Type varIconColor next to it. The formula now builds the image from that variable, so Set(varIconColor, "#742774") in App OnStart gives you a purple icon, and setting it to "#FFFFFF" when a menu item is selected turns it white. One icon covers every state, and a rebrand needs one change instead of dozens of image uploads.

Large icons are the usual source of trouble. Power Apps limits the length of a formula (about 8,000 characters), and SVGs exported from design tools often carry metadata and hundreds of path points. If the converter warns that the formula is too long, simplify the SVG in your design tool, run it through an optimizer such as SVGO first, or choose a simpler icon. If you reuse the same icon in many places, store the formula once as a named formula in App.Formulas and refer to it by name.

If an image does not show, check the three usual causes: the SVG has no xmlns attribute (the converter adds it), a double quote was not escaped (the single-quote option avoids this), or the SVG relies on features that an image control does not run, such as scripts or external fonts.

Example input and output

Input: a small SVG icon

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#742774" d="M12 2l3 7h7l-5.5 4.5L18 21l-6-4-6 4 1.5-7.5L2 9h7z"/></svg>

Output: formula for the Image property

"data:image/svg+xml;utf8," & EncodeUrl("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'><path fill='#742774' d='M12 2l3 7h7l-5.5 4.5L18 21l-6-4-6 4 1.5-7.5L2 9h7z'/></svg>")

Output with a dynamic color (varIconColor)

"data:image/svg+xml;utf8," & EncodeUrl("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'><path fill='" & varIconColor & "' d='M12 2l3 7h7l-5.5 4.5L18 21l-6-4-6 4 1.5-7.5L2 9h7z'/></svg>")

Frequently asked questions

Why does my SVG show as a broken image in Power Apps?

The most common causes are a missing xmlns attribute, double quotes that were not escaped inside the formula, or a formula that is too long. This converter adds the namespace, offers single quotes so nothing needs escaping and warns you about the length.

Is there a size limit for an SVG in a Power Fx formula?

Power Apps limits a formula to about 8,000 characters, so long SVGs will not fit. Minify the SVG, remove paths you do not need or use a simpler icon.

Can I change the color of an SVG icon with a variable?

Yes. Use the dynamic colors option to replace a color with a Power Fx expression that returns hex text, such as a variable that holds #742774. Set the variable on app start or whenever the state changes.

Why use PowerApps Ninja?

SVG files from client projects or internal design systems should not be uploaded to unknown websites. PowerApps Ninja converts them in your browser and never sends them anywhere. It also removes scripts and event handlers by default, and the preview is drawn as an image, so the SVG cannot run code.

Related tools