Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A DEX file is Android’s compact binary format for holding class definitions and the data associated with them. To read one, start with its header and indexed tables, then follow offsets into the data area; code items hold Dalvik instructions, while the map list inventories the file’s structures. Most values are little-endian, strings use modified UTF-8, and selected quantities use LEB128 encodings. Version 041 changes the model to a container for multiple logical DEX files, but the Android Open Source Project describes that support as experimental in Android 16 and says not to use it in production.

What a DEX file contains

The Android Open Source Project describes .dex files as holding a set of class definitions and their associated adjunct data. Android documentation also characterizes DEX as a transport format for Dalvik bytecode. It is useful to distinguish the file’s overall container and metadata from the instructions encoded inside its code items: the tables help identify and relate program elements, while the instructions describe operations executed by the runtime.

A DEX file is organized around a header, identifier lists, a data area, and a map list. The header describes the file’s identity, size, endianness, section counts and offsets, and data-related fields. The indexed lists cover strings, types, prototypes, fields, methods, and class definitions. The data area holds supporting structures such as class data, code, and string data.

The map list provides an inventory of the file’s contents and their offsets. Its entries are ordered by initial offset and do not overlap, giving a parser a way to identify the kinds of items present and where their sections begin.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the data is represented

Byte order and variable-length values

The standard representation is little-endian. Selected variable-length 32-bit quantities use LEB128-family encodings, so a parser cannot assume every field occupies a fixed number of bytes; it must decode these values according to their encoding.

Strings

DEX string data uses modified UTF-8 (MUTF-8). The specification notes that this encoding is closer to CESU-8 than to ordinary UTF-8, so treating every string payload as standard UTF-8 can misread data.

Register-based instructions

Dalvik bytecode uses a register-based machine model with fixed-size method frames. A 32-bit integer or floating-point value occupies a register, while a 64-bit value occupies an adjacent register pair. The instruction-formats reference expresses instruction formats in 16-bit code units and is intended to be read alongside the bytecode reference: DEX instruction formats.

Header sizes and version changes

Header layout and supported features depend on the DEX version. The specification documents a 112-byte header for versions 040 and earlier, while version 041 has a 120-byte header with additional container-size and header-offset fields.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Version Documented change
038 Adds invoke-polymorphic, invoke-custom, and method-handle data.
039 Adds const-method-handle and const-method-type; hidden API information applies to boot-class-path DEX files.
040 Expands the set of allowed simple-name characters.
041 Introduces a container format that can combine multiple logical DEX files in one physical file. It permits references to later shared data and uses offsets relative to the physical file.

The AOSP specification describes version 041 support as experimental for Android 16 and says it “shouldn’t be used for production code.” That qualification is specific to the page’s Android 16 wording; check the current specification before relying on later platform support.

How to read or parse a DEX file

  1. Check the magic and version. Confirm that the file begins with a version-appropriate DEX magic value before interpreting its fields. The version determines which header layout and format rules apply.
  2. Read the header before following offsets. Use its size, byte-order information, counts, and offsets to locate the indexed lists and data. For version 041, account for the larger header and container fields rather than applying the earlier layout.
  3. Resolve identifiers through their indexed tables. Examine the string, type, prototype, field, method, and class-definition lists to understand references. Decode string data as MUTF-8 and selected variable-length values as LEB128-family encodings.
  4. Use the map list to inventory sections. Follow its item types and offsets to locate structures in the data area, then inspect class data and code items as needed.
  5. Decode code in 16-bit code units. Interpret the instruction formats and register operands using the instruction-format and bytecode references together; do not confuse byte offsets in the file with code-unit positions in an instruction stream.
  6. Validate structure and integrity. Check the file-size consistency and integrity fields, then verify that offsets, section sizes, and structural relationships satisfy the applicable format constraints.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What DEX validation checks establish

The AOSP DEX constraints distinguish syntax and semantic validity and state that a runtime is required to support only valid .dex files. The listed checks include a version-appropriate magic value, file-size consistency, and two integrity fields:

  • Adler-32 checksum: calculated over file contents excluding the magic and checksum fields.
  • SHA-1 signature: calculated over contents excluding the magic, checksum, and signature fields.

Passing these checks does not prove that a file is safe, trustworthy, or from a particular publisher. They address integrity and format validity, not the behavior of its code or the identity of its origin.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.