The basics
What is an SVGZ file?
An SVG image is XML text: tags, attributes and long lists of path coordinates. Text like that compresses well, so the SVG standard allows SVG to be stored compressed with gzip and requires viewers to handle it. .svgz is the usual extension for such files. Unpack an SVGZ and you get back the original SVG, byte for byte.
SVGZ was popular in the 2000s, when bandwidth and storage were tighter and web servers didn't compress responses by default. Inkscape and Illustrator can still save it, and you'll find .svgz files in icon themes, clip-art collections, maps and older websites.
- It's the same image. Compression changes the bytes, not the drawing: same shapes, text, scripts and size.
- It's not text any more. You can't open an SVGZ in a text editor or diff two versions in Git without unpacking them first.
- Browsers are picky about it. They show SVGZ only when the server says it's gzip-compressed SVG; otherwise they show an error or download the file (see below).
Anatomy
What's inside an SVGZ file
An SVGZ is a gzip file whose content is an SVG. There's no sample on this page, so we compressed the small hills.svg from our SVG guide with gzip -9 and dumped the result: a 10-byte header, the original file name, the compressed data and an 8-byte trailer. Numbers in the header and trailer are little-endian.
offset bytes part
0 1F 8B gzip signature
2 08 CM: 8 = Deflate
3 08 FLG: bit 3 = file name follows
4 40 92 E0 6A MTIME: 27 Oct 2026, 12:00 UTC
8 02 XFL: 2 = maximum compression
9 03 OS: 3 = Unix
10 68 69 6C 6C 73 2E 73 76 67 00 "hills.svg", then 0
20 6D 52 4D 6F A3 30 10 BD … 408 bytes of Deflate data
428 93 C4 75 32 CRC-32 = 0x3275C493
432 9A 02 00 00 ISIZE = 666 bytes unpacked
436 end of file
After decompression, ordinary SVG text:
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 120 80" width="240" height="160">
<title>A sun over green hills</title>
…
</svg>- 1
1F 8BThe gzip signature
Every SVGZ starts with these two bytes, like every
.gzfile. File-type checkers see gzip, not SVG: to know it's an image they have to decompress it and look for<svg. - 2
08Compression method
8 means Deflate, the only method gzip defines, the same one ZIP and PNG use.
- 3
08 (FLG)Flags
Bit 3 (FNAME) says the original file name follows the header.
gzip -nleaves out the name and date, which keeps the output the same every time you compress the same SVG. - 4
40 92 E0 6AModification time
The SVG's date as Unix seconds (1793102400). It plays no part in displaying the image.
- 5
"hills.svg" 00Original file name
Stored because we compressed a file called
hills.svg. Tools that unpack the SVGZ usually ignore it and use the SVGZ's own name. - 6
6D 52 4D 6F …The compressed SVG
408 bytes of Deflate data holding the 666-byte SVG. Larger files with long paths, repeated attributes and editor metadata compress much better than this tiny one.
- 7
93 C4 75 32 · 9A 02 00 00Checksum and size
The CRC-32 of the original SVG and its length, 666 bytes. A truncated download fails this check, which is why a damaged SVGZ shows nothing at all rather than half a picture.
- 8
<svg xmlns="http://www.w3.org/2000/svg"The SVG inside
Once unpacked, it's an ordinary SVG with the same namespace,
viewBox, shapes and text. Everything in the SVG guide applies.
Serving
Why browsers show some SVGZ files and download others
Browsers don't recognise .svgz by its extension or its first bytes. They rely on HTTP headers. The SVG 2 specification says a server sending stored compressed SVG must label it Content-Type: image/svg+xml with Content-Encoding: gzip; the browser then decompresses it and draws the SVG. If the labels don't match the data, viewers must treat it as an error.
| What the server sends | What the browser does |
|---|---|
Content-Type: image/svg+xml and Content-Encoding: gzip | Decompresses it and shows the image, in a tab, an <img> or CSS |
Content-Type: image/svg+xml without Content-Encoding | Tries to read gzip bytes as XML and fails: a parse error or a broken image |
application/octet-stream, application/gzip or Content-Disposition: attachment | Downloads the file unchanged |
Opened from disk (file://) or as a data: URL | No headers, so most browsers fail to show it; Firefox shows an XML parse error |
On 99helpers
99helpers serves .svgz files as downloads, so visitors get the file itself to open in Inkscape or another editor. To show the image in the browser, upload a plain .svg: it's shown directly, and compressed in transit anyway.
One more quirk: when a browser saves a file that was sent with Content-Encoding: gzip, it usually stores the decompressed content. Right-click, Save on a displayed SVGZ can therefore give you plain SVG text in a file still called .svgz, which other programs then fail to open. Rename it to .svg.
Comparison
SVGZ vs SVG with server compression
| Plain .svg | .svgz | .svg, compressed by the server | |
|---|---|---|---|
| Bytes on disk | Full size | Compressed | Full size (or a pre-compressed .svg.gz next to it) |
| Bytes over the network | Full size | Compressed | Compressed (gzip or Brotli) |
| Works when opened from disk | Yes | Varies by app | Yes |
| Server setup needed | None | Must add Content-Encoding: gzip for .svgz | A setting most servers and CDNs have, often on already |
| Readable and diffable | Yes | No | Yes |
The SVG 2 specification itself notes that it's often easier to store uncompressed SVG and let the server compress it. Most CDNs, and web servers with compression switched on for image/svg+xml, compress SVG on the fly, so a website gets SVGZ's savings without SVGZ's problems. SVGZ still makes sense for saving disk space in large collections, and for apps that read it directly, such as Inkscape.
How to
How to open, create and convert an SVGZ file
- Inkscape (free) opens SVGZ files and can save them: choose a compressed SVG type in File, Save As. Editing and resaving works like plain SVG.
- Illustrator saves SVGZ through File, Save As; its Export commands only write plain SVG.
- Unpack it to plain SVG:
gzip -dc image.svgz > image.svgon macOS or Linux; on Windows, 7-Zip extracts it. The result opens in any browser or text editor. - Create one:
gzip -9 -n -c image.svg > image.svgz. Check the result by unpacking it again. - Convert to PNG: unpack it first, then convert the SVG as usual, or export a PNG from Inkscape.
- Renaming isn't enough: renaming
.svgzto.svgdoesn't decompress it, and renaming.svgto.svgzdoesn't compress it.
Troubleshooting
Why is my SVGZ broken, blank or downloading?
| Symptom | Usual cause | Fix |
|---|---|---|
| "XML parsing error" or garbage characters in the browser | The server sends no Content-Encoding: gzip, or you opened the file from disk | Configure the server for .svgz, or serve a plain .svg |
| The link downloads instead of showing the image | The server sends it as a generic file or attachment, as 99helpers does | Upload or link a plain .svg to display it |
| An app says the SVGZ isn't valid | It's actually plain SVG with a .svgz name (often after saving it from a browser), or the app doesn't support compressed SVG | Look at the first bytes: <svg or <?xml means rename to .svg; 1F 8B means unpack it first |
| Broken image after the server was changed | Double compression: the server gzips the already gzipped file again | Exclude .svgz from on-the-fly compression |
| Upload rejected as "not an image" | The upload filter checks for SVG text and finds gzip bytes | Upload a plain SVG, or teach the filter to decompress SVGZ before checking it |
Security
Is it safe to open or accept SVGZ files?
Compression doesn't change what an SVG can do, it only hides it. An SVGZ carries the same risks as SVG, plus one from gzip:
- Scripts. An SVGZ can contain JavaScript that runs when the file is opened as a document from your site, leading to stored cross-site scripting. A filter that scans uploads for
<script>sees only compressed bytes unless it decompresses them first. - Decompression bombs. Deflate can shrink repetitive data by about 1,000 to 1 (see GZ). A small SVGZ can unpack into gigabytes of XML and exhaust a server's memory or disk. Cap the decompressed size before parsing.
- XML attacks. Once unpacked, the SVG is parsed as XML, so converters must also be protected against external entities and nested entity expansion.
- Detection by extension. Checking only for
.svglets.svgz(and.svg.gz) through. Identify uploads by content, and treat gzip-compressed SVG as SVG.
If you accept SVGZ uploads
Decompress them with a size limit, sanitise the SVG with a library built for it, and either store the clean result as plain SVG or serve user files with Content-Disposition: attachment from a separate domain. If you only need a picture, converting to PNG removes the problem.
Sample files
There are no sample SVGZ files on this page yet. To make one for testing, compress any SVG, for example one of our SVG samples, with gzip -9 -n -c image.svg > image.svgz, or save a drawing from Inkscape as compressed SVG.
Put it online
Have an SVGZ file? Give it a link.
Drop an SVGZ on 99helpers and it gets its own link. Visitors download the compressed file to open in Inkscape, Illustrator or another editor; to show the image in the browser, upload the plain .svg instead.
Questions
SVGZ files, frequently asked
What is an SVGZ file?
An SVG vector image compressed with gzip. It holds exactly the same drawing as the SVG, in fewer bytes, but it's binary rather than readable text.
How do I open an SVGZ file?
Open it in Inkscape or Illustrator, or unpack it to a plain SVG with gzip -dc image.svgz > image.svg (or 7-Zip on Windows) and open that in a browser.
Why does my browser show an error or download the SVGZ?
Browsers only display SVGZ when the server sends it as image/svg+xml with Content-Encoding: gzip. Opened from disk or served without that header, it fails or downloads.
How do I convert SVGZ to SVG?
Decompress it: gzip -dc image.svgz > image.svg, or open it in Inkscape and save as plain SVG. Renaming the file isn't enough.
Should I use SVGZ on my website?
Usually not. Serve plain SVG and let the server compress it with gzip or Brotli: you get the same savings, and the file works everywhere without special headers.
Is SVGZ smaller than SVG?
Yes, on disk and over the network. How much depends on the file: small SVGs shrink a little, large ones full of path data and editor metadata often shrink a lot.
Can an SVGZ file contain a virus?
It can contain anything an SVG can, including JavaScript, and a crafted one can also be a decompression bomb. Treat it like SVG: open it from trusted sources, and sanitise uploads after decompressing them with a size limit.
Related formats
Other file types explained
Keep going
Related
Sources
- SVG 2: conformance, including compressed SVG on servers and viewers (W3C)
- RFC 1952: GZIP file format specification
- Can I use: SVGZ support in browsers
- Mozilla bug 1414620: local .svgz files don't load in Firefox
- Moxio: Serving compressed SVG files
- Inkscape wiki: plain SVG and compressed SVGZ
Last reviewed 27 October 2026.