Skip to content

Tape Archive file (.tar)

.tar file signature | application/x-tar

Tape Archive (tar) is a file archive format originally developed for Unix systems by AT&T Bell Labs and maintained through widely implemented specifications and tools such as POSIX and GNU tar. It is used to bundle multiple files and directories into a single archive for software distribution, backups, and data transfer, often in combination with compression tools. The format is generally safe, though archives from untrusted sources should still be inspected for path traversal or overwrite risks when extracted.

Safe

Magic Bytes

Offset 257
75 73 74 61 72 00

Sources: Apache Tika

All Known Signatures

5 signature variants are documented for .tar files across multiple sources.

Hex Signature Offset Sources
75 73 74 61 72 00 257 Apache Tika
75 73 74 61 72 00 30 30 257 Wikipedia
75 73 74 61 72 20 20 00 257 Wikipedia
75 73 74 61 72 257 Gary Kessler
75 73 74 61 72 0 Neil Harvey FileSignatures

Extension

.tar

MIME Type

application/x-tar

Byte Offset

257

Risk Level

Safe

Validation Code

How to validate .tar files in Python

Python
def is_tar(file_path: str) -> bool:
    """Check if file is a valid TAR by magic bytes at offset 257."""
    signature = bytes([0x75, 0x73, 0x74, 0x61, 0x72, 0x00])
    with open(file_path, "rb") as f:
        f.seek(257)
        return f.read(6) == signature

How to validate .tar files in Node.js

Node.js
function isTAR(buffer: Buffer): boolean {
  const signature = Buffer.from([0x75, 0x73, 0x74, 0x61, 0x72, 0x00]);
  if (buffer.length < 263) return false;
  return buffer.subarray(257, 263).equals(signature);
}

How to validate .tar files in Go

Go
func IsTAR(data []byte) bool {
    signature := []byte{0x75, 0x73, 0x74, 0x61, 0x72, 0x00}
    if len(data) < 263 {
        return false
    }
    return bytes.Equal(data[257:263], signature)
}

API Endpoint

GET /api/v1/tar
curl https://filesignature.org/api/v1/tar

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .tar file?

A .tar file is a Tape Archive file file. Tape Archive (tar) is a file archive format originally developed for Unix systems by AT&T Bell Labs and maintained through widely implemented specifications and tools such as POSIX and GNU tar. It is used to bundle multiple files and directories into a single archive for software distribution, backups, and data transfer, often in combination with compression tools. The format is generally safe, though archives from untrusted sources should still be inspected for path traversal or overwrite risks when extracted.

What are the magic bytes for .tar files?

The magic bytes for Tape Archive file files are 75 73 74 61 72 00 at byte offset 257. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .tar file?

To validate a .tar file, read the first bytes of the file and compare them against the known magic bytes (75 73 74 61 72 00) at offset 257. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .tar files?

The primary MIME type for .tar files is application/x-tar.

Is it safe to open .tar files?

Tape Archive file (.tar) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.