Tape Archive file (.tar)
.tar file signature | application/x-tar
Tape Archive file (http://www.mkssoftware.com/docs/man4/tar.4.asp)
Magic Bytes
Offset 257
75 73 74 61 72 00
Sources: Apache Tika
All Known Signatures
4 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 75 73 74 61 72 20 20 00 | 257 | Wikipedia |
| 25 10 BE FF E7 73 74 61 72 | 0 | 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
def is_tar(file_path: str) -> bool:
"""Check if file is a valid TAR by magic bytes."""
signature = bytes([0x75, 0x73, 0x74, 0x61, 0x72, 0x00])
with open(file_path, "rb") as f:
return f.read(6) == signature
How to validate .tar files in Node.js
function isTAR(buffer: Buffer): boolean {
const signature = Buffer.from([0x75, 0x73, 0x74, 0x61, 0x72, 0x00]);
return buffer.subarray(0, 6).equals(signature);
}
How to validate .tar files in Go
func IsTAR(data []byte) bool {
signature := []byte{0x75, 0x73, 0x74, 0x61, 0x72, 0x00}
if len(data) < 6 {
return false
}
return bytes.Equal(data[:6], signature)
}
API Endpoint
/api/v1/tar
curl https://filesignature.org/api/v1/tar
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .tar file?
A .tar file is a Tape Archive file file. Tape Archive file (http://www.mkssoftware.com/docs/man4/tar.4.asp)
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.