Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/zstd/llms.txt
Use this file to discover all available pages before exploring further.
zstd is a fast lossless compression algorithm and data compression tool, with command line syntax similar to gzip and xz. It is based on the LZ77 family, with further FSE & huff0 entropy stages.
Key Features
- Fast compression: > 200 MB/s per core in fast modes
- Strong compression: Excellent compression ratios with configurable levels
- Fast decompression: > 500 MB/s per core across all compression settings
- Dictionary compression: Dramatically improves compression on small files
- Multi-threading support: Parallel compression with
-T#option
Basic Usage
Compress a file
Decompress a file
Write to standard output
Common Options
| Option | Description |
|---|---|
-# | Compression level (1-19, default: 3) |
-d, --decompress | Decompress files |
-o OUTPUT | Write output to OUTPUT file |
-k, --keep | Keep input files (default) |
--rm | Remove input files after processing |
-f, --force | Overwrite existing files |
-c, --stdout | Write to stdout |
-v, --verbose | Verbose mode |
-q, --quiet | Suppress warnings |
-h, --help | Display help |
Differences from gzip
zstd has several behavioral differences from gzip:- Source files are preserved by default (use
--rmto remove) - Progress notifications are shown by default (use
-qto disable) - Does not accept input from console (but accepts stdin when piped)
- Does not store filename or attributes, only file contents
File Handling
Reading from stdin
Recursive compression
Output directory options
Symlink Shortcuts
zstd can be invoked through symlinks with special behavior:
| Symlink | Behavior |
|---|---|
zstdmt | Compress using all CPU cores (zstd -T0) |
unzstd | Decompress files |
zstdcat | Decompress to stdout |
zcat | Same as zstdcat |
Environment Variables
ZSTD_CLEVEL
Set default compression level (1-19):ZSTD_NBTHREADS
Set default number of threads:-# and -T#).
Concatenation
Multiple.zst files can be concatenated and decompressed as a single file:
Integer Suffixes
Many options accept integer suffixes for convenience:KiB,Ki,K,KB= × 1,024MiB,Mi,M,MB= × 1,048,576