What is a TAR file?

TAR joins many files and folders into one file but does not compress them. It is usually compressed afterwards (.tar.gz, .tar.bz2, .tar.xz). It is common on Linux and macOS and for the source code of programs.

Drop your file here

or select file

Images, video, audio, documents, data, archives, fonts and more.

About TAR file:

01TAR at a glance

Full name
Tape archive
Type
Joins many files and folders into one file, without compressing them
Extension
.tar (compressed: .tar.gz, .tgz, .tar.bz2, .tar.xz)
MIME type
application/x-tar
First bytes (hex)
None fixed. In POSIX tar the text ustar sits at byte 257
Appeared
January 1979, in Unix
Block size
512 bytes

02What is a TAR file

TAR is short for tape archive. The command came to Unix in January 1979 to write files to tape, and the format is still everywhere on Linux and macOS. A TAR file only joins files: it holds their bytes uncompressed, one after another, each with a 512-byte header that carries the name, size and date.

To make it smaller, the whole TAR is compressed afterwards with gzip, bzip2 or xz. The compressor's name is added to the file name: .tar.gz (also .tgz), .tar.bz2 (.tbz2) and .tar.xz (.txz). That is why tar and compression are two separate steps on Linux.

There are several flavours: the POSIX formats ustar and pax, and the GNU tar format. The first, original format stores a name in 100 bytes, so it cannot keep longer paths; ustar allows up to 255 characters using a prefix field. This tool checks the checksum in every header and reads long names from GNU and pax extensions.

TAR also keeps paths and links exactly as they were. That is a security point: a file named ../../x or a link to /etc can write outside the folder you unpack to. This tool warns about both.

03Good and bad sides

Good

  • Keeps the folder structure, names and dates exactly
  • Standard on Linux and macOS and in software releases
  • Combines with any compressor

Bad

  • Does not compress by itself
  • No password
  • Windows opens it only in Windows 11 (since late 2023) or with a program

04Best for

  • Linux software, backups, servers

    The normal choice, almost always compressed as .tar.gz or .tar.xz.

  • Keeping folder structure exactly

    Keeps names, dates and the folder structure as they are.

05How to open it

Linux, macOS
Terminal: tar -xf file.tar
Windows 11
File Explorer opens TAR and compressed TAR since the October 2023 update
Older Windows
7-Zip or WinRAR

06Convert and compare

Related formats: GZ, ZIP, XZ, BZ2

Sources