Skip to content

LZ (.lz)

.lz file signature | application/x-lzip

LZ is a compressed file format used by lzip, created and maintained by the lzip project. It is used for lossless data compression and decompression in software distribution, backup archives, and file transfer workflows, often through command-line utilities and compatible decompression tools. The format is generally safe to open, though as with any compressed file it may expand to a large size; it is not a legacy or obsolete format.

Safe

Magic Bytes

Offset 0
4C 5A 49 50

Sources: Apache Tika, Wikipedia

Extension

.lz

MIME Type

application/x-lzip

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .lz files in Python

Python
def is_lz(file_path: str) -> bool:
    """Check if file is a valid LZ by magic bytes."""
    signature = bytes([0x4C, 0x5A, 0x49, 0x50])
    with open(file_path, "rb") as f:
        return f.read(4) == signature

How to validate .lz files in Node.js

Node.js
function isLZ(buffer: Buffer): boolean {
  const signature = Buffer.from([0x4C, 0x5A, 0x49, 0x50]);
  return buffer.subarray(0, 4).equals(signature);
}

How to validate .lz files in Go

Go
func IsLZ(data []byte) bool {
    signature := []byte{0x4C, 0x5A, 0x49, 0x50}
    if len(data) < 4 {
        return false
    }
    return bytes.Equal(data[:4], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .lz file?

A .lz file is identified by the magic bytes 4C 5A 49 50 at byte offset 0. LZ is a compressed file format used by lzip, created and maintained by the lzip project. It is used for lossless data compression and decompression in software distribution, backup archives, and file transfer workflows, often through command-line utilities and compatible decompression tools. The format is generally safe to open, though as with any compressed file it may expand to a large size; it is not a legacy or obsolete format.

What are the magic bytes for .lz files?

The magic bytes for LZ files are 4C 5A 49 50 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .lz file?

To validate a .lz file, read the first bytes of the file and compare them against the known magic bytes (4C 5A 49 50) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .lz files?

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

Is it safe to open .lz files?

LZ (.lz) 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.