Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I don't care how long it takes to compress, all I want to achieve is two things:

  • The absolute best possible compression ratio
  • Compatibility with standard readers, such as Windows and WinZip

So suggestions such as 7-zip won't be of much use, unless 7-zip is also slightly better at the standard ZIP compression (as opposed to using it's very good .7z format).

Ideally I'm looking for:

  • A recommendation of a piece of software
  • The particular settings for that software that enable the absolute best compression
  • Something that's free

Remember, how long it takes to compress is not an issue!

One last thing - some files might be better compressed with different settings, like the "Word size" or "Dictionary size" - is there a tool that can analyse the files and choose the most appropriate compression ratio, or does WinZip, 7-zip etc. already do that?

share|improve this question
add comment

6 Answers

If you want compatibility with the Zip Folders capability built into Windows XP, you're stuck with Deflate compression. I don't think you can even use Deflate64, much less the advanced compression methods (like LZMA, PPMD, WavPack, Bzip2, etc.) available in recent versions of winZip and PowerArchiver. PowerArchiver at least defaults to using the .zipx extension for those files -- I don't think WinZip is doing that yet.

The smallest possible zip file that 7-Zip can create can be done with the following command line:

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

Of particular note: 7-Zip's wildcard parser is not the same as most others on the system. *.* means all files that have extensions. * means all files.

Creating .zip files this way (and, presumably, using other tools that attempt to make smaller "standard" .zip files) is really, really slow. You would most likely save considerable time and space by using 7-Zip or WinRar to create self extracting archives.

share|improve this answer
    
My 7z error'd on "-m0" but I guess "-mm" does the same with recent versions. I also noticed that, in my case (compressing JPG files), using "-mx9" instead of "-mfb=258 -mpass=15" the result will differ randomly by ±15 bytes on average (with exceptions going in the ±50s) –  Mark Jeronimus May 1 '12 at 17:46
    
@Zom-B: You're right, that should have been -mm= instead of -m0=. -m0= is used on .7z archives. Also, the 7-Zip manual specifies that -mx=9 for Zip archives is equivalent to -mfb=128 -mpass=10. What I've noticed is that -mfb=258 -mpass=15 is always much slower than -mx=9 and often doesn't save very much space at all (or occasionally uses a few bytes more). Every once in a while it saves a decent bit of space. –  afrazier May 1 '12 at 18:26
add comment

Assuming you are on Windows: if you still want to use the ZIP format, I would recommend using Ken Silverman's free KZIP command-line utility, found here. Copy it inside the folder containing all the files you need to compress, go to that folder using CMD, and run the following command:

kzip /r <filename of ZIP file> *.*

As Roald suggests, it's best to include the directory where kzip.exe resides in your system's PATH variable to prevent it being included in the archive/Zip file.

So far, I've found the ZIP files created with KZIP is around 10-20% smaller than the ones created by other ZIP compressing programs. They're also fully openable by other archive software (Winzip, WinRAR, 7-zip, etc.) and by Windows.

share|improve this answer
4  
What about not putting it in that directory but somewhere on the PATH of your system? –  Roald van Doorn Jun 21 '10 at 10:54
    
I had the same requirement - must be supported by Windows standard ZIP functionality. KZIP is what I ended up using as it worked like a champ. Be sure to play with the /s /b /n options to get a good idea of what works best in your environment. –  Goyuix Jun 21 '10 at 14:09
    
Of course! The PATH variable. I've edited my answer. Thanks Roald! –  Isxek Jun 21 '10 at 15:56
add comment

Super simple script to compress all folders in a folder to individual zip files using .zip filetype and a Deflate64 compression method.

@echo off
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -tzip -mx9 -mm=Deflate64
share|improve this answer
add comment

It's more a limit of how much memory you have to make available to the compressor while it's doing it's job. Using 7-Zip, I'd pack an archive with .Zip format, Ultra compression, LZMA compression method, and the default 64MB dictionary size. If you have the memory available, then up the dictionary size, though note that you'll need almost 3GB of memory available to compress with a 64MB dictionary. Using a larger dictionary should allow 7-zip to hunt for more matches and provide better compression if you can afford the memory. LZMA beats both gzip (deflate/deflate64, I think) and bzip2 by a good 5% on average, up to 10-12% depending on the content.

I don't know of a tool to find the best word/dictionary size, though I think you'll find that compression method has a stronger correlation with input data, and the average/defaults should be good otherwise.

share|improve this answer
2  
I am having some trouble with LZMA - for example, no matter what settings I try in 7zip, the text file in this zip (joshz.com/Bad.zip) will not decompress using Windows' built in decompresser (I'm using Windows 7). –  Josh Comley Jun 21 '10 at 12:28
    
(the zip file I linked to contains the erroneous file for reference, but was not compressed with LZMA) –  Josh Comley Jun 21 '10 at 12:29
    
@joshcomley I was unable to find a list of supported compression schemes for the built-in windows folder compression tool. According to the Wikipedia for LZMA, it is supported by WinZip and many other compression tools across various platforms, so I elected to go with it. *.zip is just a container format, so I don't know if there is an "official" compression which tools will support, or simply common ones (similar to how *.avi can hold almost any type of video). If you need to ensure it always works, pack it as self-extracting. –  Darth Android Jun 21 '10 at 13:26
add comment

If you are looking for the best compressor for Windows environments, I would recommend you to try either *.zip format with 7-zip LZMA 'Compression Method' OR
use 7-Zip *.7z SFX archives . SFX archives have a overhead of about 130 kb over .7z compressed files and are worth using when the size difference between .7z and .zip is large.
Another good but uncommon competitor is the NSIS which can use LZMA compression mode to create
highly customizable exes. I know NSIS is not an compressor but a Scripting language but I was impressed it performed better than 7-zip SFX.

A Test I did with 2 files -
AutoHotkey-H.exe (946 kb)
AutoHotkey.dll (1003 kb)
Total Size - 1955 kb

7-Zip .zip - 794 kb
7-Zip .7z SFX - 594 kb
NSIS LZMA Solid Compression - 552 kb
7-Zip .7z - 461 kb

As #4 is not what you want, the clear winner is NSIS but for practical reasons, I suggest going with .zip is compressed size is less than 500 kbs and if larger, go with a exe making tool such as 7-Zip SFX or NSIS (7-zip in particular as it is easy to set up).

share|improve this answer
    
The requirements in the question specifically exclude 7z and other formats. –  Bob Dec 14 '13 at 7:07
    
@Bob He said a compressor that is compatible with Windows and exe (my #2 and #3) is. The 7z is only #4 which I have pointed out. –  Avi Dec 14 '13 at 7:24
add comment

The best deflate compressors that I know of are:

Deflate file compressed file size comparison from Data compression using Zopfli:

╔══════════════╦═══════════╦═════════╦═════════╦═════════╦═════════╗
║              ║Corpus size║gzip ­-9  ║7-­zip    ║kzip     ║Zopfli   ║
╠══════════════╬═══════════╬═════════╬═════════╬═════════╬═════════╣
║Alexa-top-10k ║693108837  ║128498665║125599259║125163521║123755118║
║Calgary       ║3141622    ║1017624  ║980674   ║978993   ║974579   ║
║Canterbury    ║2818976    ║730732   ║675163   ║674321   ║669933   ║
║enwik8        ║100000000  ║36445248 ║35102976 ║35025767 ║34995756 ║
╚══════════════╩═══════════╩═════════╩═════════╩═════════╩═════════╝

Even on random PNGs Zopfli was able to be 0.5% better than pngout. Zopfli makes the smallest of them all.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.