# -m (Set compression Method) switch

Specifies the compression method.

#### Syntax

    -m<method_parameters>

The format for this switch depends on the archive type.

- Zip
- GZip
- BZip2
- 7z
- XZ
- WIM
- Tar

-m switch also can specify hash method for h (Hash) command,

Notes: "Default value" in switches descriptions means the value that will be used if switch is not specified.

It's allowed to use reduced forms for boolean switches: sw+ or sw instead sw=on, and sw- instead of sw=off. It's allowed to use reduced forms for switches with numbers: x3 instead of x=3.

## Zip

Parameter | Default | Description
--- | --- | ---
x=[0 | 1 | 3 | 5 | 7 | 9 ] | 5 | Sets level of compression.
m={MethodID} | Deflate | Sets a method: Copy, Deflate, Deflate64, BZip2, LZMA, PPMd.
fb={NumFastBytes} | 32 | Sets number of Fast Bytes for Deflate encoder.
pass={NumPasses} | 1 | Sets number of Passes for Deflate encoder.
d={Size}[b|k|m] | 900000 | Sets Dictionary size for BZip2
mem={Size}[b|k|m] | 24 | Sets size of used memory for PPMd.
o={Size} | 8 | Sets model order for PPMd.
mt=[off | on | {N}] | on | Sets multithreading mode.
em={EncryptionMethodID} | ZipCrypto | Sets a encryption method: ZipCrypto, AES128, AES192, AES256
cl=[off | on] | off | 7-Zip always uses local code page for file names.
cu=[off | on] | off | 7-Zip uses UTF-8 for file names that contain non-ASCII symbols.
cp={CodePage} | off | Sets code page
tm=[off | on] | on | Stores last Modified timestamps for files.
tc=[off | on] | off | Stores Creation timestamps for files.
ta=[off | on] | off | Stores last Access timestamps for files.
tp={N} | 0 | Sets timestamp precision: 0 - Windows (100 ns), 1 - Unix (1 sec), 2 - DOS (2 sec). 3 - Windows (100 ns).

By default (if cl and cu switches are not specified), 7-Zip uses UTF-8 encoding only for file names that contain symbols unsupported by local code page.

x=[0 | 1 | 3 | 5 | 7 | 9 ]

  Sets level of compression. x=0 means Copy mode (no compression).

  Deflate / Deflate64 settings:

  Level | NumFastBytes | NumPasses | Description
  --- | --- | --- | ---
  1 | 32 | 1 | Fastest
  3 | Fast
  5 | Normal
  7 | 64 | 3 | Maximum
  9 | 128 | 10 | Ultra

  x=1 and x=3 with Deflate method set fast mode for compression.

  BZip2 settings:

  Level | Dictionary | NumPasses | Description
  --- | --- | --- | ---
  1 | 100000 | 1 | Fastest
  3 | 500000 | Fast
  5 | 900000 | Normal
  7 | 2 | Maximum
  9 | 7 | Ultra

fb={NumFastBytes}

  Sets the number of fast bytes for the Deflate/Deflate64 encoder. It can be in the range from 3 to 258 (257 for Deflate64). Usually, a big number gives a little bit better compression ratio and a slower compression process. A large fast bytes parameter can significantly increase the compression ratio for files which contain long identical sequences of bytes.

pass={NumPasses}

  Sets number of passes for Deflate encoder. It can be in the range from 1 to 15 for Deflate and from 1 to 10 for BZip2. Usually, a big number gives a little bit better compression ratio and a slower compression process.

d={Size}[b|k|m]

  Sets the Dictionary size for BZip2. You must specify the size in bytes, kilobytes, or megabytes. The maximum value for the Dictionary size is 900000b. If you do not specify any symbol from set [b|k|m], dictionary size will be calculated as DictionarySize = 2^Size bytes.

mem={Size}[b|k|m]

  Sets the size of memory used for PPMd. You must specify the size in bytes, kilobytes, or megabytes. The maximum value is 256 MB = 2^28 bytes. The default value is 24 (16MB). If you do not specify any symbol from the set [b|k|m], the memory size will be calculated as (2^Size) bytes. PPMd uses the same amount of memory for compression and decompression.

o={Size}

  Sets the model order for PPMd. The size must be in the range [2,16]. The default value is 8.

mt=[off | on | {N}]

  Sets multithread mode. If you have a multiprocessor or multicore system, you can get a speed increase with this switch. This option affects only compression (with any method) and decompression of BZip2 streams. Each thread in the multithread mode uses 32 MB of RAM for buffering. If you specify {N}, 7-Zip tries to use N threads.

## GZip

GZip uses the same parameters as Zip, but GZip compresses only with Deflate method. So GZip supports only the following parameters: x, fb, pass.

## BZip2

Parameter | Default | Description
--- | --- | ---
x=[1 | 3 | 5 | 7 | 9 ] | 5 | Sets level of compression.
pass={NumPasses} | 1 | Sets number of Passes for Bzip2 encoder.
d={Size}[b|k|m] | 900000 | Sets Dictionary size for BZip2
mt=[off | on | {N}] | on | Sets multithreading mode.

x=[1 | 3 | 5 | 7 | 9 ]

  Sets level of compression

  Level | Dictionary | NumPasses | Description
  --- | --- | --- | ---
  1 | 100000 | 1 | Fastest
  3 | 500000 | Fast
  5 | 900000 | Normal
  7 | 2 | Maximum
  9 | 7 | Ultra

d={Size}[b|k|m]

  Sets the Dictionary size for BZip2. You must specify the size in bytes, kilobytes, or megabytes. The maximum value for the Dictionary size is 900000b. If you do not specify any symbol from set [b|k|m], dictionary size will be calculated as DictionarySize = 2^Size bytes.

pass={NumPasses}

  Sets the number of passes. It can be in the range from 1 to 10. The default value is 1 for normal mode, 2 for maximum mode and 7 for ultra mode. A bigger number can give a little bit better compression ratio and a slower compression process.

mt=[off | on | {N}]

  Sets multithread mode. If you have a multiprocessor or multicore system, you can get a speed increase with this switch. If you specify {N}, for example mt=4, 7-Zip tries to use 4 threads.

## 7z

Parameter | Default | Description
--- | --- | ---
x=[0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ] | 5 | Sets level of compression.
yx=[0 | 1 | 3 | 5 | 7 | 9 ] | 5 | Sets level of file analysis.
yv={MMNN} | 2300 | Sets decoder compatibility version.
yfa={FilterID} |  | Allow 7-Zip to use the specified filter method.
yfd={FilterID} |  | Disallow 7-Zip to use the specified filter method.
memuse=[ p{N_Percents} | {N}b | {N}k | {N}m | {N}g | {N}t] |  | Sets memory usage size.
s=[off | on | [e] [{N}f] [{N}b | {N}k | {N}m | {N}g | {N}t]] | on | Sets solid mode.
qs=[off | on] | off | Sort files by type in solid archives.
f=[off | on | FilterID] | on | Enables or disables filters. FilterID: Delta:{N}, BCJ, BCJ2, ARM64, ARM, ARMT, RISCV, IA64, PPC, SPARC.
hc=[off | on] | on | Enables or disables archive header compressing.
he=[off | on] | off | Enables or disables archive header encryption.
b{C1}[s{S1}]:{C2}[s{S2}] |  | Sets binding between coders.
{N}={MethodID}[:param1][:param2][..] | LZMA2 | Sets a method: LZMA, LZMA2, PPMd, BZip2, Deflate, Delta, BCJ, BCJ2, Copy.
mt=[off | on | {N}] | on | Sets multithreading mode.
mtf=[off | on] | on | Set multithreading mode for filters.
tm=[off | on] | on | Stores last Modified timestamps for files.
tc=[off | on] | off | Stores Creation timestamps for files.
ta=[off | on] | off | Stores last Access timestamps for files.
tr=[off | on] | on | Stores file attributes.

x=[0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ]

  Sets level of compression

  Level | Method | Dictionary | FastBytes | MatchFinder | Filter | Description
  --- | --- | --- | --- | --- | --- | ---
  0 | Copy |  |  |  |  | No compression.
  1 | LZMA2 | 256 KB | 32 | HC5 | BCJ | Fastest compressing
  2 | LZMA2 | 1 MB | 32 | HC5 | BCJ |
  3 | LZMA2 | 4 MB | 32 | HC5 | BCJ | Fast compressing
  4 | LZMA2 | 16 MB | 32 | HC5 | BCJ |
  5 | LZMA2 | 32 MB | 32 | BT4 | BCJ | Normal compressing
  6 | LZMA2 | 64 MB | 32 | BT4 | BCJ |
  7 | LZMA2 | 128 MB | 64 | BT4 | BCJ | Maximum compressing
  8 | LZMA2 | 256 MB | 64 | BT4 | BCJ |
  9 | LZMA2 | 256 MB | 64 | BT4 | BCJ2 | Ultra compressing

  Note: "x" works as "x=9".

  Note: 7-Zip also can use another filters, like ARM64, RISCV.

yx=[0 | 1 | 3 | 5 | 7 | 9 ]

  Sets level of file analysis

  Level | Description
  --- | ---
  0 | No analysis.
  1 or more | adds analysis for WAV files Delta filter).
  5 or more | adds analysis for executable files (according file name extension and unix permissions).
  7 or more | adds analysis for files without extension.
  9 or more | analysis of all files (Delta and executable filters).

  Default level is 5: "yx=5".

  "yx" works as "yx=9".

  7-Zip can analyze data of files before compression. The level of file analysis sets which files must be be analyzed. The analysis allows to select additional filter that can increase compression ratio for that file. For analysis 7-Zip reads small data block at the beginning of file and tries to parse the header. Currently 7-Zip supports parsing for some formats: WAV (audio files), PE (Windows executables), ELF (Linux executables), Mach-O (macOS executables).

  If the level of file analysis is smaller than 9, 7-Zip selects files for analysis according file name extension. Linux/macOS verions of 7-zip also can use "Execute" (x) permission of file to select file for analysis.

  Higher level of file analysis means more files for analysis.

yv={MMNN}

  sets decoder compatibility version for archive creation.

  {MMNN} is 4-digit number that represents the version of 7-Zip without a dot.

  If "yv" switch is not specified, default value 2300 is used.

  If "yv" switch is used without "={MMNN}" version number, there is no restiction for allowed filter methods. So "yv" switch is similar to "yv=9999".

  When 7-Zip creates 7z archive, it uses only compression methods and compression filters that are allowed by specified version of 7-Zip.

  The list of new Filter methods that were supported by new versions of 7-Zip, and that are not supported by older versions:

  7-Zip Version | Filter Name
  --- | ---
  2300 | ARM64
  2402 | RISCV

  Examples:

        yv=1600
  | use only filter methods that can be decoded by 7-Zip 16.00. It will not use new ARM64 and RISCV filters.
        yv
  | allow all supported filters.

yfa={FilterID}

  allows 7-Zip to use the specified filter method for 7z archive creating. FilterID can be: Delta, BCJ, BCJ2, ARM64, ARM, ARMT, RISCV, IA64, PPC, SPARC. Multiple switches are allowed. Note: "yfa" switch has higher priority than "yv" switch. So "yfa={FilterID}" switch can enable filter that is not allowed by "yv={MMNN}" switch value.

  Examples:

              yfa=RISCV

  allow 7-Zip to use RISCV filter for archive creation.

yfd={FilterID}

  disallows 7-Zip to use the specified filter method for 7z archive creating. FilterID can be: Delta, BCJ, BCJ2, ARM64, ARM, ARMT, RISCV, IA64, PPC, SPARC. Multiple switches are allowed. Note: "yfd" switch has higher priority than "yv" and "yfa" switches.

  Examples:

        yfd=ARM64 yfd=RISCV
  | disallow 7-Zip to use ARM64 and RISCV filters for archive creation.
        yfd=BCJ2
  | disallow 7-Zip to use BCJ2 filter for archive creation.

memuse=[ p{N_Percents} | {N}b | {N}k | {N}m | {N}g | {N}t]

  Sets a limit on memory usage (RAM) for compressing and decompressing commands.

  Default memory limits are 80% from RAM size for compressing and 53% for decompressing.

  7-Zip tries to fit in specified memory limits by changing the number of working threads, if the number of threads was not specified in command. If 7-Zip cannot fit in specified memory limit, 7-Zip still executes the command.

  Example:

              memuse=p60

  set the limit for memory usage to 60% of RAM size.

              memuse=14g

  set the limit for memory usage to 14 GiB.

s=[off | on | [e] [{N}f] [{N}b | {N}k | {N}m | {N}g | {N}t]]

  Enables or disables solid mode. The default mode is s=on. In solid mode, files are grouped together. Usually, compressing in solid mode improves the compression ratio.

  e | Use a separate solid block for each new file extension. You need to use qs option also.
  {N}f | Set the limit for number of files in one solid block
  {N}b | {N}k | {N}m | {N}g | {N}t | Set a limit for the total size of a solid block in bytes / KiB / MiB / GiB / TiB.

  The default solid block size depends on the compression method and the dictionary size. The default dictionary size depends on the compression level.

  The default solid block size for all methods other than LZMA2 (LZMA, PPMD, BZIP2, Deflate, Deflate64) is caluclated by the formula:

              SolidBlockSize_LZMA = max(16 MiB, min(4 GiB, DictionarySize * 128))

  The default solid block size for LZMA2 is caluclated by the formula:

      	ChunkSize = max(DictionarySize, min(256M, max(1M, DictionarySize * 4)))
              SolidBlockSize_LZMA2 = max(16 MiB, min(16 GiB, ChunkSize * 64))

  The default solid block size for LZMA2 method:

  Compression Level | Dictionary Size | Chunk Size | Solid Block Size LZMA2
  --- | --- | --- | ---
  0 - Store | 0 B | 0 B | 0 B
  1 - Fastest | 256 KB | 1 MB | 64 MB
  2 | 1 MB | 4 MB | 256 MB
  3 - Fast | 4 MB | 16 MB | 1 GB
  4 | 16 MB | 64 MB | 4 GB
  5 - Normal | 32 MB | 128 MB | 8 GB
  6 | 64 MB | 256 MB | 16 GB
  7 - Maximum | 128 MB | 256 MB | 16 GB
  8 | 256 MB | 256 MB | 16 GB
  9 - Ultra | 256 MB | 256 MB | 16 GB

  NOTE: if LZMA2 is used, 7-Zip can split data into chunks and then it compresses those chunks simultaneously using multiple CPU threads. By default, there are 64 chunks in a solid block. LZMA2 encoder uses about 2 CPU threads per chunk at compression level 5 or higher. So by default LZMA2 encoder can use up to 128 CPU threads for compression, if CPU supports such number of threads. 7-Zip doesn't compress several solid blocks simultaneously to the 7z archive. Thus, multitreading is provided only within a solid block of the 7z archive. If solid block is large, then there are more chunks in solid block, and LZMA encoder and decoder can use more cpu threads for compression and decompression.

  Limitation of the solid block size usually decreases compression ratio but gives the following advantages:

  - it reduces data loss in case of future archive damage.
  - it reduces extraction time of a group of files (or just one file), so long as the group doesn't contain the entire archive.

  The updating of solid .7z archives can be slow, since it can require some recompression.

  Example:

              s=100f256m

  set solid mode with 100 files & 256 MB limits per one solid block for 7z format.

qs=[off | on]

  Enables or disables sorting files by type in solid archives. The default mode is qs=off.

  Old versions of 7-Zip (before version 15.06) used file sorting "by type" ("by extension").

  New versions of 7-Zip (starting from version 15.06) support two sorting orders:

  - qs- : sorting by name : it's default order.
  - qs : sorting by type (by file extension).

  You can get big difference in compression ratio for different sorting methods, if dictionary size is smaller than total size of files. If there are similar files in different folders, the sorting "by type" can provide better compression ratio in some cases.

  Note that sorting "by type" has some drawbacks. For example, NTFS volumes use sorting order "by name", so if an archive uses another sorting, then the speed of some operations for files with unusual order can fall on HDD devices (HDDs have low speed for "seek" operations).

  If "qs" mode provides much better compression ratio than default "qs-" mode, you still can increase compression ratio for "qs-" mode by increasing of dictionary size.

  If you think that unusual file order is not problem for you, and if better compression ratio with small dictionary is more important for you, use "qs" mode.

  Note: There are some files (for example, executable files), that are compressed with additional filter. 7-Zip can't use different compression methods in one solid block, so 7-zip can create several groups of files that don't follow "by name" order in "qs-" mode, but files inside each group are still sorted by name in "qs-" mode.

f=[off | on | FilterID]

  Enables or disables compression filters. The default mode is f=on, when 7-zip uses filter for some files: executables files (dll, exe, ocx, sfx, sys) and wav files. for x86 executables it can use BCJ2 filter in Ultra (x9) mode and BCJ filter in other modes. If f=FilterID if specified, 7-zip uses specified filter for all files. FilterID can be: Delta:{N}, BCJ, BCJ2, ARM64, ARM, ARMT, RISCV, IA64, PPC, SPARC.

hc=[off | on]

  Enables or disables archive header compressing. The default mode is hc=on. If archive header compressing is enabled, the archive header will be compressed with LZMA method.

he=[off | on]

  Enables or disables archive header encryption.

  The default mode is he=off (archive header encryption is disabled).

  The archive header contains metadata of the stored files (file names, file sizes, timestamps, attributes) and other additional archive metadata information.

  If archive header encryption option is disabled (he=off), the archive header will be stored without encryption. If archive header encryption option is enabled (he=on), and a password is specified (-p switch on the command line or the password entered in the "Password" field in the GUI), then both file data and headers will be encrypted.

b{C1}[s{S1}]:{C2}[s{S2}]

  Binds output stream S1 in coder C1 with input stream S2 in coder C2. If stream number is not specified, stream with number 0 will be used.

  Usally coder has one input stream and one output stream. In 7z some coders can have multiple input and output streams.

  For example, BCJ2 encoder has one input stream and four output streams.

mt=[off | on | {N}]

  Sets multithread mode. If you have a multiprocessor or multicore system, you can get a increase with this switch. 7-Zip supports multithread mode only for LZMA / LZMA2 compression and BZip2 compression / decompression. If you specify {N}, for example mt=4, 7-Zip tries to use 4 threads. LZMA compression uses only 2 threads.

{N}={MethodID}[:param1][:param2] ... [:paramN]

  Sets compression method. You can use any number of methods. The default method is LZMA2.

  {N} sets the index number of method in methods chain. Numbers must begin from 0. Methods that have smaller numbers will be used before others.

  Parameters must be in one of the following forms:

  - {ParamName}={ParamValue}.
  - {ParamName}{ParamValue}, if {ParamValue} is number and {ParamName} doesn't contain numbers.

  Supported methods:

  MethodID | Description
  --- | ---
  LZMA | LZ-based algorithm
  LZMA2 | LZMA-based algorithm
  PPMd | Dmitry Shkarin's PPMdH with small changes
  BZip2 | BWT algorithm
  Deflate | LZ+Huffman
  Copy | No compression

  Supported filters:

  MethodID | Description
  --- | ---
  Delta | Delta filter
  BCJ | converter for x86 executables
  BCJ2 | converter for x86 executables (version 2)
  ARM64 | converter for ARM64 (little endian) executables
  ARM | converter for ARM (little endian) executables
  ARMT | converter for ARM Thumb (little endian) executables
  RISCV | converter for RISC-V executables
  IA64 | converter for IA-64 executables
  PPC | converter for PowerPC (big endian) executables
  SPARC | converter for SPARC executables

  Filters increase the compression ratio for some types of files. Filters must be used with one of the compression method (for example, BCJ + LZMA).

#### LZMA

LZMA is an algorithm based on Lempel-Ziv algorithm. It provides very fast decompression (about 10-20 times faster than compression). Memory requirements for compression and decompression also are different (see d={Size}[b|k|m|g] switch for details).

Parameter | Default | Description
--- | --- | ---
a=[0|1] | 1 | Sets compressing mode
d={Size}[b|k|m|g] | 25 | Sets Dictionary size
mf={MF_ID} | bt4 | Sets Match Finder
fb={N} | 32 | Sets number of Fast Bytes
mc={N} | 32 | Sets Number of Cycles for Match Finder
lc={N} | 3 | Sets number of Literal Context bits - [0, 8]
lp={N} | 0 | Sets number of Literal Pos bits - [0, 4]
pb={N} | 2 | Set number of Pos Bits - [0, 4]

a=[0|1]

  Sets compression mode: 0 = fast, 1 = normal. Default value is 1.

d={Size}[b|k|m|g]

  Sets Dictionary size for LZMA. You must specify the size in bytes, kilobytes, or megabytes. The maximum value for dictionary size is 3840 MiB (4 GB), but 32-bit version of 7-Zip allows to specify up to 128 MB dictionary. Default dictionary size values for LZMA in 64-bit 7-Zip are 25 (32 MB) in normal mode (-mx=5), 27 (128 MB) in maximum mode (-mx=7) and 28 (256 MB) in ultra mode (-mx=9). The default dictionary size for 32-bit 7-Zip does not exceed 64 MB. If you do not specify any symbol from the set [b|k|m|g], the dictionary size will be calculated as DictionarySize = 2^Size bytes. For decompressing a file compressed by LZMA method with dictionary size N, you need about N bytes of memory (RAM) available.

mf={MF_ID}

  Sets Match Finder for LZMA. Default method is bt4. Algorithms from hc* group don't provide a good compression ratio, but they often work pretty fast in combination with fast mode (a=0). Memory requirements depend on dictionary size (parameter "d" in table below).

  MF_ID | Dictionary | Memory Usage | Description
  --- | --- | --- | ---
  bt2 |  | 9.5 * d | + 4 MB | Binary Tree | 2 bytes hashing
  bt3 |  | 11.5 * d | 3 bytes hashing
  bt4 bt5 | 64 KB ... 48 MB | 11.5 * d | 4/5 bytes hashing
  64 MB ... 1024 MB | 10.5 * d
  hc4 hc5 | 64 KB ... 48 MB | 7.5 * d | Hash Chain
  64 MB ... 1024 MB | 6.5 * d

  Note: Your operation system also needs some amount of physical memory for internal purposes. So keep at least 32MB of physical memory unused.

fb={N}

  Sets number of fast bytes for LZMA. It can be in the range from 5 to 273. The default value is 32 for normal mode and 64 for maximum and ultra modes. Usually, a big number gives a little bit better compression ratio and slower compression process.

mc={N}

  Sets number of cycles (passes) for match finder. It can be in range from 0 to 1000000000. Default value is (16 + number_of_fast_bytes / 2) for BT* match finders and (8 + number_of_fast_bytes / 4) for HC4 match finder. If you specify mc=0, LZMA will use default value. Usually, a big number gives a little bit better compression ratio and slower compression process. For example, mf=HC4 and mc=10000 can provide almost the same compression ratio as mf=BT4.

lc={N}

  Sets the number of literal context bits (high bits of previous literal). It can be in range from 0 to 8. Default value is 3. Sometimes lc=4 gives gain for big files.

lp={N}

  Sets the number of literal pos bits (low bits of current position for literals). It can be in the range from 0 to 4. The default value is 0. The lp switch is intended for periodical data when the period is equal to 2^value (where lp=value). For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's better to set lc=0, if you change lp switch.

pb={N}

  Sets the number of pos bits (low bits of current position). It can be in the range from 0 to 4. The default value is 2. The pb switch is intended for periodical data when the period is equal 2^value (where lp=value).

#### LZMA2

LZMA2 is modified version of LZMA. it provides the following advantages over LZMA:

- Better compression ratio for data than can't be compressed. LZMA2 can store such blocks of data in uncompressed form. Also it decompresses such data faster.
- Better multithreading support. If you compress big file, LZMA2 can split that file to chunks and compress these chunks in multiple threads.

Parameter | Default | Description
--- | --- | ---
c={Size}[b|k|m|g] | dictSize * 4 | Sets Chunk size

If you don't specify ChunkSize, default ChunkSize is caluclated by the formula:

    	ChunkSize = max(DictionarySize, min(256M, max(1M, DictionarySize * 4)))

LZMA2 also supports all LZMA parameters, but lp+lc cannot be larger than 4.

LZMA2 uses: 1 thread for each chunk in x1 and x3 modes; and 2 threads for each chunk in x5, x7 and x9 modes. If LZMA2 is set to use only such number of threads required for one chunk, it doesn't split stream to chunks. So you can get different compression ratio for different number of threads. You can get the best compression ratio, when you use 1 or 2 threads.

#### PPMd

PPMd is a PPM-based algorithm. This algorithm is mostly based on Dmitry Shkarin's PPMdH source code. PPMd provides very good compression ratio for plain text files. There is no difference between compression speed and decompression speed. Memory requirements for compression and decompression also are the same.

Parameter | Default | Description
--- | --- | ---
mem={Size}[b|k|m|g] | 24 | Sets size of used memory for PPMd.
o={Size} | 6 | Sets model order for PPMd.

mem={Size}[b|k|m|g]

  Sets the size of memory used for PPMd. You must specify the size in bytes, kilobytes, or megabytes. The maximum value is 2GB = 2^31 bytes. The default value is 24 (16MB). If you do not specify any symbol from the set [b|k|m|g], the memory size will be calculated as (2^Size) bytes. PPMd uses the same amount of memory for compression and decompression.

o={Size}

  Sets the model order for PPMd. The size must be in the range [2,32]. The default value is 6.

#### BCJ2

BCJ2 is a Branch converter for 32-bit/64-bit x86 executables (version 2). It converts some branch instructions for increasing further compression.

A BCJ2 encoder has one input stream and four output streams:

- s0: main stream. It requires further compression.
- s1: stream for converted CALL values. It requires further compression.
- s2: stream for converted JUMP values. It requires further compression.
- s3: service stream. It is already compressed.

If LZMA is used, the size of the dictionary for streams s1 and s2 can be much smaller (512 KB is enough for most cases) than the dictionary size for stream s0.

Parameters:

d={Size}[b|k|m|g]

  Sets section size for BCJ2 filter. Default section size is 240 MB. If you do not specify any symbol from the set [b|k|m|g], the section size will be calculated as SectionSize = 2^Size bytes. This parameter doesn't affect memory consumption. Compression ratio is better, if the section size is equal or slightly larger than size of largest executable section in file. Example: use f=BCJ2:d9M, if largest executable section in all files is 9 MB.

Note: If BCJ2 filter is used to compress big files, 7-Zip can use additional temp files during compression process to store temporary data for 3 additional streams: s1, s2, s3. 7-Zip doesn't use temp files for largest main stream (s0), because 7-zip writes compressed data of stream s0 to archive directly. 7-Zip by default compresses the data from streams s1 and s2 with LZMA method. So the sizes of temp files for corresponding compressed streams are not big in most cases. 7-Zip uses temp file for compressed data stream (s1,s2 op s3), if size of such compressed stream is larger than predefined limit: 16 MiB in 32-bit version or 4 GiB in 64-bit version. 7-Zip creates such temp files in system TEMP directory.

#### Delta

It's possible to set delta offset in bytes. For example, to compress 16-bit stereo WAV files, you can set "0=Delta:4". Default delta offset is 1.

## XZ

XZ supports only LZMA2 codec now. The switches are similar to switches for 7z format.

Parameter | Default | Description
--- | --- | ---
x=[1 | 3 | 5 | 7 | 9 ] | 5 | Sets level of compression
f=FilterID |  | Sets compression filter. FilterID: Delta:{N}, BCJ, ARM64, ARM, ARMT, RISCV, IA64, PPC, SPARC
{N}={MethodID}[:param1][:param2][..] | LZMA2 | Sets compression method: LZMA2:[param1]:[param2]:[...]
mt=[off | on | {N}] | on | Sets multithreading mode
s=[off | on | [{N}b | {N}k | {N}m | {N}g | {N}t]] | off | Sets solid mode.

s=[off | on | [{N}b | {N}k | {N}m | {N}g | {N}t]]

  Enables or disables solid mode. The default mode is s=off. In solid mode, there is only one block per file or stream.

  {N}b | {N}k | {N}m | {N}g | Set a limit for the total size of a solid block in bytes

  If size of solid block is not specified, the default value of solid block size will be calculated, The default solid block size depends on the dictionary size. The default dictionary size depends on the compression level.

  The default solid block size is caluclated by the formula:

      	SolidBlockSize_xz = max(DictionarySize, min(256M, max(1M, DictionarySize * 4)))

  dictionary_size | Default solid block size
  --- | ---
  smaller than 256 KB | 1 MB
  256 KB - 64 MB | dictionary_size * 4
  64 MB - 256 MB | 256 MB
  larger than 256 MB | dictionary_size

  block size must be equal or large than dictionary size.

  If you use multiple blocks:

  - the compression ratio with small blocks usually is worse.
  - blocks are independent. So losses in case of data damage is limited only to damaged blocks.
  - it's possible to extract some particular block of data faster.
  - there is index record at the end of xz stream that contains information about position and size of each block.

  Note: xz uses: 1 thread for each block in x1 and x3 modes; and 2 threads for each block in x5, x7 and x9 modes. If xz is set to use only such number of threads required for one block, it doesn't split stream to blocks. So you can get different compression ratio for different number of threads. You can get the best compression ratio, when you use 1 thread (for x1 and x3 modes) or 2 threads (for x5, x7 and x9 modes).

  Note: each xz block contains LZMA2 stream of data. And LZMA2 also can be divided to independent blocks (chunks). The difference between xz blocks and LZMA2 blocks, that each xz block contains also checksum (crc or sha), and there is index record at the end of xz stream that points to each xz block. 7-Zip by default uses xz blocks. But it's possible to specify the mode when it will use one xz block, and multiple LZMA2 blocks instead.

  Examples:

              s=16m

  use 16 MB blocks.

              s

  use one solid xz block per file.

              s c16m

  use one solid xz block per file and 16 MiB LZMA2 blocks.

## WIM

Parameter | Default | Description
--- | --- | ---
im={ImageNumber} |  | Sets image number.
is=[off | on] | off | Show image number in paths.
tm=[off | on] | on | Stores last Modified timestamps for files.
tc=[off | on] | off | Stores Creation timestamps for files.
ta=[off | on] | off | Stores last Access timestamps for files.

If image number is specified, 7-Zip works only with that image inside WIM archive. Other images will be not changed. By default 7-Zip doesn't show image number, if there is only one image in WIM archive, or if image number is specified. But if the switch "is" specified, 7-Zip shows image number.

## Tar

Parameter | Default | Description
--- | --- | ---
tm=[off | on] | on | Stores last Modified timestamps for files.
tc=[off | on] | off | Stores Creation timestamps for files (for pax method).
ta=[off | on] | off | Stores last Access timestamps for files (for pax method).
tp={N} | 1 | Sets timestamp precision: 0 - Windows (100 ns), 1 - Unix (1 sec), 3 - Linux (1 ns).
m={MethodID} | gnu | Sets a method: gnu, pax, posix.

#### Examples

    7z a archive.zip *.jpg -mx0

adds *.jpg files to archive.zip archive without compression.

    7z a archive.7z *.exe *.dll -m0=BCJ -m1=LZMA:d=21

adds *.exe and *.dll files to solid archive archive.7z using LZMA method with 2 MB dictionary and BCJ filter.

    7z a archive.7z a.tar -mf=BCJ2 -mx

adds a.tar files to archive archive.7z using BCJ2 filter.

    7z a archive.7z *.wav -mf=Delta:4

adds *.wav files to archive archive.7z using Delta:4 filter.

    7z a a.7z *.exe *.dll -m0=BCJ2 -m1=LZMA:d25 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3

adds *.exe and *.dll files to archive a.7z using BCJ2 filter, LZMA with 32 MB dictionary for main output stream (s0), and LZMA with 512 KB dictionary for s1 and s2 output streams of BCJ2.

    7z a archive.7z *.txt -m0=PPMd

adds *.txt files to archive archive.7z using PPMd method.

    7z a a.tar.xz a.tar -mf=bcj -mx

adds a.tar files to archive a.tar.xz using BCJ filter.

#### Commands that can be used with this switch

a (Add), h (Hash), d (Delete), rn (Rename), u (Update)

#### See also

Switches: -t (set Type of archive),