svgby garagemade

Convert an SVG to an Android VectorDrawable

svgby garagemade
0,0browser-local
Drop an SVG to start
or pick a sample on the home page

Android doesn't read SVG — it draws a VectorDrawable, an XML format with its own attributes and a smaller feature set. This converts the SVG above into real VectorDrawable XML you can drop into res/drawable, with dp sizing and the correct fill rule. It runs in your browser, so the file stays on your machine.

How to convert an SVG to Android XML

  • Load your SVG above, or edit the even-odd sample. It stays in your browser.
  • Open the Code tab and choose Android VectorDrawable.
  • Read the note listing any features that were stripped.
  • Copy the XML, or download ic_name.xml.

What maps across

  • A <path android:pathData> per shape — rectangles, circles, ellipses, lines, and polygons all become path data, since a vector drawable only draws paths.
  • Fills and strokes map to android:fillColor and android:strokeColor (as #AARRGGBB), with stroke width, line cap, and join.
  • The viewBox sets viewportWidth/viewportHeight; width and height become dp.
  • android:fillType="evenOdd" is emitted only when a path needs it — which is why that path requires minSdk 24.

What gets stripped, and why

Gradients, patterns, masks, clip paths, filters, text, and embedded images either don't exist in a plain vector drawable or belong in a separate asset, so the converter drops them and reports each one. That way you flatten or replace them on purpose instead of shipping a broken drawable. For icons — the usual reason to want an android vector drawable, or to go from svg to android xml — the artwork is normally solid paths, which map cleanly and stay crisp at any density.

Frequently asked questions

What minSdk do I need?
Most VectorDrawable attributes work from API 21. The evenOdd fill type needs API 24, so the converter emits android:fillType only when a path actually relies on the even-odd rule.
Which SVG features are unsupported?
Gradients, patterns, masks, clip paths, filters, text, and embedded images have no plain VectorDrawable equivalent. The tool strips them and lists what it removed, so nothing fails silently.
How is the size set?
The viewBox becomes android:viewportWidth and viewportHeight; the width and height become android:width and android:height in dp. Adjust the dp values to suit your density buckets.
Does it convert shapes to paths?
Yes. Rectangles, circles, ellipses, lines, and polygons are converted to pathData, because a vector drawable only draws path elements.
Where does the file go in my project?
Save it under res/drawable as ic_name.xml and reference it with @drawable/ic_name. The resource name must be lowercase with underscores.
Do you upload my SVG?
No. The Android XML is built in your browser from the SVG you loaded; the file is never transmitted or stored on a server.
Is it free?
Yes. No signup, no watermark.