Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often have to gather log files and upload them to a central server (Owned by another company). The central server has a size limit of the file, so I am trying to create the smallest file possible that is still in the zip format.

What are the best setting to use when compressing a text file to a zip format when my only need is a small file size?

7zip Options

I've done the obvious and chosen ultra compression, and I have noticed that LZMA does a better job than deflate, but there are far too many other permutations of options for me to test them all.

share|improve this question
Is splitting the the zip in to multiple files an option? – JaredMcAteer May 10 '11 at 14:21
@Original, I don't think so. (Is that what the 'split to volumes' option is for?) I'd rather keep it simple and have just 1 file. If I really need, I can split the original file (which I have done in the past), but my goal is to keep it in one file. – jjnguy May 10 '11 at 14:30
Oh, and I saw this question… But it really doesn't answer my question at all. – jjnguy May 10 '11 at 14:32
I think the exact question you asked isn't answerable. Some text files compress better with different algorithms. Sometimes zip is better, sometimes gzip; sometimes, compression level makes a difference, and sometimes not. It all depends on the file. Therefore, instead of answering the precise question, I've addressed the motivating example, which deals with maximum allowed sizes. Even if you have the best possible algorithm, you're still limited by size, and a particularly large log might not be able to be compressed below that threshold, so you'll need splitting anyway. – Rob Kennedy May 10 '11 at 14:42
As soon as you pick anything but the Deflate format, it's not a "normal" .zip file anymore, but an "extended" zip file, pioneered by WinZip. They originally kept the extension as .zip, to much consternation (since most normal zip-handling tools can't deal with them), but most archivers use .zipx now to distinguish them from traditional .zip files. If you can use LZMA, switch to .7z and pick PPMd -- it should compress better (and faster!) for text files. – afrazier May 20 '11 at 16:04

To create the smallest standard ZIP file that 7-Zip can create, try:

7za a -mm=Deflate -mfb=258 -mpass=15 -r C:\Path\To\Files\*

Source: How can I achieve the best, standard ZIP compression?

Otherwise if you're not care about ZIP standard, use the following ultra settings:

7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1

Which are:

-t7z   7z archive

       lzma method

-mx=9  level of compression = 9 (Ultra)

       number of fast bytes for LZMA = 64
       dictionary size = 32 megabytes

-ms=on solid archive = on
share|improve this answer
Really like your answer. Thanks. – Tek Jul 19 '14 at 8:29
@Tek: Why? It's not a good one. The question was about using the "standard ZIP format", so the answer shouldn't be specifying LZMA. -ms=on is for .7z, not standard zip files. -md is related to BZip2, so I don't expect it to affect ZIP (or even LZMA). -mfb=64 is an unoptimized value: -mfb=258 makes smaller zip files. And this answer doesn't even mention -mpass=15 which can affect zip files. This is a nicely formatted answer which is, unfortunately, wrong in multiple ways. – TOOGAM Nov 8 '15 at 12:32
I would use lzma2 – Lance Badger Jul 7 at 15:22

If you can use .7z format rather than just .zip, I would simply use PPMD with the following options and leave everything else as set by the Compression Level:

  • Archive Format: 7z
  • Compression Method: PPMD
  • Compression Level: Ultra

I regularly compress server/text logs (60MB+) using these options and they usually come out at 1-2% of the original size.

share|improve this answer
For text such as log files, ppmd is definitely the way to go. However, the question mentioned that it needed to stay in the zip format, which may not work with PPMD. – Brian Minton Dec 19 '13 at 16:31
Just tried zip with PPMD and Windows Explorer opens the contents up without complaint here on Windows 7 – Umber Ferrule Dec 20 '13 at 16:44
I noticed that too. It opens the contents up just fine. However, when I actually tried to view one of the files inside the zip file, it failed. – Brian Minton Dec 23 '13 at 16:58
maybe works better for text files but for me didn't work better compressing a C# project (text+DLLs) – Riga Mar 25 '15 at 9:36

Set the "split to volume, bytes" field to the server's maximum allowed file size (in bytes, I think, although it looks like it accepts common abbreviations like "KB" and "MB"). If the zip file exceeds that size, 7-zip will split it into multiple files automatically, such as,, etc. (Way back when, PK Zip used this to span zip files across multiple floppy disks.) You'll need all the files to be present to unzip them. Use that instead of worrying about the absolute best compression settings to use for any particular set of files, because what's best for one file may be different for another file, and you don't want to have to go through this every time you need to copy logs.

share|improve this answer
I'm worried about how the people on the other side will uncompress the files. I need it to be as simple as possible for them. Do you know if you can unzip the split volumes using the built-in windows zip, or gzip? – jjnguy May 10 '11 at 14:40
Apparently, no, the built-in Windows zip-folder feature doesn't do spanned zip files. That's too bad, since it's been a standard feature of the format since before Windows 3. I'd be very surprised if gzip couldn't do it, though. WinZip definitely can. – Rob Kennedy May 10 '11 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .