- Lossless files shrink in size when compressed, but reconstruct the original data when uncompressed, retaining the quality of the content.
- There can be image, audio, and video files with both lossy and lossless compressions.
Whether you are dealing with images, audio files, video files, or any other file; they are bound to have a specific format in which the data is arranged. Additionally, a file can be either lossy or lossless – there is no alternative.
If you are planning to create your files, such as audio recordings, podcasts, or streaming videos, you need to understand the difference between a lossy file format and a lossless file format. This is what we explain in detail, and by the end of this article, you will be familiar with the significant differences, and learn the common lossless file formats being used today.
On this page
Understanding file compression
You may have come across different compressed file formats, like 7z, RAR, ZIP, etc. However, these are not the only compressed files. You can find compressed files across different file types, which includes audio files, video files, and image files. For example, even the widely-used image file format JPG is a compressed file format.
If you take a RAW image file captured directly from a camera’s lens, you will notice its large file size, maybe even exceeding 25 MB. This is because it contains data in its raw form, with no alterations, and the highest quality available. However, most digital cameras automatically convert these images to other compressed file formats, like JPG, so that they can be stored without taking up significant storage space.
That said, the RAW image file, which is a lossless file, can be used by experts and professionals for editing purposes so that its quality is not compromised. But, in contrast, when an image is saved in JPG format, its quality is significantly degraded.
Since this particular example (JPG) has variable compression ratios, it can impact the quality of the image in different depths. The lower the quality, the smaller the file size.
File compressions work through different codecs. Codec is an acronym for compressor/decompressor, which does exactly what the name says. A codec is an algorithm for compressing or decompressing files. Whether a file is lossy or lossless depends on the codec. In simpler words, a codec is a set of rules that apply to the file when compressing and decompressing it.
In lossy compression, a codec usually removes the information not important to humans, such as inaudible sound frequencies or overlapping sounds, which reduces the size of the files, or “compresses” it. However, this is not how lossless file compression works.
In lossless file compression, the redundant data is smartly removed when the file is saved and re-inserted when the file is decompressed. This makes the file lossless, regardless of how many times it is compressed and decompressed.
Lossy vs lossless file formats
As mentioned earlier, only the files you compress don’t need to be lossy or lossless – some file formats are already compressed, hence falling under the category of lossy or lossless.
Some of the common image file formats that are lossless include RAW, PNG, and BMP. While JPEG/JPG, WebP, and HEIF are some of the common lossy file formats.
Similarly, FLAC is a popular lossless audio file format, while MP3 is a lossy file format with variable compression abilities.
When discussing video file formats, it is common to refer to codecs as lossy or lossless, instead of the file format. That said, the common lossy video codecs include H.264, H.265, and HEVC, whereas AV1 and VP9 are lossless video codecs.
Note: The regular H.264 and H.265 video codecs are lossy. However, there are also lossless versions available for these codecs which are denoted as “H.264 Lossless” and “H.265 Lossless”, respectively.
That said, both lossy and lossless file formats have their advantages and disadvantages.
Lossy file formats: Pros and cons
Lossy file formats are commonly used on files that will have no effect if the quality drops. For example, capturing an image from your smartphone will save it in JPEG format. This deteriorates the image quality when converting it from its RAW form, but also compresses the file size so it won’t take up a huge chunk of the storage space.
This means that the advantage of using lossy file compression is having the option to reduce the file size. However, its downside is the loss of quality. The smaller the file size becomes, the poorer the quality of the data inside the file; whether it’s an image, a video, or a video.
Lossless file formats: Pros and cons
Lossless file formats retain the data’s integrity by restoring full information when it is decompressed. This means that one of the biggest advantages of a lossless file format is the preservation of the content quality.
However, this means that the compression ratio is not as good as a lossy file format. Lossless file formats do compress the original data and reduce the file size, but the compression ratio isn’t as surprising.
Lossless file formats
Here you’ll find the details of the most common lossless file formats across the different types of files.
Lossless audio file formats
Free Lossless Audio Codec (FLAC)
FLAC is an open-source, lossless audio file compression format. The format is very much like the .MP3 format, except that the FLAC encoder does not lose any audio data, hence maintaining the content’s quality like the original.
Moreover, it reduces the file size by approximately 60 percent, which makes this format more desirable than many other popular audio file formats. This is also the reason why the FLAC file format is preferred by users that prefer lossless audio.
Apple Lossless Audio Codec (ALAC)
ALAC is Apple’s proprietary lossless audio codec. It is very much identical to the FLAC file format, with the only difference being supported as the only audio file format in Apple Music.
That said, the ALAC file format was later converted to open-source and hence, royalty-free.
Digital Theater Systems (DTS)
The Audio data within a DTS file is encoded using the Digital Theater Systems (DTS) codec. Such files are usually used in home theaters for surround audio, therefore requiring unequivocal sound quality.
A DTS audio file is naturally big, but the lossless compression algorithm reduces its size while maintaining the audio quality.
The .APE audio file format was created by Monkey’s Audio. It is a lossless file format and is widely used by Windows OS users. This is due to the superior lossless compression algorithm of the APE encoder.
APE files are normally used to record high-quality audio tracks and save them in limited storage spaces. However, they are still relatively larger than some lossy audio file formats, like MP3. Therefore, APE files are not used for online streaming and uploading.
Lossless video file formats
H.264 Lossless (x264/ MPEG-4 AVC)
H.264 lossless video format, also known as “Advanced Video Coding (AVC)“, is used by the majority of the video-creating industry. Additionally, it is supported by a wide range of video file formats, including AVI, MKV, and MOV.
H.265 Lossless (x265/HEVC)
High-Efficiency Video Coding (HEVC), also known as H.265 lossless video codec, provides superior video compression than the H.264 Lossless codec. This codec is also supported by a wide range of video container formats, including HEVC and MKV.
The AV1 video container can be both lossy and lossless. However, the lossless version is supported by very few container formats, including MKV.
This format is royalty-free and was initially created as a successor to the VP9 codec, with better compression ratios.
Lossless image file formats
A BMP image file is also referred to as a “bitmap image file,” “device-independent bitmap (DIB) image,” and “bitmap image.” As the name suggests, it is a device-independent image, which means that it can be transferred between different devices and have no effect on the quality of the image. This indicates that it is a lossless image file format.
That said, a .BMP image file can still lose the quality of the image when it is rescaled. Since it is a raster image file, it is constructed on pixels. Therefore, when stretching or compressing the size of the image, the pixels can become distorted.
Graphics Interchange Format (GIF)
The GIF file format can be static, or have animations. Either way, they are both lossless compressions. A GIF image file is popular today because of its impressive compression ratios, and its ability to display animations while keeping the file size small.
As discussed earlier, RAW images are usually captured by professional cameras so they can be edited by tools like Photoshop. These are high-quality images that are saved as captured but are usually significantly larger.
Since the professionals need the details to be unfeathered while editing the images, RAW images are preferred. However, these are usually converted into other formats with higher compression ratios before uploading or sharing them.
This concludes the common lossless file formats across different scopes.
Converting lossy file formats to lossless
When a file is saved in a lossy container format, it loses a portion of its data permanently. The lost data cannot be recovered unless you retrieve the original file (that was used to create the lossy file in the first place).
If you convert the same lossy file into a lossless format, the lost data will not be miraculously regenerated. Only the data available within the lossy container will be converted to a lossless file format.
Lossy or lossless: Which file format should you use?
After having considered both the pros and cons of the lossy and lossless file formats, regardless if it’s an audio file, a video file, or an image file, it all comes down to the purpose of the file.
Lossless file formats retain good quality but are relatively greater in size. On the other hand, lossy file formats compromise the quality but reduce the file size significantly.
If you plan on sharing or uploading the file to the web frequently, it is recommended that you use a god-compression algorithm that will significantly reduce the file size. This, in turn, will make the sharing process faster, and reduce bandwidth consumption.
However, if content quality is your main priority, then you should consider uncompressed files. However, those can be pretty huge. Therefore, when considering both the quality of the content and the file size, you can choose a lossless compressed file format.
Frequently Asked Questions (FAQs)
Should you always choose lossless compressions?
It is not wise to always choose lossless compression, as it depends on the purpose of the file. Lossless compression algorithms usually do not reduce the file size as significantly as lossy compression. Therefore, if storage space is one of your concerns, then you may want to consider a lossy compression algorithm as well.
Are uncompressed files lossless?
An uncompressed file does not necessarily mean that it needs to be archived and compressed using a tool. It simply means a file that is still in its raw form, unchanged and holds maximum data. For example, an image captured by a camera lens and saved in its raw form is uncompressed. Hence, it is lossless.
This means that all uncompressed file formats are lossless.