Macintosh BinHex 4 Compressed Archive (.hqx)
.hqx file signature | application/mac-binhex40
Macintosh BinHex 4 Compressed Archive
Magic Bytes
Offset 11
6D 75 73 74 20 62 65 20 63 6F 6E 76 65 72 74 65 64 20 77 69 74 68 20 42 69 6E 48 65 78
Sources: Apache Tika
All Known Signatures
2 signature variants are documented for .hqx files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 6D 75 73 74 20 62 65 20 63 6F 6E 76 65 72 74 65 64 20 77 69 74 68 20 42 69 6E 48 65 78 | 11 | Apache Tika |
| 28 54 68 69 73 20 66 69 6C 65 20 6D 75 73 74 20 62 65 20 63 6F 6E 76 65 72 74 65 64 20 77 69 74 68 20 42 69 6E 48 65 78 20 | 0 | Gary Kessler |
Extension
.hqx
MIME Type
application/mac-binhex40
Byte Offset
11
Risk Level
Safe
Validation Code
How to validate .hqx files in Python
def is_hqx(file_path: str) -> bool:
"""Check if file is a valid HQX by magic bytes."""
signature = bytes([0x6D, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6F, 0x6E, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x42, 0x69, 0x6E, 0x48, 0x65, 0x78])
with open(file_path, "rb") as f:
return f.read(29) == signature
How to validate .hqx files in Node.js
function isHQX(buffer: Buffer): boolean {
const signature = Buffer.from([0x6D, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6F, 0x6E, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x42, 0x69, 0x6E, 0x48, 0x65, 0x78]);
return buffer.subarray(0, 29).equals(signature);
}
How to validate .hqx files in Go
func IsHQX(data []byte) bool {
signature := []byte{0x6D, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6F, 0x6E, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x42, 0x69, 0x6E, 0x48, 0x65, 0x78}
if len(data) < 29 {
return false
}
return bytes.Equal(data[:29], signature)
}
API Endpoint
/api/v1/hqx
curl https://filesignature.org/api/v1/hqx
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .hqx file?
A .hqx file is a Macintosh BinHex 4 Compressed Archive file. Macintosh BinHex 4 Compressed Archive
What are the magic bytes for .hqx files?
The magic bytes for Macintosh BinHex 4 Compressed Archive files are 6D 75 73 74 20 62 65 20 63 6F 6E 76 65 72 74 65 64 20 77 69 74 68 20 42 69 6E 48 65 78 at byte offset 11. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .hqx file?
To validate a .hqx file, read the first bytes of the file and compare them against the known magic bytes (6D 75 73 74 20 62 65 20 63 6F 6E 76 65 72 74 65 64 20 77 69 74 68 20 42 69 6E 48 65 78) at offset 11. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .hqx files?
The primary MIME type for .hqx files is application/mac-binhex40.
Is it safe to open .hqx files?
Macintosh BinHex 4 Compressed Archive (.hqx) 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.