File Compression: The Complete Guide to Compressing Any File

The complete guide to file compression. Learn how compression works, lossy vs lossless, and how to compress images, video, audio, PDFs, archives, ebooks, fonts & presentations - mostly right in your browser.

A cross-media guide to compressing images, video, audio, PDFs, and folders, and choosing the right method for each.

File Compression: The Complete Guide to Compressing Any File

Everything you need to shrink files of any type - how compression actually works, the difference between lossy and lossless, format-by-format advice, and the right way to trade quality for size.

Last updated:

Media filesCompress by format
Mixed foldersArchive as ZIP
First moveFind the heavy part
WhereIn your browser

Compressing files is not one task but two, and confusing them is why people often get poor results. On one side is format-aware media compression, where you shrink a photo, video, or audio track by re-encoding it more efficiently. On the other is archiving, where you bundle a folder of mixed files into a single, smaller container like a ZIP. The right choice depends entirely on what you are trying to make smaller.

Before you compress anything, find where the weight actually is. A folder that is huge because of one 4K video is a video problem, not an archive problem. A report that is enormous because of embedded scans is an image problem inside a PDF. Aim at the heavy part and the whole thing gets dramatically smaller. The rest of this guide explains the mechanism underneath both kinds of compression so that the method you pick is a deliberate choice rather than a guess.

Two kinds of compression

Media compression works because formats like JPG, MP4, and MP3 are already designed to throw away detail your senses barely register. Re-encoding at a slightly lower quality or a smaller size removes bytes you will not miss. This is how a photo or a video drops to a fraction of its size while still looking fine.

Archiving works differently. A ZIP does not degrade your files; it finds repetition across them and stores it once, which shrinks text, code, and documents well but barely touches already-compressed media. That is the key insight: zipping a folder of JPEGs and MP4s saves almost nothing, because those files are already compressed. Zipping a folder of documents and spreadsheets saves a lot.

The short version

Shrink media by re-encoding it. Shrink folders of documents by zipping them. Do not expect a ZIP to shrink files that are already compressed.

How compression removes bytes

At its core, all compression exploits one fact: real files are not random.[4] They are full of patterns, repetition, and detail the recipient does not truly need, and compression is the art of encoding that redundancy more compactly. Two broad strategies do the work. Entropy and dictionary coding replace frequently repeated sequences with shorter codes: the letter "e" or a run of identical pixels appears constantly, so it gets a compact symbol, while rare sequences keep longer ones. This is the engine inside ZIP, PNG, and the lossless layer of nearly every format. Transform and perceptual coding goes further by first reshaping the data into a form where unimportant detail is easy to isolate, then discarding that detail. JPEG converts image blocks into frequency components and drops the high frequencies your eye barely resolves; MP3 and AAC model human hearing and discard sounds masked by louder ones.

The reason a raw photo can shrink to a tenth of its size while a text file compresses far less is that photos and audio carry enormous amounts of perceptual redundancy, detail below the threshold of human perception, whereas plain text is already close to its information limit. Knowing which kind of redundancy a file holds tells you how far it can safely shrink. A digital file is ultimately just a structured stream of bytes interpreted according to its format, and compression rewrites that stream in a denser but equivalent, or near-equivalent, form.[3]

Lossy versus lossless, in plain terms

Lossy compression, used by JPG, MP4, and MP3, permanently discards some detail to reach a much smaller size.[4] Done at a sensible level, the loss is invisible or inaudible, but each re-save adds more damage, so compress once from the original. Lossless compression, used by PNG, FLAC, and ZIP, throws nothing away and can always be reversed perfectly, but it cannot shrink files nearly as far. The gap is large: a lossy image codec might reach a tenth of the original size while a lossless one manages perhaps half, because the lossless version must be able to reconstruct every last bit.

Knowing which you are using tells you how aggressive you can safely be. For a photograph destined for the web, lossy is the right tool and a little quality loss is a fair trade for a much smaller file. For a legal document scan, a master audio recording, or program source code, lossless is mandatory because every byte is meaningful and cannot be approximated. Many real formats mix both: a modern container may wrap lossy media streams and lossless metadata in one file, which is why the same extension can behave differently depending on how it was encoded.[2]

The right method by file type

Match the method to the media and you get the biggest saving with the least effort.

File typeBest methodGuide
Photos and graphicsRe-encode, or switch to WebPCompress images
VideoLower bitrate or resolutionCompress MP4
AudioRe-encode at a sensible bitrateCompress MP3
PDFDownsample images, subset fontsReduce PDF size
Mixed folderArchive as ZIPTAR to ZIP
Tip

Sending a folder by email? Compress the big media files first with their own tools, then zip the folder. Zipping last, after the media is already small, gives the tidiest single attachment.

Why you cannot compress an already-compressed file

A common frustration is zipping a folder of photos or videos and finding it barely shrinks. This is not a broken tool; it is a fundamental limit. A JPG, MP4, or MP3 has already had its redundancy squeezed out by its own codec, so when ZIP scans it looking for repeated sequences to shorten, it finds almost none.[4] The file already looks close to random from the archiver's point of view, and random-looking data cannot be compressed further. No amount of stacking one compressor on top of another beats this, and occasionally the second pass even adds a few bytes of overhead.

The practical rule that follows is precise. Use an archive when the folder contains genuinely compressible content: text, source code, spreadsheets, uncompressed images like BMP or TIFF, or raw data. Use format-aware compression when the weight is in already-encoded media, because only a smarter re-encode of that specific format will move the needle. Reaching for the wrong one is the single most common reason people conclude "compression does not work" when in fact they simply applied it to a file that had nothing left to give. The reference libraries that catalog these formats make the same distinction, grouping them by how their internal data is stored and encoded.[1]

How much smaller can it get

People often expect a fixed compression ratio, but the achievable saving depends entirely on the file's content and how it is already stored. A folder of plain text or source code can shrink to a quarter or less of its size with a lossless archiver, because natural language and code are highly repetitive. An uncompressed bitmap or a raw camera file has enormous room to shrink, often to a tenth or better, once a proper image codec is applied. A JPG, MP4, or MP3 has almost no room left, because its own codec already removed the redundancy, so a further pass saves a percent or two at most.

This is why there is no honest single number for "how much compression helps." The right question is always what kind of data you have and whether it has been compressed before. A spreadsheet exported as CSV is wide open; the same data exported as a modern office file is already zipped internally and will barely shrink again. Understanding this saves a great deal of wasted effort chasing savings that the file simply cannot give, and it points you at the one move that will help: attacking whichever part of the file has not yet been compressed efficiently.

There is also a theoretical floor. Every file contains a certain amount of genuine information, and no lossless method can shrink it below that limit without losing something.[4] A truly random stream cannot be compressed at all, and a file that has already been compressed well is, from the next tool's point of view, close to random. This is the deep reason stacking compressors does not keep paying off: each pass removes redundancy, and once the redundancy is gone there is nothing left to remove. Lossy methods appear to break this floor, but only because they change the content, throwing away detail so that the remaining, simpler data has more redundancy to squeeze. Keeping that distinction clear tells you exactly when to stop: when the file is either already efficiently coded or as small as your quality tolerance allows.

Compress a file, step by step

  1. Locate the heavy part

    Sort by size and find what is actually taking the space. It is usually one or two large media files.

  2. Pick the matching tool

    Use the image compressor, video compressor, or document compressor for media, or the archive converter for a folder.

  3. Compress on your device

    Everything runs in your browser, so your files are never uploaded. Adjust quality or resolution as needed.

  4. Compare and keep

    Check the result against the original. If it still looks and sounds right, keep the smaller version.

Common mistakes that waste space

A handful of habits quietly bloat files or degrade them for no benefit. The first is re-compressing lossy media repeatedly: opening a JPG, editing it, and re-saving as JPG again adds a fresh round of loss every time while barely shrinking the file. Convert once from the highest-quality source you have and keep that. The second is storing the wrong content in the wrong format, such as saving a photograph as PNG, where a lossless format meant for flat graphics balloons a photo to many times its JPG or WebP size with no visible gain.

The third is double-archiving already-compressed media, as covered above, which wastes time and saves nothing. And the fourth is skipping the resize step: serving a full-resolution camera image into a small on-screen slot ships millions of pixels no one will ever see. Scaling to the size the file will actually be used at is often the single biggest saving available, and it costs nothing in visible quality. Avoiding these four traps gets you most of the benefit of compression before you touch a single quality slider.

Compress a file now

Start with the image compressor, or pick the tool for your file type. Everything runs on your device.

Open the image compressor

Key takeaways

  • Compression is two jobs: re-encoding media and archiving folders.
  • Zipping already-compressed media saves almost nothing; use it for documents.
  • Always find the heavy part first and aim there.
  • Lossy shrinks far more but is permanent; compress once from the original.

References

  1. Digital file formats - Library of Congress
  2. Media container formats - MDN Web Docs
  3. File format - Wikipedia
  4. Data compression - Wikipedia