Skip to content

GenericAutoCADdrawing file (.dwg)

.dwg file signature | image/vnd.dwg

GenericAutoCADdrawing file

Safe

Magic Bytes

Offset 0
4D 43 30 2E 30

Sources: Apache Tika

All Known Signatures

9 signature variants are documented for .dwg files across multiple sources.

Hex Signature Offset Sources
4D 43 30 2E 30 0 Apache Tika
41 43 31 2E 32 0 Apache Tika
41 43 31 2E 34 30 0 Apache Tika
41 43 31 2E 35 30 0 Apache Tika
41 43 32 2E 31 30 0 Apache Tika
41 43 32 2E 32 31 0 Apache Tika
41 43 32 2E 32 32 0 Apache Tika
41 43 30 30 30 30 0 Apache Tika
41 43 0 Gary Kessler

Extension

.dwg

MIME Type

image/vnd.dwg

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .dwg files in Python

Python
def is_dwg(file_path: str) -> bool:
    """Check if file is a valid DWG by magic bytes."""
    signature = bytes([0x4D, 0x43, 0x30, 0x2E, 0x30])
    with open(file_path, "rb") as f:
        return f.read(5) == signature

How to validate .dwg files in Node.js

Node.js
function isDWG(buffer: Buffer): boolean {
  const signature = Buffer.from([0x4D, 0x43, 0x30, 0x2E, 0x30]);
  return buffer.subarray(0, 5).equals(signature);
}

How to validate .dwg files in Go

Go
func IsDWG(data []byte) bool {
    signature := []byte{0x4D, 0x43, 0x30, 0x2E, 0x30}
    if len(data) < 5 {
        return false
    }
    return bytes.Equal(data[:5], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .dwg file?

A .dwg file is a GenericAutoCADdrawing file file. GenericAutoCADdrawing file

What are the magic bytes for .dwg files?

The magic bytes for GenericAutoCADdrawing file files are 4D 43 30 2E 30 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .dwg file?

To validate a .dwg file, read the first bytes of the file and compare them against the known magic bytes (4D 43 30 2E 30) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .dwg files?

The primary MIME type for .dwg files is image/vnd.dwg.

Is it safe to open .dwg files?

GenericAutoCADdrawing file (.dwg) 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.