DevKits

image/*

image/svg+xml

File extensions: .svg

Scalable Vector Graphics — resolution-independent XML-based images.

What is image/svg+xml?

image/svg+xml is the media type for Scalable Vector Graphics. Because SVG is XML, it stays crisp at any zoom level and can be styled with CSS and animated. Icons, logos, and diagrams belong in SVG.

Typical usage

Icons, logos, charts, diagrams, illustrations where sharp rendering at any size matters.

Common gotchas

SVG can execute embedded <script> when loaded as <object> or <iframe> (but not <img>). Sanitize user-uploaded SVG or serve it only inside <img> to prevent XSS.

HTTP header example

Response header

Content-Type: image/svg+xml

Reference

W3C SVG

Frequently asked questions

What is the image/svg+xml MIME type?

image/svg+xml is the media type for Scalable Vector Graphics. Because SVG is XML, it stays crisp at any zoom level and can be styled with CSS and animated. Icons, logos, and diagrams belong in SVG.

What file extension does image/svg+xml use?

Files served as image/svg+xml typically use the extension .svg. The most common is .svg.

How do I set the Content-Type for image/svg+xml?

Send the HTTP response header Content-Type: image/svg+xml. Icons, logos, charts, diagrams, illustrations where sharp rendering at any size matters.

Is image/svg+xml an official MIME type?

Yes. image/svg+xml is officially registered with IANA (W3C SVG), so standards-conformant clients recognize it.

What are common mistakes with image/svg+xml?

SVG can execute embedded <script> when loaded as <object> or <iframe> (but not <img>). Sanitize user-uploaded SVG or serve it only inside <img> to prevent XSS.

Related MIME types

Handle image/svg+xml with these tools