MATLAB v5 workspace file (.mat)
.mat file signature | application/x-matlab-data
MATLAB v5 workspace file (includes creation timestamp)
Magic Bytes
Offset 0
4D 41 54 4C 41 42
Sources: Apache Tika
All Known Signatures
2 signature variants are documented for .mat files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 4D 41 54 4C 41 42 | 0 | Apache Tika |
| 4D 41 54 4C 41 42 20 35 2E 30 20 4D 41 54 2D 66 69 6C 65 | 0 | Gary Kessler |
Extension
.mat
MIME Type
application/x-matlab-data
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .mat files in Python
def is_mat(file_path: str) -> bool:
"""Check if file is a valid MAT by magic bytes."""
signature = bytes([0x4D, 0x41, 0x54, 0x4C, 0x41, 0x42])
with open(file_path, "rb") as f:
return f.read(6) == signature
How to validate .mat files in Node.js
function isMAT(buffer: Buffer): boolean {
const signature = Buffer.from([0x4D, 0x41, 0x54, 0x4C, 0x41, 0x42]);
return buffer.subarray(0, 6).equals(signature);
}
How to validate .mat files in Go
func IsMAT(data []byte) bool {
signature := []byte{0x4D, 0x41, 0x54, 0x4C, 0x41, 0x42}
if len(data) < 6 {
return false
}
return bytes.Equal(data[:6], signature)
}
API Endpoint
/api/v1/mat
curl https://filesignature.org/api/v1/mat
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .mat file?
A .mat file is a MATLAB v5 workspace file file. MATLAB v5 workspace file (includes creation timestamp)
What are the magic bytes for .mat files?
The magic bytes for MATLAB v5 workspace file files are 4D 41 54 4C 41 42 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .mat file?
To validate a .mat file, read the first bytes of the file and compare them against the known magic bytes (4D 41 54 4C 41 42) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .mat files?
The primary MIME type for .mat files is application/x-matlab-data.
Is it safe to open .mat files?
MATLAB v5 workspace file (.mat) 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.