File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Data
  • Structured text
  • Binary serialisation
  • Databases
  • Scientific
  • Geospatial
  • Machine learning
  • Messages & calendars
  • Compression
  • Archives
  1. Home
  2. Data
  3. Archives
  4. TAR
.TAR
  • Overview
  • Header block
  • Type flags
  • Pax extensions
  • GNU extensions
  • End of archive

.TAR

Tape archive

Introduction

Tar bundles files and folders into one file, keeping each file’s name, permissions, owner and modification time. It began in Version 7 Unix in 1979 as a way to write files to magnetic tape, which is why everything in it comes in 512-byte blocks. POSIX.1-1988 standardised it as the ustar format, and POSIX.1-2001 extended it as the pax format.

Tar does not compress. A tar file is usually compressed as a whole afterwards, giving .tar.gz or .tgz (gzip), .tar.xz (xz) and .tar.bz2 (bzip2). Tar is also found inside other formats: Debian packages hold their files in tar archives, and container images are made of tar layers.

Software

  • GNU tar (Linux, macOS, Windows)
  • bsdtar and libarchive; bsdtar is the tar command on macOS and in Windows 10 and later
  • 7-Zip (Windows)
  • WinRAR (Windows)
  • PeaZip (Windows, macOS, Linux)
  • Archive Utility, built into macOS
  • Python, whose tarfile module reads and writes tar

Structure

A tar file is a sequence of 512-byte blocks. Each file in the archive is a header block describing it, followed by its contents, padded with zeros to a whole number of blocks. A folder, a link or a device is a header with no contents; the header’s type flag says which it is. Two blocks of zeros end the archive.

  1. 0Header name, mode, owner, size, time, checksum, type512 bytes
  2. 512File data the file’s bytes, padded with zeros to a multiple of 512size rounded up
  3. …Next header and its data, for each further filerepeated
  4. …End of archive two blocks of zeros, then padding to a whole record1024 bytes or more
A tar archive: a header and data for each file, then two zero blocks.

There is no index. To list an archive, a reader reads each header, uses the size in it to skip over the file’s data, and reads the next header. Long names, large files and other details the original header cannot hold are carried in extra headers before the file’s own: the pax extensions of POSIX, or the older GNU extensions.

VariantBytes 257 to 264Notes
Version 7zerosthe original 1979 header, with no owner names and no prefix
ustarustar\0 00POSIX.1-1988: owner names, device numbers and a 155-byte name prefix
GNUustar and two spaces and \0GNU tar’s own layout, with long names and sparse files
paxustar\0 00ustar headers plus extended headers of key and value records
© 2026 fileformats.org About Contact Made by Lewpen