What’s The Difference Between Tar and Zip?


When you’re not tech-savvy, it’s difficult to understand the nuances between all these terms. Even if I’m used to it as a system administrator and web developer, I understand this problem, as I also often face unfamiliar terms and abbreviations.
Anyway, in this article I will explain the difference between Zip and Tar file formats.

The main difference between a Zip and a Tar file is that the Tar file is not compressed. Both are a convenient way to pack files together, but the tar command require an additional step to add compression. Generally by using another program like Gzip or Bzip2.

That’s it for the short answer, but keep reading as you’ll also discover some cool things about these formats and how to use them.

The Zip Format

What is a Zip File?

ZIP is an archive file format that supports lossless data compression. A ZIP file may contain one or more files or directories that may have been compressed.

Wikipedia

So, if we skip the complex words for now, a Zip file is an easy way to store or transfer several files in one. By creating a Zip file, data is compressed, which means it takes less space on your hard drive.

The Zip format has been around for a long time, as its first release was announced in 1989.

How to Create a Zip File?

On most operating systems, the Zip format is available by default. You probably have an option to create a Zip file easily.

  • On Windows, do a right-click on a file or folder and click on “Send To” > “Compressed (zipped) folder”
  • On Linux, use the command line: “zip -r <file.zip> <folder>”
  • On macOS, do a control-click and choose “Compress” in the menu

In general, other tools are used to create Zip files. For example, WinRAR or 7Zip are available on any platform.

How to Open a Zip File?

On any operating system, zip file can be opened natively with a native tool. Just double-click on a file to see its content and extract the files.

If you installed a tool like WinRAR or 7Zip on your computer, it has probably replaced the default tool automatically. When you double-click on a Zip file, it will open it instead of the default one.

What is Zip file Used For?

As a whole, zip files are really convenient to pack and compress several files in one and transfer them to someone else. They also take less disk space and transfers are faster when the files are zipped.

Originally, they were probably created mostly to save space on disk (we were still on floppy disk in 1989!). Then the Zip format has gain interest with the beginning of the Internet (when Internet usage wasn’t unlimited), and now we keep using them for convenience.

The Zip file format is also really useful for backups. When you copy almost your entire hard drive to another location, it can save a huge amount of disk space by zipping it first. It will also reduce the impact on the local network.

Does Zip File Affect Quality?

As a general rule, zipping a file is a lossless compression. That’s to say there is no effect on the quality of the files included in the Zip archive. It works by skipping the duplicate content in the original files, not by reducing the quality.

So don’t worry, you can send or store HD images in a Zip file without losing any pixel. That’s the main power of this format, there is no downside except the time to create the zip file.
When I started using this format it was a mess because people had no idea what it was and how to open the file, but it’s now pretty common and all operating systems have a tool to make this easier.

The Tar Format

What is a Tar File?

In computing, tar is a computer software utility for collecting many files into one archive file, often referred to as a tarball, for distribution or backup purposes.

Wikipedia

Ok, this is more the definition of the tool than the file format but I think it’s good enough.

A Tar file is an archive file, created with the tar command, a Linux tool to pack files together. It’s used to transfer or store several files in one.

Does Tar Reduce File Size?

By default, files packed in a tar file are not compressed, a tarball is just an archive without compression. An additional step is required to compress files on Linux: tools like Gzip or Bzip2 have to be used to compress the archive.

So, it’s rare to use only tar files. You’ll often find with tar.gz format (Gzip) or tar.bz2 (Bzip2), as it’s almost the same command to create a tar file or a compressed tar file.

How to Create a Tar File?

Tar is mainly used on Unix based operating systems. The tar command is available by default, and can be used like this:
tar -cvf <file.tar> <folder>

But on most distribution, a graphical tool is available to do the same thing.

By the way, Tar files are less common on Windows, but tools like 7zip can create them too. On Windows, right-click on a folder and choose 7zip > Add to archive. Then choose “tar” in the file format dropdown.

How to Open a Tar File?

Opening a tar file should be handled natively by your operating system. A double click on a file will open it with the default tool.

On Linux, you can extract files from a tar with almost the same command as previously:
tar -xvf file.tar
X stands for “eXtract” and C is used to “Create” a tar file.

Differences between Zip and Tar

Content

The main difference between Zip and Tar is that Tar file are just a common way to pack files together, without compression, while a Zip file use a lossless compression algorithm to reduce the total size of the files.

Tar is generally the first step of a compression process. Files are packed together and then are compressed with Gzip or Bzip2.

Operating systems

This difference tends to diminish in the last decade, but Zip files are more used on Windows systems, while Tar files and their variations (tar.gz and tar.bz2) are mostly used on Linux.

Compression level

The zip format compress files to save disk space and reduce transfer duration, while tar are just a convenient way to pack several files together.
Again, using tar without compression is rare. It’s generally only one step.

ZipTar
CompressionLossless compressionNo compression
Operating systemWindowsLinux
UsageStorage and file transferStorage and file transfer after compression with Gzip or Bzip2
Zip vs Tar

Patrick FROMAGET

I am very curious and I love to learn about all types of subjects. Thanks to my experience on the web, I share my discoveries with you on this site :)

Recent Posts