Basic Examples

Import an SVG file as vector graphics:
In[]:=
Export["disks.svg",Graphics[{Opacity[0.5],Blue,Disk[],Yellow,Disk[{1,0}]}]]
Out[]=
disks.svg
In[]:=
[◼]
SVGImport
["disks.svg"]
Out[]=
Import an SVG file with formatted text:
In[]:=
Export["lorem.svg","Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."]
Out[]=
lorem.svg
In[]:=
[◼]
SVGImport
["lorem.svg"]
Out[]=
Import an SVG file from the web:
In[]:=
[◼]
SVGImport
["https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"]
Out[]=
Import a formula:
In[]:=
Export["formula.svg",Integrate[Sqrt[x+Sqrt[x]],x]]
Out[]=
formula.svg
In[]:=
[◼]
SVGImport
["formula.svg"]
Out[]=

Scope

Import an SVG file from a string:
In[]:=
[◼]
SVGImport
["<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n\n\n<!-- Page 1 -->\n<svg x=\"0\" y=\"0\" width=\"68\" height=\"68\" viewBox=\"0 0 68 68\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\nstyle=\"display: block;margin-left: auto;margin-right: auto;\">\n<defs>\n<clipPath id=\"c_1\"><path d=\"M0,0H68V68H0Z\" /></clipPath>\n<style type=\"text/css\"><![CDATA[\n\n.g0_1{\nfill: #FC6B34;\n}\n.g1_1{\nfill: none;\nstroke: #FC6B34;\nstroke-width: 0.15277778;\nstroke-linecap: square;\nstroke-linejoin: miter;\n}\n.g2_1{\nfill: #DF4708;\n}\n.g3_1{\nfill: #FFFFFF;\n}\n\n]]></style>\n\n</defs>\n<g clip-path=\"url(#c_1)\">\n<path d=\"M0,0\nL0,68\nL68,68\nL68,0 Z \" \nfill=\"#FFFFFF\" stroke=\"none\" />\n<path d=\"M0,0H68.8V68.8H0V0Z\" class=\"g0_1\" />\n<path d=\"M0,0H68.8V68.8H0V0Z\" class=\"g1_1\" />\n<path fill-rule=\"evenodd\" d=\"M68.8,34.4c0,19,-15.4,34.4,-34.4,34.4C15.4,68.8,0,53.4,0,34.4C0,15.4,15.4,0,34.4,0c19,0,34.4,15.4,34.4,34.4Z\" class=\"g2_1\" />\n<path fill-rule=\"evenodd\" d=\"M15,29.2v-.6c.1,-.8,.2,-1.6,.5,-2.4c.6,-1.8,1.7,-3.4,3.1,-4.5c1.3,-1.2,2.9,-2,4.5,-2.2c1.2,-.1,2.3,.3,3.1,1.1c.5,.3,.7,.9,.6,1.5c-.2,.7,-.7,1.4,-1.3,1.8c-.4,.4,-.9,.4,-1.3,0C23.3,23,22.2,22,21.1,22c-.7,0,-.9,.4,-1.1,1c-.2,1.8,-.2,3.6,0,5.4v.9h4.2c.2,.4,.1,1.7,-.5,2H20V42.7c0,2.4,.3,2.5,3,2.8V47H12.8V45.5c2,-.3,2.2,-.4,2.2,-2.8V31.3H12.7l-.3,-.5l1.2,-1.5ZM29.1,47V26.6h7.3v1.6q-3.7,.4,-3.7,3.5V42c0,2.9,0,3,3.7,3.4V47Zm8.4,-6.9V33.5c0,-.7,.6,-1.3,1.3,-1.3h6.6c.7,0,1.3,.6,1.3,1.3v6.6c0,.7,-.6,1.3,-1.3,1.3H38.8c-.7,0,-1.3,-.6,-1.3,-1.3ZM47.9,47V45.4c3.6,-.4,3.7,-.5,3.7,-3.6v-10c0,-3.1,-.1,-3.2,-3.7,-3.6V26.6h7.3V47Z\" class=\"g3_1\" />\n\n</g>\n</svg>\n"]
Out[]=
Import from a byte array:
In[]:=
[◼]
SVGImport
ByteArray
96.7 kB

Out[]=
Import from a
URL
:
In[]:=
[◼]
SVGImport
[URL["https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"]]
Out[]=
Import a
CloudObject
:
In[]:=
co=CloudExport
,"SVG"
Out[]=
CloudObject[
https://www.wolframcloud.com/obj/a1eae1d1-ab96-45e2-b327-1a03aea4786c
]
In[]:=
[◼]
SVGImport
[co]
Out[]=
Import a
LocalObject
:
In[]:=
lo=Export[LocalObject[],Plot[{Sin[x],Sin[2x],Sin[3x]},{x,0,2Pi},PlotLegends"Expressions"],"SVG"]
Out[]=
LocalObject[file:///C:/Users/rhennigan/AppData/Roaming/Wolfram/Objects/5bdb6dcb-9126-44ef-a561-9cace68c7cc4]
In[]:=
[◼]
SVGImport
[lo]
Out[]=

Options

ShowWarnings

By default, warnings about potential conversion issues are not shown. In this example, some complex gradients were not converted correctly:
See the expected appearance:
Show warnings to see details about conversion problems:
In[]:=

IntermediateFormat

The result will no longer be scalable vector graphics, however:
In[]:=

Properties and Relations

Possible Issues

Dynamic JavaScript content will not work:
Animations are also not supported: