Skip to content

Z (.z)

.z file signature | application/x-compress

Z is a legacy compressed file format associated with the Unix compress utility, originally developed at Bell Labs and later maintained through Unix-compatible implementations. It was used to reduce file size for software distributions, archived data, and network transfers, especially on older Unix systems and in early internet file exchanges. The format is now largely obsolete, and although it is generally safe to open, some modern tools handle it less reliably than current compression formats.

Safe

Magic Bytes

Offset 0
1F 9D

Sources: Apache Tika, Wikipedia

All Known Signatures

2 signature variants are documented for .z files across multiple sources.

Hex Signature Offset Sources
1F 9D 0 Apache Tika, Wikipedia
1F A0 0 Wikipedia

Extension

.z

MIME Type

application/x-compress

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .z files in Python

Python
def is_z(file_path: str) -> bool:
    """Check if file is a valid Z by magic bytes."""
    signature = bytes([0x1F, 0x9D])
    with open(file_path, "rb") as f:
        return f.read(2) == signature

How to validate .z files in Node.js

Node.js
function isZ(buffer: Buffer): boolean {
  const signature = Buffer.from([0x1F, 0x9D]);
  return buffer.subarray(0, 2).equals(signature);
}

How to validate .z files in Go

Go
func IsZ(data []byte) bool {
    signature := []byte{0x1F, 0x9D}
    if len(data) < 2 {
        return false
    }
    return bytes.Equal(data[:2], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .z file?

A .z file is identified by the magic bytes 1F 9D at byte offset 0. Z is a legacy compressed file format associated with the Unix compress utility, originally developed at Bell Labs and later maintained through Unix-compatible implementations. It was used to reduce file size for software distributions, archived data, and network transfers, especially on older Unix systems and in early internet file exchanges. The format is now largely obsolete, and although it is generally safe to open, some modern tools handle it less reliably than current compression formats.

What are the magic bytes for .z files?

The magic bytes for Z files are 1F 9D at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .z file?

To validate a .z file, read the first bytes of the file and compare them against the known magic bytes (1F 9D) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .z files?

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

Is it safe to open .z files?

Z (.z) 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.