Data compression is a process by which the file size is reduced by re-encoding the file data to use fewer bits of storage than the original file. The original file can then be recreated from the compressed representation using a reverse process called decompression. There are several different algorithms and implementations that allow you to compress your files, some of which perform better than others for certain kinds of file types.
The most commonly used data compression programs are zip, bzip2, 7-zip, jpeg and mpeg among many others.
The program that you would use would depend on the requirements, file type and availability of the software on your system. There are mainly two types of compressions, lossy and lossless.
Lossless compressions ensure that you can recreate the original file bit for bit in its entirety, which means there is no data loss during the compression and decompression. This type of compression is usually a must if you are compressing text files, data files or certain proprietary formats.
This type of compression is done mainly on media files such as image, audio and video files. Depending on the usage of the files, a certain amount of loss in quality might be acceptable to save space and resources. More often than not the loss in quality is usually not detectable for all practical purposes.
There are many reasons why you might want to compress files or folders. The main advantage is that it reduces the size of the files and it allows you to bundle multiple files and directories together. The reduced size and bundling is advantageous in many situations.
Backups and Archiving Files
If you have many older files that you do not need to access on an everyday basis, but would like to preserve for other reasons then you want to archive them for safe keeping. These could be old tax records or old photographs or something similar. You can compress and bundle the files together or in separate archive files and save it.
This also allows you to burn the files onto a CD or DVD for safe keeping while saving on the amount of space required.
If you are uploading one or several large files to a website or moving files to another machine, you could benefit from a smaller file size. This reduces your bandwidth usage as well as the time needed to transfer the files.
Web use of media files
If you plan to use the media file on the website, then using a lossy compression on your image and media files will allow you to reduce the size of the files. This can again save on the bandwidth and help load the pages faster.
Email servers are notoriously stringent on the size of the file attachments that you can have. Compressing the files will reduce the file size and allow you to cram more files into the message as an attachment.
File Encryption and Protection
Many simple file formats do not provide much of a file protection or security. This provides a method to secure a complete set the files as they can be encrypted and protected using a single password.