Does the RAR compression algorithm compress better than the ZIP compression algorithm?

4

I took 3 test files and ZIPped them. With the 3 test files again I RARred them. Each .RAR archive is smaller than the corresponding .ZIP archive.

Does the RAR compression algorithm give a better compression ratio than the ZIP compression algorithm?

Pacerier

Posted 2011-07-19T22:23:28.710

Reputation: 22 232

1Hard to say exactly since a Zip file may be using any one of several compression algorithms. The most commonly used algorithm is the Deflate algorithm, which is not a super-great and modern algorithm but has become the lowest common denominator since all zip-aware tools can use it. – Andrew Lambert – 2011-07-19T22:59:33.533

@Amazed: such a wonderful answer, wasted as a comment :) – akira – 2011-07-20T04:21:48.070

1@akira Thanks. It just felt like a non-answer to say "well that all depends." – Andrew Lambert – 2011-07-20T05:51:25.260

Answers

5

Although it depends on what you're compressing, I've noticed that RAR often does get a slightly better compression ratio (although I usually don't find it to be too significant), but the data I need to compress is likely very different from the data you need to compress.

If you run any benchmarks of your own, be sure to include 7-Zip in the list of contenders as well since it's definitely a worthwhile cross-platform alternative that can also handle the .ZIP and .RAR formats seamlessly:

  7-Zip (free and open source)
  http://www.sevenzip.sourceforge.net/

Also, here's a document that examines compression ratios between various compression archiver tools, which I believe you'll find interesting:

  Archiver Comparison
  http://warp.povusers.org/ArchiverComparison/
  http://www.squeezechart.com/main.html
  http://compressionratings.com/rating_sum.html

Randolf Richardson

Posted 2011-07-19T22:23:28.710

Reputation: 14 002

17-Zip is a great tool, and my experience has been that 7z is the great format most of the time. – Zoredache – 2011-07-20T00:14:34.527

7zip only works for windows!? – Pacerier – 2011-07-20T06:09:40.510

I use 7-Zip on NetBSD. I did mention that it's "a worthwhile cross-platform alternative" after all, and a list of download options for many platforms can be found here: http://www.sevenzip.sourceforge.net/download.html

– Randolf Richardson – 2011-07-20T06:14:20.717

1

The 7-Zip .7z format gives best results overall, and also has much stronger encryption than the .zip format.

Please recall that the .zip format is actually two DIFFERENT formats:

  • Old 16 bit style zip, with a 2gb file size limit
  • New zip format, which lifts this file size limit

Many tools, such as the zip support built into some versions of Windows, only support the older zip format.

Additionally, the zip format has really weak encryption that is easily cracked. The RAR and 7z formats are both dramatically better than the old style zip encryption (I am not versed in the quality of new zip compression, so cannot comment on it).

7z is a great choice. RAR is also a good choice.

HTH!

Jonesome Reinstate Monica

Posted 2011-07-19T22:23:28.710

Reputation: 1 680

1what do you mean by cracked? i mean i can't understand what's there to crack a zip file – Pacerier – 2011-07-20T06:07:58.823

@Pacerier: Some popular archival tools support some sort of password protection mechanism, and a few of these turned out to be very easy to "crack" (or even circumvent altogether). 7-Zip, on the other hand, supports 256-AES encryption (and can optionally encrypt the filenames too), which is better than simple password protection because decryption can be far more demanding of processing resources than attempting to crack a password. – Randolf Richardson – 2011-07-20T06:27:38.790

@Sam Jones: "the zip format has really weak encryption that is easily cracked" .. not true: read http://superuser.com/questions/145167/is-zips-encryption-really-bad/145177#145177

– akira – 2011-07-20T08:16:10.190