Whether you’re dealing with images, music, or video files, it’s important to understand the difference between different types of formats and when to use them. Using the wrong format could ruin a file’s quality or make its file size unnecessarily large.
Some types of media file formats are “lossy” and some types are “lossless.” We’ll explain what these terms mean, the advantages of each type of file format, and why you should never convert lossy formats to lossless ones.
We use compression to make files smaller, allowing them to download faster and take up less storage space. For example, when you take a photo, your camera captures all the light it can get and puts together an image. If you save the image in RAW format, which keeps all the light data the camera’s sensor received, the image may be as large as 25 MB. (This depends on the resolution of the image—a camera with more megapixels will produce a larger image.)
If we’re just uploading these files to a social network or placing them on a website, we don’t want these image files to take up so much space. A photo gallery with RAW images could take up hundreds of megabytes of space. RAW formats may be used by professional photographers to keep image quality high during the editing process, but they’re not intended for the average person.
Instead, our camera or smartphone converts the image to a JPEG file. JPEG files are much, much smaller than RAW images. When you convert RAW to JPEG, some of the image data is “thrown out”, producing a much smaller file. The conversion process uses a compression algorithm that works well for photos, allowing them to look fairly good in spite of the compression. You may still see compression artifacts, depending on the quality setting.
Note that lossy formats generally have a setting that controls how lossy they are. For example, JPEG has a variable quality setting. Low quality makes a smaller JPEG image file, but the quality of the image is noticeably worse. Below is a close-up example of a very lossy JPEG—you can see various “compression artifacts.”
Lossless vs. Lossy Formats
We call RAW a “lossless” format because it preserves all of the file’s original data, while we call JPEG a “lossy” format because some data is lost when we convert an image to JPEG. However, these aren’t the only formats that are lossy and lossless.
- Images: RAW, BMP, and PNG are all lossless image formats. JPEG and WebP are lossy image formats.
- Audio: WAV is a container file often used to contain lossless audio, although it is also capable of containing lossy audio. FLAC is a lossless audio format, while MP3 is a lossy audio format.
- Video: Few lossless video formats are in common consumer use, as they would result in video files taking up a huge amount of space. Common formats like H.264 and H.265 are all lossy. H.264 and H.265 can provide smaller files with higher qualities than previous generations of video codecs because it has a “smarter” algorithm that’s better at choosing the data to throw out.
Some of these lossless formats also provide compression. For example, a WAV file typically contains uncompressed audio, and takes up quite a bit of space. A FLAC file can contain the same lossless audio as a WAV file, but uses compression to keep create a smaller file. Formats like FLAC don’t throw any data away — they keep all the data and compress it intelligently, like ZIP files do. However, they are still significantly larger in size than MP3 files, which throw much data away.
A conversion can be lossy even between lossless formats. For a conversion to actually be lossless, the data from the original file must fit inside the destination file. For example, lossless FLAC files only support 24-bit audio. If you converted a WAV file containing 32-bit PCM audio to FLAC, the conversion process would have to throw out some data. The conversion process between a WAV file containing 24-bit PCM audio to FLAC would be lossless.
In the below image, the bottom version of the photo is compressed with a poor-quality lossy compression algorithm. It will be noticeably smaller in file size than the above image.
Image from Wikimedia Commons
Why You Should Never Convert Lossy to Lossless
When you convert a file from a lossless format to a lossy format—say, ripping an audio CD (a lossless format) to MP3 files (a lossy format)—you’re throwing away some of the data. The MP3 file is so much smaller because much of the original audio data has been lost.
If you converted the lossy MP3 file to a lossless FLAC file, you wouldn’t get any of that data back. You’d get a much larger FLAC file that’s only as good as the MP3 file you converted from. You can never get the lost data back. Think of it like taking a perfect copy of a photocopy. Even if it was possible to create a perfect copy of a photocopy, you would still end up with a photocopy, which isn’t as good as the original document.
This is also why it’s a bad idea to convert lossy formats to other lossy formats. If you take an MP3 file (a lossy format) and convert it to OGG (another lossy format), more of the data will be thrown away. Think of this like taking a photocopy of a photocopy—each time you photocopy a photocopy, you lose data and the quality becomes worse.
Conversion from lossless formats to lossless formats works well, however. For example, if you rip an audio CD (lossless) to FLAC files (lossless), you’ll end up with files as good as the original audio CD. If you later converted those FLAC files to MP3 files—say, to shrink them down so more of them will fit on an MP3 player—you’ll end up with MP3 files that are as good as MP3 files ripped from an audio CD directly.
Which Should You Use?
When you should use lossless formats and when you should use lossy formats depends on what you’re using them for. If you want a perfect copy of your audio CD collection, you should rip them to lossless files. If you want a copy to listen to on your MP3 player and file size is more important, use a lossy format instead.
If you want to put a photo on the web, you should use a lossy format to reduce that photo’s size. (but keep a backup of the original lossless file) If you’re printing the photo professionally, you’ll probably want to use a lossless format during the editing process. (Note that, for screenshots, PNG is a lossless format that can create appropriately-sized, sharp screenshots out of the flat colors found on computer screens. However, PNG becomes much larger if it’s used for photos, which contain much more jumbled up colors from the real world.)
We can’t possibly cover all of the situations you’d choose a media file format for. Just be aware of the trade-offs when selecting a file format.
For more guidance on which image file type to use and when, read What’s the Difference Between JPG, PNG, and GIF? Or, if you’re curious about all the available audio file formats, read HTG Explains: What Are the Differences Between All Those Audio Formats?
This article was inspired by a comment exchange on a website. One commenter was upset that a legitimate BitTorrent file full of free music from the SXSW festival was in MP3 format instead of FLAC format. In response, someone replied that they could just change the format from MP3 to FLAC. If you’ve read this article, you should now understand why that reply was so silly.
- › Why Can I Only Burn 80 Minutes of Music to a CD if My MP3s Take Up Less Than 700MB of Space?
- › Lossy vs. Lossless Compression: What’s the Difference?
- › What Is An MP3 File (And How Do I Open One)?
- › How to Convert a WAV File to MP3
- › What Are WAV and WAVE Files (and How Do I Open Them)?
- › What Is Adobe Lightroom, and Do I Need It?
- › MP3 Isn’t Dead
- › 6 Ways Our Tech Is Better Than Star Trek’s