Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

Can I ZIP Photos or MP3 Files to Save Space?

Seems like it should work, right?

Compression
(Image: askleo.com)
Most music, picture, and movie files are already compressed. Compressing them again won't make much difference, and could even make them larger.
The Best of Ask Leo!
Question: Can I ZIP my photos or MP3 files to save disk space?

You can zip them, but you won’t save much space, if any. The result could even take up more space than the original!

ZIP is a very popular compression algorithm supported by many popular programs, such as WinZip, 7-Zip, and even Windows itself. “Zipping” (or compressing) a file or set of files can often reduce their size significantly, but at the cost of needing to be unzipped before they can be used.

Note though that I said, “…often reduce their size.”

Unfortunately, “often” doesn’t mean “always.”

Become a Patron of Ask Leo! and go ad-free!

TL;DR:

All compression algorithms can create situations where the result could be bigger than the original. Compressing already-compressed files is one common scenario. Since photos, mp3, and other popular file formats are already compressed, compressing them again rarely has much effect, and can even make them larger.

The short answer

Zipping photographs, music, and videos will typically not make them significantly smaller and can even make them slightly larger.

To understand why that might be, we need to look into how compression works at a high level.

About compression

While the specifics of many different compression algorithms are often the stuff of research, theses, and even patents, the concepts of compression are fairly simple.

The idea is that information stored on disk is often stored in a way that is less than optimal for storage. It may be optimal for other purposes, but as a side effect, there may be redundant information in the data that could be represented differently.

Let’s look at a simple compression algorithm called “run-length encoding.”

Consider the following text:

This is a row of 10 asterisks: ********** followed by text.

That’s 59 characters long. If we define the character “+” to not be a plus character, but rather an indicator that the next two characters are a count, and the third character the character that should be repeated that many times, we get this:

This is a row of 10 asterisks: +10* followed by text.

We’ve shortened or “compressed” the text to only 53 characters, but it still means exactly the same thing. When decompressed, the “+” is encountered causing the “10*” that follows it to be read and replaced with 10 asterisks. The original uncompressed text is restored.

This is a row of 10 asterisks: ********** followed by text.

Compression doesn’t always compress

In the example above, we took a line of 59 characters and “compressed” it to 53 characters. It’s not a great compression algorithm, but it worked.

Now, let’s compress this text using the same algorithm:

Here's a single plus sign: + followed by text.

That’s 46 characters long.

The problem is that because it actually contains the plus sign, the character we said was special in our compression algorithm, we can’t just let it be. If we do, the decompression algorithm will look at it and say, “Oh, the next two characters are a count of the number of times I should repeat the third character following,” which is simply wrong.

Unless we specially encode the plus character, the decompressed line will read:

Here's a single plus sign: +01+ followed by text.

That allowed the decompressor to follow its algorithm: “+” means the next three characters are a count (one, in this case) of the number of times to repeat the third character (“+”). The compression and decompression algorithm works.

The only problem is that the “compressed” data, at 49 characters, is now larger than the original 46.

Every compression algorithm faces this problem. My little example above was crafted to make it easy to show, but even the most advanced compression algorithms encounter situations where compressing particular forms of data may cause the “compressed” data to be larger than the original.

Compressing already compressed data

One of the most common ways that compressed data end up larger than the original is if the original is itself already compressed.

Let’s look at the compressed version of my silly little example again:

This is a row of 10 asterisks: +10* followed by text.

What happens if we try to compress that data again? Well, as we saw, that single “+” sign is a problem and needs to be treated specially:

This is a row of 10 asterisks: +01+10* followed by text.

The result is that the “compressed” data got bigger than the original.

Or rather, compressing the already-compressed data made it larger.

This happens most reliably when you compress twice using the same algorithm, but if the compression techniques you’re using are relatively efficient, then the algorithms don’t matter as much. Zipping something twice makes the second zip larger than the first. Zipping a “RAR” file, also a compressed file just using a different algorithm, will also typically result in something bigger than the original.

With that as background, we can finally explain our answer to the question.

Photos, music, and videos are already compressed

Pictures in popular formats such as .jpg, .png or .gif are already compressed.

Music files in formats like .mp3, .ogg, .aac, and so on are already compressed.

Video files in formats like .wmv, .m4v, .mov, and more are already compressed.

Even some document formats like .docx, .xlsx, .pptx, and so on are already compressed.1

And as we’ve seen by now, depending on the type of compression you’re using, compressing an already-compressed file at best does very little, and at worst makes the file bigger.

So there’s typically no space-saving advantage to zipping a photo, a movie, or an MP3.

Zipping is more than compression

Of course, creating a .zip file is useful for more than just compression.

It can be handy to ZIP several files (for example, a collection of several pictures) together, combining them into a single file for a single download, attachment, or file transfer. Zipping a collection of files together can also make the result smaller as file-system overhead is reduced from multiple files to a single file.

People still need to unzip before they can see them, but it can be simpler to transfer only one ZIP file rather than several separate unzipped files.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

Podcast audio

Play

Footnotes & References

1: Ironically, using the ZIP compression algorithm. Rename any “.docx”-style file to be “.zip” instead and you can view and even decompress its contents with a ZIP utility.

40 comments on “Can I ZIP Photos or MP3 Files to Save Space?”

  1. Obviously ANY uncompressed format should compress some using ZIP. But it’s not always obvious which files are, or are not compressed. For example some BMP files actually are compressed. Same for some .WAV files.

    Reply
  2. my mp3 player is supposed to hold 4 hours… roughly 60 songs at 4 minutes each, right? but i can only fit around 30 on it, so there’s gotta be a way to basically cut their size in half, but i don’t know how?

    Reply
  3. There are different levels of compression in MP3 that can be traded off against the quality of the sound: the better the quality of sound, the bigger the file. When an MP3 player’s manufacturer indicate how many songs a player might hold, they’ll typically assume better-than-average compression. If you have your own audio software you can adjust the compression if you like, but you’ll probably notice that the quality of sound will degrade.

    Reply
  4. Please tell me how to email mp3 or other audio files. I have these audio files (majority in mp3 format) stored in my hard drive and now I need to attach these in my emails? If I attach these audio files, will the receiver be able to listen to these mp3 with good quality? Thanks for your time.
    Roy Abraham

    Reply
  5. hello, how do i send folders of large JPGs from my home computer to my school’s yearbook computer? i’m a photographer for them and i’m worried about compression or any degradation of quality. can i zip them or does that ruin quality? should i just put images onto a CD? thanks

    Reply
  6. Hi there, I’m going to be buying a new pc soon, is there any way of putting my mp3 files onto a cd so that i can just burn them onto the new hard drive instead of downloading them all again?

    Reply
  7. just something that might make it easier for all.

    you can creat a self extracting file (EXE, application) for any type of file

    simply hit Start__>run__>type in “iexpress.exe”

    and follow along the instruction from their.

    i think its on most windows machines.

    Marc

    Reply
  8. Too bad about the .zip method, have 1000’s of mp3s on my hd. taking up too much room.
    Thanks Marc for the IExpress 411. First I’ve seen that, although I’ve seen tools designed to make .exe’s from other formats. And there it is right in windows! I’ll have to try it out sometime (with junk files to start)!

    John N.

    Reply
  9. Zipping files that are already in a compressed format (jpg, for example) may save space, but not due to compression savings. Files are allocated in “chunks”. Any space that is left over in the file’s last chunk is effectively wasted space. The more files, the more wasted space. If you combine all of these files into one archive (zip or otherwise) then you have only the wasted space at the end of the one archive file instead of the waste in each of the component files. However, you have to weigh the space saving against the inconvenience of accessing the files through the archived format. Also, there is a certain amount of space taken up by the zip file header.

    Reply
  10. It SHOULD be possible to compress an mp3 file to a much smaller size (in a lossless format). Yes an mp3 file is “compressed” but for a standard constant bitrate file each second of sound is allocated a fixed number of bytes.

    Most music files will contain repetition, eg a riff or chorus that appears multiple times in the file, and therefore it should be possible, given the right algorithm, to compress out this duplication.

    Why this doesn’t happen in reality I guess is that the standard compression algorithms either do not detect this duplication for whatever reason or simply do not deal with it.

    Maybe someday someone will come up with a totally lossless file compression algorithm for mp3s and even wav, although by then we may all have switched to lossless compression in the first place.

    Reply
  11. @Earl Purple
    Here’s the problem with this theory. Lossless compression works by storing symbols using the least number of bits necessary to represent the original data. To put it another way, the data is represented in the compressed file in a highly complex mathematical algorithm that requires less space than the original data. JPGs, GIFs, MP3s, etc, already store their data in a method extremely similar to this. In fact, it has been shows that the Huffman algorithm used in MP3 is a modified version of LZW, an extremely effecient and highly popular compression method.
    MP3s specifically store music NOT as a compressed waveform, but as a series of coefficients that represent the individual frequencies, or notes, that were present in the original waveform. In theory, the coefficients would take exactly the same amount of data to store, but MP3 “cheats” in that it throws away any of the coefficients that it thinks people would not be able to hear anyway (perceptual modeling). It then compresses the remaining data as much as possible into the Huffman compression format, and then breaks up the data into individual “frames” that can be played back by MP3 players. In order to make the MP3 file smaller, you can throw away more and more of the frequencies, but you WILL start to hear the degradation in quality rather quickly.
    JPGs, and MPGs/AVI/etc, have similar concepts behind them.
    You mentioned that it should be possible to remove the repetition in the riffs, and repeated parts to save more space, but consider this: if you play the same note with an instrument one million times, you will NEVER be able to find two identical waveforms in them! There is far too much randomness to the data for that type of compression to be possible. And it would make no difference if you found two “similar” notes, and somehow subtracted out the differences so you could save the space of the actual second note and just store the tiny differences between the notes. There is so much randomness to the differences that it would take essentially the same amount of space in the file to do that.
    Actually, MIDI does something similar to this, instead of storing the sound from the instruments, it just stores what notes are played and recreates that sound upon playback. It is NEVER going to sound like the “real thing” because you aren’t storing the real waveform, just the information that there was a note played.
    If you would like more info on how compresion works, check out Wikipedia’s article: http://en.wikipedia.org/wiki/Data_compression
    -cheers

    Reply
  12. Earl:

    All those riffs that you think could be replaced by one copy, cannot. There are differences in the playing of them every time, even though the sheet music might be the same.
    Consider the Smoke on the Water riff. Even on the sheet music, it has variations, then you add in the ones that come from a real person playing it.

    The problem with your other theory of a loss less way to compress MP3s is that the MP3 has already created losses and if you could find your magical program, you are just copying the losses. However, as Leo tried to explain (and did a much better job than most of the explanations I have seen), a compessed file looks to another compressor as relatively random stuff that doesn’t compress well.
    Don’t ever expect that any program will compress any already compressed (even a lossless) file. FLAC compression is lossless and does a great job in compressing audio files that were not already compressed by something else. You could compress them more by converting them to an MP3 but what that would really be doing is restoring the uncompressed audio and throwing out parts of it that you think are not really noticeable as it compresses it again.

    If you want to experiment with something more obvious than audio (a lot of the changes are very subtle), try using a program where you can convert a photo to jpg and adjust the compression. Pick a photo with some subtle shading of similar colors (like sky) or for a shocker, use some line art (like a screen capture of this page) to see how much the compression looses or modifies the origonal.

    Reply
  13. The algorithm described in the article is lossless, the ten asterisks are returned intact. Years ago pondering file compression I figured something like that independently. (I have re-invented the wheel hundreds of times, can’t help it) I do a lot of intense graphics work, and I always save my files as bitmaps. (Or vector graphics if they are of that nature) but never as jpg. (Unless I get careless and do it by mistake, which happens sometimes) Disk space is not that precious to me anyway, and a lot of times I will attach a bmp to an email, then wonder if the recipient will wonder why I didn’t send a jpg. If you save a 256 color image as a jpg and then test the count of colors in the picture, it will be in the tens of thousands. If you cut a figure out of the background by filling the backgournd with white, then save the cut out figure as a jpg, and later try to paste that cut out figure over a new background, it won’t work, because the white will have become a hundred or more ‘shades’ of white. I am now curious enough to test a compression program like 7zip on a bmp file, although I doubt I would use it even if it results in high compression and no loss of data. Maybe for archiving some old files to DVDs or something…. Thanks for giving me something to think about. It’s great being a geek in the company of geeks. :)

    Reply
  14. @Digital Artist
    .PNG format is a lossless format for saving photos in the same way .FLAC is a lossless format for compressing music. Now that storage and bandwidth are getting cheaper, many websites are using .PNG photos as they have a higher quality. :PNG format is a universal format which is understood by all browsers, image viewers and editors.

    Reply
  15. ZIPping several less used files has a different benefit. It reduces the folder and file names clutter. And reduces the number of file handles (or inodes in Linux). File handles or inodes are the index entries for a file on the file system. And, these are not unlimited. Moreover, it can decrease the computer’s performance/response when searching or using file explorers.

    So, if you have many files that you use rarely, it is good to organize them in folders and ZIP each folder and then delete the files. Also, when you need to store a large number of files on a USB external hard disk, it reduces the backup time. Storing one or few zip files takes substantially lesser time than storing thousands of files.

    Reply
  16. Hello,
    I have a .mov file I would like to send to a auto service person but it says that it is to big to send. I Zipped it (Zip7) but now I’m getting notes that I should send it to the iCloud. But how is this person supposed to get it if I do that? Now I have also heard of using a URL address to send to the recipient. But I don’t know how to do this action. I follow instruction well so if someone could step me through one of the procedures, it would be greatly appreciated.
    I await your reply

    Reply
  17. >So there’s typically no space-saving advantage to ZIPping a photo, a movie, or an MP3.

    Incorrect. Photos, movies, and music are compressed but they still have to “seem normal” to the human eye & ear. That means the files are not fully-compressed, and there’s still room for ZIP to compress the files even further………. for example the MP3s on Rifftrax are ZIPPED downto 60% their standard size.

    Reply
    • In some exceptional cases zipping an mp3 or other compressed media file might save some space, but in the vast majority of cases, the added compression is minimal or even worse, the file is often made larger by zipping it.

      Zip or other lossless compression doesn’t affect the quality of the music or photo in any way. What causes loss of quality is the kind of compression used by mp3, jpg, or avi, etc. compression which not only reduces redundant data but also combines things so similar to the human eye or ear as to be nearly indistinguishable to the untrained eye or ear.

      Reply
  18. Hello,
    What is the effective format for compressing video files? …
    I am a Linux user, I have tried all formats for compressing videos stored on my pc and none of them compresses.

    Reply
  19. I was thinking of doing this to potentially save the unused parts of incomplete blocks on the drive. I think it could matter for an unimaginable number of small files. If you could just take up all of the blocks in one bigger file potentially not compressing but just storing this could maybe work.

    Reply
  20. I want to store various folders onto an external hard drive. The folders (or projects) only contain pdf files. Would storing them as zip files be more efficient?

    Reply
  21. Timely article. I often wondered why purchased music tracks downloaded from Amazon come as a zipped file (at least they DO here in the UK, and probably the same elsewhere, I would imagine!) Any ideas as to why they do this? MP3 is, I understand, already a form of compressed format, approx 90% of data on a CD track being “thrown away”, as it were, when ripped to mp3 and further compression, in the form of zipping, would seem to give no advantage. Also, if I send several long mp3 audio items to somebody by way of uploading them to my MS OneDrive public folder, when they are downloaded, they also arrive automatically zipped. Again, why?

    Reply
    • Dave Perry wrote:

      “I often wondered why purchased music tracks downloaded from Amazon come as a zipped file…”

      My guess would be, so that if there is more than one song being downloaded — such as all of the tracks on a whole album — they’ll all be transferred together.

      Notice my “if;” treating all music purchases identically (i.e., single-MP3 purchases as well as multiple) is the simplest course for Amazon.

      Reply
      • Thinking back, I don’t think this was always so. I had their music downloader program on my XP machines and the old memory has been jogged (I think!) to remember seeing the tracks coming through, “as is” with notifications when complete. None of this “zip” business. Wonder why they changed?

        Reply
  22. Leo, tou wrote:

    Even some document formats like .docx… are already compressed …ironically, using the ZIP compression algorithm. Rename any “.docx”-style file to be “.zip” instead and you can view and even decompress its contents with a ZIP utility.

    Wow. That is absolutely news to me! I absolutely must try that later tonight! The question I’m most anxious to see answered is, “What filetype will it decompress to…??? Sheesh!

    Reply
  23. While ‘zipping’ already compressed files may not make the files themselves any smaller, the resulting single file may take up less space due to space allocation of the file system.
    I found this once when I zipped a large number of tiny JPG icons together. Singly they each took up whole ‘allocations’, but compressed together all the ‘wasted space’ was removed between them and the zip was smaller.

    Reply
    • Sorry to remove the link, but it’s an unknown site, and you don’t need any additional tools to zip files — it’s built into Windows. (Though 7-Zip is a good tool if you want more features & options.)

      Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.