Format Atlas

Compare

GZIP vs XZ

GZIP and XZ are lossless compressors commonly applied to a single file. Their practical trade-offs include output size, compression and extraction time, and support on the recipient's systems.

Which format should you choose?

Follow the format required by the package or recipient; when either is acceptable, benchmark representative files and check extraction support.

Good fit for GZIP

Compress a file or tar archive without data loss

  • Unix distributions, logs, and text files

Good fit for XZ

Compress a file or tar archive without data loss

  • Software distributions using XZ

Basic information

FieldGZIPXZ
Extension.gz, .gzip.xz
MIME typeapplication/gzipapplication/x-xz
Common usesCompress a file or tar archive without data lossCompress a file or tar archive without data loss
How to openDecompress with a GZIP-compatible tool. For tar.gz, also extract the tar archive.Use an XZ-compatible decompressor. For tar.xz, extract the tar archive after decompression.
Export or convertWhen converting to ZIP or another archive, check file names, directory structure, and extracted contents.After converting to another format, compare extracted files, names, directory structure, and content.

Choose by use case

Unix distributions, logs, and text files

Compress a file or tar archive without data loss

GZIP

Software distributions using XZ

Compress a file or tar archive without data loss

XZ

Key point 1

Both commonly compress one file at a time.

More on the differences

Key point 2

XZ may reduce some data further but can take more processing.

More on the differences

More on the differences

Use the distribution's established format where compatibility matters. For new packages, compare size and CPU time on representative data and confirm users can extract it.

  • GZIP and XZ are compression streams, not multi-file archives by themselves.
  • Tar is often paired with either format to bundle files.
  • Compression ratio and speed vary by data and settings.

Frequently asked questions

Is XZ always smaller than GZIP?

No. Results depend on the input and settings; test the files that matter.

Learn more

Related uses and checks

Choose a compression or disk image format

References and specifications