7Z (.7z)
.7z file signature | application/x-7z-compressed
7Z is a compressed archive file format developed by Igor Pavlov and maintained through the 7-Zip project. It is used to store one or more files in a single container for backup, distribution, and general file compression, and is supported by 7-Zip and many other archiving utilities. It is generally safe to handle, though archive contents should still be reviewed before extraction because compressed files can contain unwanted or malicious payloads.
Magic Bytes
Offset 0
37 7A
Sources: Apache Tika
Extension
.7z
MIME Type
application/x-7z-compressed
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .7z files in Python
def is_7z(file_path: str) -> bool:
"""Check if file is a valid 7Z by magic bytes."""
signature = bytes([0x37, 0x7A])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .7z files in Node.js
function is7Z(buffer: Buffer): boolean {
const signature = Buffer.from([0x37, 0x7A]);
return buffer.subarray(0, 2).equals(signature);
}
How to validate .7z files in Go
func Is7Z(data []byte) bool {
signature := []byte{0x37, 0x7A}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
/api/v1/7z
curl https://filesignature.org/api/v1/7z
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .7z file?
A .7z file is identified by the magic bytes 37 7A at byte offset 0. 7Z is a compressed archive file format developed by Igor Pavlov and maintained through the 7-Zip project. It is used to store one or more files in a single container for backup, distribution, and general file compression, and is supported by 7-Zip and many other archiving utilities. It is generally safe to handle, though archive contents should still be reviewed before extraction because compressed files can contain unwanted or malicious payloads.
What are the magic bytes for .7z files?
The magic bytes for 7Z files are 37 7A at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .7z file?
To validate a .7z file, read the first bytes of the file and compare them against the known magic bytes (37 7A) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .7z files?
The primary MIME type for .7z files is application/x-7z-compressed.
Is it safe to open .7z files?
7Z (.7z) 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.