Configure Multi-Threading for ZIP in 7-Zip CLI

This article explains how to configure multi-threading when creating ZIP archives using the 7-Zip command-line interface (CLI). By using the multi-threading switch (-mmt), you can maximize CPU performance to significantly reduce compression times or restrict CPU usage to maintain system responsiveness during intensive archive jobs.

The Multi-Threading Switch: -mmt

In the 7-Zip CLI, thread allocation is controlled using the -mmt parameter. This switch tells the 7-Zip engine how many logical processor threads to assign to the compression process.

The basic syntax for creating an archive is:

7z a -tzip -mmt[N] archive.zip [files_or_folders]
  • a: Adds files to the archive.
  • -tzip: Explicitly specifies the archive format as standard ZIP.
  • -mmt[N]: Defines the threading configuration, where [N] is the number of threads or a toggle state (on or off).

Configuring Thread Options

1. Enable Maximum Threading

By default, modern versions of 7-Zip attempt to use all available CPU threads for compatible algorithms. To explicitly enforce automatic full multi-threading, use:

7z a -tzip -mmt=on archive.zip folder/

Alternatively, running -mmt without a value acts the same as -mmt=on:

7z a -tzip -mmt archive.zip folder/

2. Specify a Custom Number of Threads

To restrict 7-Zip to a specific number of CPU cores—useful for running compressions in the background without freezing your workstation—provide a numeric value directly after the switch:

7z a -tzip -mmt=4 archive.zip folder/

In this command, 7-Zip will utilize only 4 threads, leaving the remaining system cores free for other tasks.

3. Disable Multi-Threading (Single Thread)

To force single-threaded execution, set the switch to off or specify 1:

7z a -tzip -mmt=off archive.zip folder/

or

7z a -tzip -mmt=1 archive.zip folder/

ZIP Compression Method Nuances

The effectiveness of multi-threading in ZIP files depends on the compression method used:

  • Deflate (Default): Standard Deflate compression in 7-Zip supports up to 2 threads per stream by default. Even if you specify -mmt=8, standard Deflate may only use 2 threads.
  • BZip2 / LZMA: If you create a ZIP container using LZMA or BZip2 compression, 7-Zip can scale across significantly more threads:
7z a -tzip -mm=LZMA -mmt=8 archive.zip folder/

In this example, -mm=LZMA switches the compression method inside the ZIP archive to LZMA, allowing 7-Zip to effectively use all 8 assigned threads. Note that archives using non-Deflate methods inside a .zip file may not open with basic Windows File Explorer extractors without third-party software.


Verification

To verify that the multi-threading settings are being applied, observe the CPU utilization in your operating system's task manager (top, htop, or Windows Task Manager) while the command executes, or add the -bso1 and -bse1 options to log output stream details.