Skip to content

Dalvik executable file (.dex)

.dex file signature | application/x-dex

Dalvik executable (DEX) is the bytecode file format used by the Android runtime, originally created by Google and maintained as part of the Android platform. It stores compiled application code for Android apps and is used by the system to install and run software, including code distributed in APK packages and converted from other Java-based formats. DEX files are generally safe, though as executable code they should be obtained from trusted sources and may be analyzed for malicious behavior.

Safe

Magic Bytes

Offset 0
64 65 78 0A

Sources: Apache Tika, Gary Kessler

All Known Signatures

2 signature variants are documented for .dex files across multiple sources.

Hex Signature Offset Sources
64 65 78 0A 0 Apache Tika, Gary Kessler
64 65 78 0A 30 33 35 00 0 Wikipedia

Extension

.dex

MIME Type

application/x-dex

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .dex files in Python

Python
def is_dex(file_path: str) -> bool:
    """Check if file is a valid DEX by magic bytes."""
    signature = bytes([0x64, 0x65, 0x78, 0x0A])
    with open(file_path, "rb") as f:
        return f.read(4) == signature

How to validate .dex files in Node.js

Node.js
function isDEX(buffer: Buffer): boolean {
  const signature = Buffer.from([0x64, 0x65, 0x78, 0x0A]);
  return buffer.subarray(0, 4).equals(signature);
}

How to validate .dex files in Go

Go
func IsDEX(data []byte) bool {
    signature := []byte{0x64, 0x65, 0x78, 0x0A}
    if len(data) < 4 {
        return false
    }
    return bytes.Equal(data[:4], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .dex file?

A .dex file is a Dalvik executable file file. Dalvik executable (DEX) is the bytecode file format used by the Android runtime, originally created by Google and maintained as part of the Android platform. It stores compiled application code for Android apps and is used by the system to install and run software, including code distributed in APK packages and converted from other Java-based formats. DEX files are generally safe, though as executable code they should be obtained from trusted sources and may be analyzed for malicious behavior.

What are the magic bytes for .dex files?

The magic bytes for Dalvik executable file files are 64 65 78 0A at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .dex file?

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

What is the MIME type for .dex files?

The primary MIME type for .dex files is application/x-dex.

Is it safe to open .dex files?

Dalvik executable file (.dex) 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.