Skip to main content
Complete reference for all zstd command-line options, organized by category.

Operation Modes

OptionDescription
-z, --compressCompress (default mode)
-d, --decompress, --uncompressDecompress files
-t, --testTest compressed file integrity
-b#Benchmark mode with compression level #
--train FILESCreate dictionary from training files
-l, --listDisplay information about compressed files

Compression Levels

OptionDescription
-#Set compression level (1-19, default: 3)
--ultraEnable ultra compression (levels 20-22)
--maxMaximum compression (very slow, high memory)
--fast[=#]Ultra-fast compression (default: —fast=1)

Output Control

OptionDescription
-o OUTPUTWrite output to OUTPUT file
-c, --stdoutWrite to stdout and keep input files
-k, --keepKeep input files (default)
--rmRemove input files after processing
-f, --forceForce overwrite, disable checks

Input/Output Files

OptionDescription
-rOperate recursively on directories
--filelist FILERead list of files from FILE
--output-dir-flat DIRStore files in DIR (flat structure)
--output-dir-mirror DIRStore files in DIR (preserve structure)
--Treat remaining arguments as files

Verbosity and Progress

OptionDescription
-v, --verboseVerbose mode (can be repeated)
-q, --quietSuppress warnings (repeat for errors too)
-hDisplay short help
-H, --helpDisplay full help
-V, --versionDisplay version number
--[no-]progressForce show/hide progress counter
--trace LOGLog tracing information to LOG

Multi-threading

OptionDescription
-T#, --threads=#Use # threads (0 = auto-detect cores)
--single-threadSingle thread for I/O and compression
--auto-threads={physical|logical}Choose physical or logical cores for -T0

Dictionary

OptionDescription
-D DICTUse DICT as dictionary
--train FILESTrain dictionary from FILES
--train-cover[=k=#,d=#,...]Use cover algorithm
--train-fastcover[=k=#,d=#,f=#,...]Use fast cover algorithm (default)
--train-legacy[=s=#]Use legacy algorithm
-o NAMEDictionary output name (default: dictionary)
--maxdict=#Limit dictionary size (default: 112640)
--dictID=#Force dictionary ID
--no-dictIDDon’t store dictionary ID in header
--[no-]mmap-dictMemory-map dictionary file

Checksums and Validation

OptionDescription
-C, --[no-]checkAdd/validate XXH64 checksums (default: enabled)
--[no-]content-sizeStore original size in header (default: enabled)
-M#, --memory=#Set memory usage limit

Compression Options

OptionDescription
--adapt[=min=#,max=#]Dynamically adapt compression level
--long[=#]Enable long distance matching (default: 27)
--patch-from=FILEUse FILE as reference for diff engine
-B#Set job size (default: 0 = automatic)
--rsyncableCompress using rsync-friendly method
--exclude-compressedOnly compress uncompressed files
--[no-]compress-literalsForce (un)compressed literals
--[no-]row-match-finderEnable/disable row-based match finder

Streaming Options

OptionDescription
--stream-size=#Specify exact streaming input size
--size-hint=#Hint for streaming input size
--target-compressed-block-size=#Target compressed block size

Decompression Options

OptionDescription
--[no-]sparseEnable/disable sparse file support
--[no-]pass-throughPass through uncompressed files as-is
--testTest file integrity without decompressing

Format Options

OptionDescription
--format=zstdCompress to .zst format (default)
--format=gzipCompress to .gz format
--format=xzCompress to .xz format
--format=lzmaCompress to .lzma format
--format=lz4Compress to .lz4 format

Benchmark Options

OptionDescription
-b#Benchmark with compression level #
-e#Test levels from -b# to -e#
-i#Minimum evaluation time in seconds (default: 3)
-B#Cut file into chunks of size #
-SOutput one result per input file
-D dictionaryBenchmark using dictionary
--priority=rtSet process priority to real-time

Advanced Compression Parameters

All parameters use the --zstd= prefix with comma-separated options:
zstd --zstd=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6 file.txt

Strategy

ParameterValuesDescription
strategy=, strat=1-9Match finding strategy
Strategy values:
  1. ZSTD_fast - Fastest
  2. ZSTD_dfast
  3. ZSTD_greedy
  4. ZSTD_lazy
  5. ZSTD_lazy2
  6. ZSTD_btlazy2
  7. ZSTD_btopt
  8. ZSTD_btultra
  9. ZSTD_btultra2 - Strongest

Window Parameters

ParameterRangeDescription
windowLog=, wlog=10-31Maximum bits for match distance
hashLog=, hlog=6-30Hash table size (bits)
chainLog=, clog=6-30Secondary search structure size
searchLog=, slog=1 to wlog-1Number of searches in chain/tree

Match Parameters

ParameterRangeDescription
minMatch=, mml=3-7Minimum match length
targetLength=, tlen=0-128KBTarget match length (strategy-dependent)

Multi-threading Parameters

ParameterRangeDescription
overlapLog=, ovlog=0-9Data overlap between jobs
--jobsize=#512KB+Size of each compression job

Long Distance Matching Parameters

ParameterRangeDescription
ldmHashLog=, lhlog=6-30LDM hash table size
ldmMinMatch=, lmml=4-4096Minimum LDM match length
ldmBucketSizeLog=, lblog=1-8LDM hash bucket size
ldmHashRateLog=, lhrlog=variesLDM hash insertion frequency

I/O Options

OptionDescription
--[no-]asyncioUse asynchronous I/O (default: enabled)

Inspection Options

OptionDescription
--show-default-cparamsDisplay default parameters for input

Environment Variables

VariableDescription
ZSTD_CLEVELDefault compression level (1-19)
ZSTD_NBTHREADSDefault number of threads

Integer Suffixes

Many numeric options accept suffixes:
SuffixMultiplierAliases
KiB1,024Ki, K, KB
MiB1,048,576Mi, M, MB
Invoking zstd through these symlinks triggers special behavior:
SymlinkEquivalent Command
zstdmtzstd -T0
unzstdzstd -d
zstdcatzstd -dcf
zcatzstd -dcf
gzipzstd --format=gzip --rm
gunzipzstd -d --format=gzip --rm
ungzzstd -d --format=gzip --rm
xzzstd --format=xz --rm
unxzzstd -d --format=xz --rm
lzmazstd --format=lzma --rm
unlzmazstd -d --format=lzma --rm
lz4zstd --format=lz4
unlz4zstd -d --format=lz4

Parameter Aggregation

Short options can be combined:
# These are equivalent
zstd -b1 -e18 -i1 file.txt
zstd -b1e18i1 file.txt

Cover Algorithm Parameters

—train-cover parameters:
ParameterDefaultDescription
k=#auto (50-2000)Segment size
d=#tries 6 and 8Subsegment size
steps=#40Number of optimization steps
split=#100Train/test split percentage
shrink[=#]disabledShrink dictionary to optimal size
—train-fastcover parameters:
ParameterDefaultDescription
k=#auto (50-2000)Segment size
d=#8Subsegment size (6 or 8 only)
f=#20Log of frequency array size
steps=#40Number of optimization steps
split=#75Train/test split percentage
accel=#1Acceleration factor
shrink[=#]disabledShrink dictionary to optimal size
—train-legacy parameters:
ParameterDefaultDescription
selectivity=#, s=#9Dictionary density (lower = denser)

Return Codes

The zstd CLI returns standard exit codes:
  • 0 - Success
  • 1 - Error occurred

gzip Compatibility Options

When invoked as gzip, additional options are available:
OptionDescription
-n, --no-nameDon’t store filename/timestamps (no-op, default)
--bestAlias for -9

Build docs developers (and LLMs) love