Can 7-Zip Set Custom Block Sizes by File Type?

7-Zip cannot natively define customized solid block sizes for individual file types within a single compression pass. While the software intelligently groups files by extension before packing them into solid blocks to maximize compression efficiency, any specified block size applies globally to the entire compression session. This article explains how 7-Zip manages solid block sizes, why per-file-type settings are not directly supported in the standard interface, and how you can work around this limitation using multi-stage command-line processes.

Understanding Solid Block Sizes in 7-Zip

In the 7z format, solid compression treats multiple files as a continuous stream of data. This allows the compression algorithm to identify redundancies across different files, significantly reducing the final archive size for repetitive formats such as source code, logs, and plain text.

The solid block size parameter (configured via -ms in the command line or through the "Solid block size" dropdown in the GUI) dictates the threshold at which 7-Zip terminates the current stream and starts a new one. When you set this parameter—such as -ms=64m or -ms=on—the rule is applied uniformly across the entire batch of files selected for that operation.

How 7-Zip Naturally Groups File Types

Even though you cannot assign separate block sizes manually based on file extensions in one operation, 7-Zip incorporates an internal sorting mechanism to address mixed-file archives:

  1. Extension Sorting: Before compression begins, 7-Zip automatically sorts files by file extension, file modification date, and size.
  2. Homogeneous Packing: Because files of the same type are processed sequentially, a solid block usually contains files of identical or similar formats until the size limit of the block is reached.
  3. Diminishing Returns: For most users, this automatic grouping eliminates the need for separate block size configurations, as similar data is naturally packed together.

Workarounds for Custom Block Sizes

If your workflow requires strictly distinct block sizes—for example, small block sizes for files requiring fast random access and massive block sizes for compressible text—you can achieve this using multi-step command-line scripts.

Because the 7z format supports multiple independent solid streams within a single archive container, you can append data sequentially with different parameters:

  1. Create the initial archive with specific settings: Run the command line to pack your first group of files using the desired block size: 7z a archive.7z *.txt -ms=16m

  2. Append the next group with different settings: Update the existing archive with your secondary file types using a distinct block size or disabling solid mode entirely: 7z u archive.7z *.bin -ms=off

By splitting the archiving task into automated batch or shell scripts, you retain granular control over block configurations while keeping all output consolidated within a single 7z file.