Solidity to Opcodes
Compile Solidity code explicitly to view its EVM Opcodes, Bytecode, and execution trace.
Compiles in a Web Worker. Hover over opcodes to see the Execution Stack & Memory.
Solidity Source
EVM Opcodes
Understanding EVM Opcodes
Every Solidity smart contract compiles down to EVM bytecode — a sequence of low-level instructions called opcodes. Understanding opcodes is essential for gas optimization, security auditing, and debugging smart contracts.
What Are Opcodes?
Opcodes (operation codes) are the EVM's instruction set. Each opcode is one byte (0x00-0xFF) representing a specific operation. The EVM processes them sequentially, manipulating a stack, memory, and storage. Common categories include:
- Arithmetic: ADD, SUB, MUL, DIV, MOD
- Stack: POP, PUSH, DUP, SWAP
- Memory: MLOAD, MSTORE, MSTORE8
- Storage: SLOAD, SSTORE (expensive — 2100/20000 gas)
- Flow: JUMP, JUMPI, JUMPDEST, PC
- Environment: CALLER, CALLVALUE, CALLDATALOAD
Why Read Opcodes?
- Gas optimization: Identify expensive SLOAD/SSTORE operations
- Security audits: Detect malicious code hidden in verified contracts
- Debugging: Understand exactly what your Solidity compiles to
- Reverse engineering: Analyze contracts without source code
Frequently Asked Questions
▶ What is the difference between bytecode and opcodes?
Bytecode is the raw hexadecimal representation that the EVM executes. Opcodes are the human-readable mnemonics for each instruction. For example, the bytecode 0x01 corresponds to the ADD opcode. This tool shows both views side by side.
▶ Which Solidity compiler versions are supported?
This tool supports Solidity compiler versions from 0.5.x through 0.8.26. The compiler runs entirely in your browser via a Web Worker — no code is sent to any server. Select your desired version from the dropdown.
▶ Can I use this tool for production smart contract auditing?
This tool is great for learning, development, and initial analysis. For production audits, use dedicated tools like Echidna, Mythril, Slither, or Halmos in combination with opcode review. Always rely on multiple tools for security-critical work.
▶ Why does hovering over opcodes show stack and memory?
This tool generates an execution trace showing the EVM stack and memory state at each opcode during deployment. This helps you understand how the EVM processes your contract and where gas is being consumed.
About the Solidity To Opcodes
Every Solidity function compiles down to EVM opcodes - and the gap between what you wrote and what executes is where gas costs and security bugs live. Reading the opcodes shows which functions actually cost 21k gas, where the compiler inserted expensive memory operations, and what a constructor or modifier really does.
Paste Solidity source and compile to EVM assembly and bytecode with selectable solc versions. Everything runs in your browser - no code upload. To inspect the reverse direction, decode deployed bytecode with a disassembler or decompiler and verify it against your source.
How to use
- Paste or type your Solidity contract.
- Choose the solc compiler version that matches your target.
- Compile - the opcode listing appears with the bytecode.
- Inspect the assembly per function to understand gas and logic.
Frequently Asked Questions
Can I convert bytecode back to Solidity source? ▾
Not exactly - bytecode does not preserve source details like names and comments. You can disassemble bytecode to opcodes and use a decompiler for pseudo-source, then verify behavior against your original source by comparing compiled outputs.
Which solc version should I pick? ▾
Match the version your project pins in its build config (foundry.toml, hardhat.config). Comparing the same source under different versions is also useful for spotting behavior or gas changes across compiler releases.
Is this tool free to use? ▾
Yes! This tool is 100% free. No signup, no credit card, no limits. It's part of Formatho's privacy-first developer toolkit.
Is my data safe? Does this tool send data to a server? ▾
Absolutely. This tool runs entirely in your browser. Your data never leaves your device. Zero server-side processing, zero tracking.