Skip to content

TZX (.tzx)

.tzx file signature | application/x-spectrum-tzx

Safe

Magic Bytes

Offset: 0
5A 58 54 61 70 65 21 1A

Sources: Apache Tika

Validation Code

How to validate .tzx files in Python

Python
def is_tzx(file_path: str) -> bool:
    """Check if file is a valid TZX by magic bytes."""
    signature = bytes([0x5A, 0x58, 0x54, 0x61, 0x70, 0x65, 0x21, 0x1A])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .tzx files in Node.js

Node.js
function isTZX(buffer: Buffer): boolean {
  const signature = Buffer.from([0x5A, 0x58, 0x54, 0x61, 0x70, 0x65, 0x21, 0x1A]);
  return buffer.subarray(0, 8).equals(signature);
}

How to validate .tzx files in Go

Go
func IsTZX(data []byte) bool {
    signature := []byte{0x5A, 0x58, 0x54, 0x61, 0x70, 0x65, 0x21, 0x1A}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .tzx file?

A .tzx file is a TZX file.

What are the magic bytes for .tzx files?

The magic bytes for TZX files are 5A 58 54 61 70 65 21 1A at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .tzx file?

To validate a .tzx file, read the first bytes of the file and compare them against the known magic bytes (5A 58 54 61 70 65 21 1A) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .tzx files?

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

Is it safe to open .tzx files?

TZX (.tzx) 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.