What is the SMALI file format?
.smali files contain human-readable Dalvik or ART bytecode - the assembly language representation of Android application code. The names smali and baksmali are Icelandic words for assembler and disassembler; the tools were created by Ben Gruver (JesusFreke) in 2010 and are now maintained by Google.
When an Android .apk is unpacked using apktool or baksmali, each compiled class inside the .dex file is extracted as a separate .smali file. The syntax declares class metadata with .class, .super, and .implements directives; fields with .field; and methods inside .method....end method blocks. Individual Dalvik opcodes (invoke-virtual, move-result, return-void, and others) operate on named registers (v0, v1, p0, etc.).
.smali files are used primarily in Android reverse engineering, security research, and CTF (Capture The Flag) challenges. A typical workflow is: unpack an APK with apktool d, edit the .smali sources to patch behavior, then repackage with apktool b and re-sign. They are an intermediate disassembly artifact - regular Android users never encounter raw .smali files.
Each .smali file corresponds to exactly one class, including anonymous inner classes (which appear as separate files). Available opcodes vary with Android API level, reflected in the .dex format version (e.g., 035 for Android 5, 039 for Android 12+).
Security & safety
RISK: MEDIUM.smali files themselves are plain text and cannot harm your system when viewed in an editor. Risk is contextual: 1. If you disassembled a suspicious APK, the .smali files reveal its behavior - look for obfuscated strings, dynamic code loading (DexClassLoader), and network calls to suspicious hosts. 2. Patching APKs and re-signing them for distribution may violate app terms of service and in some jurisdictions copyright law. Personal use is generally accepted; redistribution is not. 3. Downloading .smali "patches" from unknown sources - treat like executable code; review before applying.
Format details
in a nutshellPrograms that open SMALI files
Technical details
deep spec| Developer | Ben Gruver (JesusFreke), original author; now Google-maintained (baksmali/smali v3+) |
| File type | Plain-text human-readable Dalvik/ART bytecode assembly |
| Encoding | UTF-8 |
| Name etymology | smali and baksmali are Icelandic for assembler and disassembler |
| One file per class | Each `.smali` file maps to exactly one Java or Kotlin class, including anonymous inner classes |
| Compiled equivalent | `.dex` (Dalvik Executable) - `.smali` is the disassembled human-readable representation |
| Typical size | 1 KB - 200 KB per file; complex Android apps produce thousands of `.smali` files |
| Register syntax | Local registers: `v0`, `v1`, ...; parameter registers: `p0`, `p1`, ... (`p0` is `this` in instance methods) |
| Opcode versioning | Tied to `.dex` format version: 035 (Android 5-6), 037 (Android 7), 038 (Android 8-11), 039 (Android 12+) |
| Standard workflow | APK → `baksmali` disassemble → edit `.smali` → `smali` assemble → repackaged APK (re-signing required) |
| Tool integration | `apktool` uses `smali`/`baksmali` internally for APK disassembly and reassembly |
| Primary use cases | Android reverse engineering, app patching, security vulnerability research, CTF challenges |
| Released | 2010 (baksmali 1.0 by Ben Gruver/JesusFreke) |
| Latest version | smali/baksmali 3.x (Google-maintained as of 2024) |
| Specification | github.com |
SMALI conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about SMALI files.