File types · Explainer

The SVGZ file (.svgz)

An SVGZ file is an SVG image compressed with gzip: the same shapes and text, in fewer bytes. This guide explains what's inside one, why browsers show it only when the server sends the right headers, how to unpack or create one, and when a plain SVG is the better choice.

At a glance

Full name
Compressed Scalable Vector Graphics (gzip-compressed SVG)
Extensions
.svgz; sometimes .svg.gz
MIME type
image/svg+xml, sent with Content-Encoding: gzip; Linux desktops label the file image/svg+xml-compressed
Kind
Binary: a gzip stream (Deflate) wrapping a plain-text XML SVG file
Standard
W3C SVG, which requires viewers to handle gzip-compressed SVG; gzip itself is RFC 1952
Opens with
Inkscape; Illustrator saves it; browsers only when it's served with Content-Encoding: gzip
Compression
Lossless; SVG markup is repetitive text and often shrinks a lot, small files less (our 666-byte example became 436 bytes)
Magic number
1F 8B 08, the gzip signature; nothing in the first bytes says it's SVG
Can contain
Everything an SVG can: shapes, text, CSS, animation, embedded images and JavaScript

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.

hills.svgz (hex, with offsets)
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. 11F 8B

    The gzip signature

    Every SVGZ starts with these two bytes, like every .gz file. File-type checkers see gzip, not SVG: to know it's an image they have to decompress it and look for <svg.

  2. 208

    Compression method

    8 means Deflate, the only method gzip defines, the same one ZIP and PNG use.

  3. 308 (FLG)

    Flags

    Bit 3 (FNAME) says the original file name follows the header. gzip -n leaves out the name and date, which keeps the output the same every time you compress the same SVG.

  4. 440 92 E0 6A

    Modification time

    The SVG's date as Unix seconds (1793102400). It plays no part in displaying the image.

  5. 5"hills.svg" 00

    Original 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. 66D 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. 793 C4 75 32 · 9A 02 00 00

    Checksum 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. 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 sendsWhat the browser does
Content-Type: image/svg+xml and Content-Encoding: gzipDecompresses it and shows the image, in a tab, an <img> or CSS
Content-Type: image/svg+xml without Content-EncodingTries to read gzip bytes as XML and fails: a parse error or a broken image
application/octet-stream, application/gzip or Content-Disposition: attachmentDownloads the file unchanged
Opened from disk (file://) or as a data: URLNo 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 diskFull sizeCompressedFull size (or a pre-compressed .svg.gz next to it)
Bytes over the networkFull sizeCompressedCompressed (gzip or Brotli)
Works when opened from diskYesVaries by appYes
Server setup neededNoneMust add Content-Encoding: gzip for .svgzA setting most servers and CDNs have, often on already
Readable and diffableYesNoYes

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.svg on 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 .svgz to .svg doesn't decompress it, and renaming .svg to .svgz doesn't compress it.

Troubleshooting

Why is my SVGZ broken, blank or downloading?

SymptomUsual causeFix
"XML parsing error" or garbage characters in the browserThe server sends no Content-Encoding: gzip, or you opened the file from diskConfigure the server for .svgz, or serve a plain .svg
The link downloads instead of showing the imageThe server sends it as a generic file or attachment, as 99helpers doesUpload or link a plain .svg to display it
An app says the SVGZ isn't validIt's actually plain SVG with a .svgz name (often after saving it from a browser), or the app doesn't support compressed SVGLook at the first bytes: <svg or <?xml means rename to .svg; 1F 8B means unpack it first
Broken image after the server was changedDouble compression: the server gzips the already gzipped file againExclude .svgz from on-the-fly compression
Upload rejected as "not an image"The upload filter checks for SVG text and finds gzip bytesUpload 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 .svg lets .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

Last reviewed 27 October 2026.