Skip to content
Aback ZIP

Comparisons · 9 min read · Updated

Zstandard vs GZIP vs XZ Compared

How Zstandard, gzip and xz differ in design, speed, ratio, memory use and integrity checks, and how to choose the right compressed stream for a job.

Gzip is the universal default, xz aims for a smaller result at higher cost, and Zstandard is built around adjustable speed with good compression. All three compress a single stream, so for several files you normally combine them with TAR.

Three formats, three goals

Gzip is defined in RFC 1952 and uses DEFLATE. It was designed to be simple, fast and easy to stream, and it became ubiquitous in web servers, log rotation and TAR.GZ archives. XZ is a container around LZMA2, documented by the XZ project, aimed at strong compression ratios. Zstandard is specified in RFC 8478 and was designed, in the words of its reference implementation, to offer a wide range of compression levels while staying fast on both compression and decompression.

PropertygzipxzZstandard
Underlying methodDEFLATELZMA2Zstandard codec
Typical goalFast, universalSmall outputTunable speed and good ratio
Integrity checkCRC-32Configurable checks including CRC32 and CRC64Optional checksum in the frame
Multiple members / framesConcatenated membersStreams with block structureFrames, including skippable frames
Dictionary supportNoNo in the usual file formatYes
Common extension.gz.xz.zst
Paired with TAR as.tar.gz / .tgz.tar.xz / .txz.tar.zst

Speed and ratio: a trade-off, not a winner

Compression involves finding repeated patterns. Simple algorithms find them quickly but may miss distant repeats; more complex algorithms find more repeats but use more CPU and memory. Gzip sits at the fast and simple end. XZ/LZMA2 tends to compress text and structured data very well, with more work on the way in and out. Zstandard spans a range of levels, so it can be configured for very fast compression or for a better ratio.

Avoid universal claims such as one format is always fastest. Results depend on the data, the level and the implementation. Aback ZIP publishes its own decode measurements in docs/BENCHMARKS.md: on the project's Apple Silicon test machine, Zstandard decoded at roughly 110 to 540 MB/s, XZ at roughly 13 to 80 MB/s and up to around 380 MB/s on long runs, with BZIP2 in between. Those ranges come from one benchmark environment with varying data, not from a general specification or a promise about your device.

Benchmark numbers are useful for orientation. Re-run them on your own data before making a performance decision.

Memory and streaming behaviour

All three formats can be processed as streams: you do not need to load the whole compressed file before decoding starts. The practical difference is working memory. Gzip's DEFLATE window is modest. XZ decoders allocate memory related to the dictionary size recorded in the stream, which can matter on small devices. Zstandard also has a window size, and its frame header tells a decoder how much history it may need.

  • Server logs: gzip is easy to produce and consume in almost any language or web server.
  • Large text datasets: xz can save meaningful space when the data is stored for a long time and decompressed rarely.
  • High-throughput services: Zstandard's speed and level range make it attractive when compression happens on the hot path.
  • Very small devices: check the declared window or dictionary size before decoding; memory limits are a real constraint.

Dictionaries deserve a separate note. Zstandard can use a trained dictionary to compress many small, related messages efficiently: instead of repeating shared patterns in every message, the encoder refers to a common dictionary that the decoder already has. This is useful in APIs and backups of small records. It also means a compressed stream is not self-contained; a decoder without the matching dictionary cannot read it. Gzip and xz file formats do not offer that feature, which makes their outputs simpler to exchange.

All three formats support streaming, but the surrounding conventions differ. Gzip files can be concatenated, and many tools treat the members as one logical stream. Zstandard defines skippable frames so other data can sit alongside compressed frames in the same file. XZ uses a stream structure with block headers and an index. These details matter when you build a pipeline rather than compress one file by hand: confirm that your reader handles the same conventions as your writer.

Integrity and error detection

Gzip stores a CRC-32 of the uncompressed data in its trailer. XZ streams carry configurable integrity checks, commonly CRC32 or CRC64. Zstandard frames can include a checksum that covers the frame's content. None of these checks is a cryptographic signature: they detect accidental damage and some forms of tampering, not a determined attacker who can recompute them.

For files that cross trust boundaries, keep a separate cryptographic hash produced by a tool you trust and delivered by a different channel. For an archive that also needs confidentiality, encryption is a separate control with its own authentication mechanism. Neither the CRC in a gzip trailer nor a checksum in a Zstandard frame proves who created the file.

Compatibility and tooling

Gzip is available almost everywhere: command-line tools, web servers, programming libraries and browser APIs. XZ support is widespread on Linux and in development tooling but less universal on stock Windows and macOS. Zstandard support has grown quickly in Linux distributions, package managers and developer tools, but it is still less universal than gzip.

If you need to...PickWhy
Share with an arbitrary recipientgzipHighest chance the other side can decode it
Archive a source releaseTAR.GZ or TAR.XZBoth are familiar in packaging ecosystems
Serve compressed web contentgzip or ZstandardBoth are widely supported in HTTP; check what your clients accept
Minimise a large static downloadxz or high-level ZstandardBetter ratios on compressible data
Process files in Aback ZIPgzip for encoding; all three for decodingThat is the tool's current support boundary

What Aback ZIP supports

GZIP Compress & Extract can compress a file into .gz at a chosen level and decompress it back, restoring the stored name. XZ, BZ2 & ZST Extractor decompresses .xz, .bz2, .zst, .lzma and .gz files and verifies built-in checks where the format provides them. Compressed TARs are recognised and can be opened with Extract TAR.

Creating .xz and .zst files is not supported. Zstandard files that need a dictionary and XZ files using BCJ executable filters are not supported either. Zstandard checksums are not verified by the current decoder.

If the result must be a ZIP that opens on Windows or macOS, decode the compressed stream and repackage the files with TAR to ZIP or Create ZIP. For a broader map of where these formats sit, see Archive formats explained.

A practical decision rule

  1. Will the recipient definitely have the decoder? If not, choose gzip.
  2. Is the data mostly text and will it be stored for a long time? Consider xz.
  3. Does compression happen repeatedly in an application where latency matters? Consider Zstandard.
  4. Are you compressing several files? Wrap a TAR first, then compress the TAR.
  5. Do you need to verify the result? Keep a separate SHA-256 hash regardless of the format's own check.

None of these formats is an archive manager by itself. They shrink bytes; TAR and ZIP handle file lists. Keeping that distinction in mind prevents most bad format choices.

Tools for this

Frequently asked questions

It can be, depending on the level and the data. Zstandard exposes a wider range of speed-to-ratio settings. Aback ZIP's own decode benchmarks show overlapping ranges, so treat speed as implementation-specific rather than guaranteed.

More posts