Microsoft SQL Server 2000 database magic bytes (.mdf)
.mdf file signature: 00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01 | application/octet-stream
Category: Databases
Microsoft SQL Server 2000 database (MDF) is a file format created and maintained by Microsoft for storing SQL Server database data and schema. It is used with Microsoft SQL Server to manage tables, indexes, stored procedures, and other relational data in server applications. This legacy format dates to SQL Server installations; the file is safe, but database contents should come from trusted sources.
Magic Bytes
Offset 0
00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01
Sources: Gary Kessler
All Known Signatures
2 signature variants are documented for .mdf files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01 | 0 | Gary Kessler |
| 01 0F 00 00 | 0 | Gary Kessler |
Validation Code
How to validate .mdf files in Python
def is_mdf(file_path: str) -> bool:
"""Check if file is a valid MDF by magic bytes."""
signature = bytes([0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x02, 0x00, 0x01])
with open(file_path, "rb") as f:
return f.read(16) == signature
How to validate .mdf files in Node.js
function isMDF(buffer: Buffer): boolean {
const signature = Buffer.from([0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x02, 0x00, 0x01]);
return buffer.subarray(0, 16).equals(signature);
}
How to validate .mdf files in Go
func IsMDF(data []byte) bool {
signature := []byte{0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x02, 0x00, 0x01}
if len(data) < 16 {
return false
}
return bytes.Equal(data[:16], signature)
}
API Endpoint
/api/v1/mdf
curl https://filesignature.org/api/v1/mdf
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .mdf file?
A .mdf file is a Microsoft SQL Server 2000 database. Microsoft SQL Server 2000 database (MDF) is a file format created and maintained by Microsoft for storing SQL Server database data and schema. It is used with Microsoft SQL Server to manage tables, indexes, stored procedures, and other relational data in server applications. This legacy format dates to SQL Server installations; the file is safe, but database contents should come from trusted sources.
What are the magic bytes for .mdf files?
The magic bytes for Microsoft SQL Server 2000 database (.mdf) files are 00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01 at byte offset 0. These bytes identify the file format more reliably than the extension alone.
How do I validate a .mdf file?
To validate a .mdf file, read the first bytes of the file and compare them against the known magic bytes (00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .mdf files?
There is no officially registered MIME type for .mdf files. Systems typically use application/octet-stream as a generic fallback when handling this format.
Is it safe to open .mdf files?
Microsoft SQL Server 2000 database (.mdf) 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.