What Is the MIME Type of an SVG File?
The MIME type for SVG is image/svg+xml. Learn how to set the SVG content type correctly for vector logos, why wrong headers break display, and what the type does not tell you.
Contents
- The short answer: image/svg+xml
- Why the SVG content type matters for logo delivery
- Compressed SVG (.svgz)
- Setting the SVG MIME type on common servers
- Using the MIME type in HTML and data URIs
- What the MIME type does not tell you about a logo
- Security note for sites that accept SVG uploads
- Gaps in this overview
The short answer: image/svg+xml
An SVG file uses the MIME type image/svg+xml. This is the registered media type for Scalable Vector Graphics, and it is the value a web server should send in the Content-Type header when it delivers a file with the .svg extension. The same type applies whether the SVG holds a vector logo, an icon, an illustration or a chart.
Content-Type: image/svg+xml
The type has two parts. The "image" part tells browsers and other software to treat the file as a picture. The "+xml" suffix signals that the underlying format is XML, which is why an SVG can be opened in a text editor and read as markup.
Why the SVG content type matters for logo delivery
When a vector logo is published on a website or shared through a file host, the browser relies on the Content-Type header rather than the filename to decide what to do with it. If the header is wrong, a perfectly valid logo file can fail in ways that look like a broken file.
- Common symptoms of a missing or incorrect SVG MIME type:
- Served as text/plain or text/xml: the browser may show raw markup or refuse to render the file inside an img element.
- Served as application/octet-stream: the browser typically downloads the file instead of displaying it.
- Combined with the X-Content-Type-Options: nosniff header: the browser will not guess the type, so a wrong value reliably blocks rendering.
If a logo displays correctly when opened from a local folder but not when loaded from a server, the server's MIME configuration is one of the first things worth checking.
Compressed SVG (.svgz)
An .svgz file is an SVG compressed with gzip. It keeps the same MIME type, image/svg+xml, but the server must also send a Content-Encoding: gzip header so the browser knows to decompress it before rendering. Without that encoding header, the browser receives compressed bytes it cannot read as XML.
Content-Type: image/svg+xml
Content-Encoding: gzip
Setting the SVG MIME type on common servers
Many current server installations already map .svg to image/svg+xml, but older or customized configurations may not. The examples below show the standard directives.
Apache (in the server configuration or an .htaccess file):
AddType image/svg+xml .svg .svgz
AddEncoding gzip .svgz
Nginx (in the types block, usually within mime.types):
types {
image/svg+xml svg svgz;
}
For .svgz on Nginx, the Content-Encoding: gzip header also has to be added for those files. Cloud storage buckets and content delivery networks usually set the content type per object at upload time, so a logo uploaded with the wrong type may need its metadata corrected rather than a server setting changed.
Using the MIME type in HTML and data URIs
The type also appears when an SVG is referenced or embedded directly in markup or CSS.
<object data="logo.svg" type="image/svg+xml"></object>
<link rel="icon" href="favicon.svg" type="image/svg+xml">
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' ...%3E");
An optional charset parameter, such as image/svg+xml; charset=utf-8, can be added when the encoding needs to be stated explicitly. It is not required for the type to be recognized.
What the MIME type does not tell you about a logo
A correct image/svg+xml header confirms only that the file is delivered as SVG. It does not confirm that the logo inside is made of editable vector paths. An SVG can wrap an embedded raster image, such as a PNG or JPEG placed with an image element, in which case it scales no better than the raster it contains. Some exports also mix vector shapes with embedded bitmaps, or convert text to outlines so the original font is no longer editable.
To know whether an SVG logo is truly vector artwork, open it in a vector editor or inspect the markup for path, shape and text elements rather than an embedded image reference. Neither the .svg extension nor the content type is enough on its own.
Security note for sites that accept SVG uploads
Because SVG is XML, it can contain scripts and external references. When a browser opens an SVG directly as image/svg+xml, those scripts can run. Sites that let users upload logos should sanitize SVG files, serve them from a separate domain, or apply a restrictive Content Security Policy. When an SVG is shown through an img element, browsers do not execute its scripts, which is one reason that method is often preferred for displaying uploaded logos.
Gaps in this overview
This article covers the documented MIME type and standard configuration patterns. It does not include measured performance comparisons between .svg and .svgz, nor default settings for specific hosting providers, content management systems or versions, since no verified data on those was available. Check your own platform's documentation for its exact behavior.