Skip to content

Microsoft SQL Server 2000 database (.mdf)

.mdf file signature | application/octet-stream

Microsoft SQL Server 2000 database

Safe

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

Extension

.mdf

MIME Type

application/octet-stream

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .mdf files in Python

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

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

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

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .mdf file?

A .mdf file is a Microsoft SQL Server 2000 database file. Microsoft SQL Server 2000 database

What are the magic bytes for .mdf files?

The magic bytes for Microsoft SQL Server 2000 database files are 00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

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.