Skip to content

Windows graphics metafile (.wmf)

.wmf file signature | image/wmf

Windows Metafile (WMF) is a legacy vector graphics file format created by Microsoft for the Windows operating system. It is used for storing and exchanging drawings, clip art, logos, and simple illustrations in applications such as Microsoft Office and legacy desktop publishing tools. WMF is an older format with limited modern use, and files from untrusted sources should be handled cautiously because historical implementations have had security issues.

Safe

Magic Bytes

Offset 0
D7 CD C6 9A

Sources: Wikipedia, Gary Kessler, Neil Harvey FileSignatures

All Known Signatures

3 signature variants are documented for .wmf files across multiple sources.

Hex Signature Offset Sources
D7 CD C6 9A 0 Wikipedia, Gary Kessler, Neil Harvey FileSignatures
01 00 09 00 00 03 0 Apache Tika, Gary Kessler
D7 CD C6 9A 00 00 0 Apache Tika

Extension

.wmf

MIME Type

image/wmf

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .wmf files in Python

Python
def is_wmf(file_path: str) -> bool:
    """Check if file is a valid WMF by magic bytes."""
    signature = bytes([0xD7, 0xCD, 0xC6, 0x9A])
    with open(file_path, "rb") as f:
        return f.read(4) == signature

How to validate .wmf files in Node.js

Node.js
function isWMF(buffer: Buffer): boolean {
  const signature = Buffer.from([0xD7, 0xCD, 0xC6, 0x9A]);
  return buffer.subarray(0, 4).equals(signature);
}

How to validate .wmf files in Go

Go
func IsWMF(data []byte) bool {
    signature := []byte{0xD7, 0xCD, 0xC6, 0x9A}
    if len(data) < 4 {
        return false
    }
    return bytes.Equal(data[:4], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .wmf file?

A .wmf file is a Windows graphics metafile file. Windows Metafile (WMF) is a legacy vector graphics file format created by Microsoft for the Windows operating system. It is used for storing and exchanging drawings, clip art, logos, and simple illustrations in applications such as Microsoft Office and legacy desktop publishing tools. WMF is an older format with limited modern use, and files from untrusted sources should be handled cautiously because historical implementations have had security issues.

What are the magic bytes for .wmf files?

The magic bytes for Windows graphics metafile files are D7 CD C6 9A at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .wmf file?

To validate a .wmf file, read the first bytes of the file and compare them against the known magic bytes (D7 CD C6 9A) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .wmf files?

The primary MIME type for .wmf files is image/wmf.

Is it safe to open .wmf files?

Windows graphics metafile (.wmf) 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.