EVM stack items are full-width words with limited depth.
LET’S PICTURE IT
A pile of fixed-width cards exposes only its upper portion to common operations.
SEE IT FOR YOURSELF
Watch a stack machine execute a tiny programStep 1 / 4
The program bytes are PUSH1 02, PUSH1 03, ADD, STOP. The program counter begins at byte zero.
The program bytes are PUSH1 02, PUSH1 03, ADD, STOP. The program counter begins at byte zero.PUSH1 reads its next byte as an immediate value and places two on the stack. The next instruction begins at byte two.The next PUSH1 places three above two. Stack order matters for operations that are not commutative.ADD consumes the top two values and pushes five. The next instruction is STOP at byte five; no storage write is implied by ADD.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Use one word width
Each stack item is a 256-bit word. A small integer such as two still occupies one stack position rather than a special smaller stack item.
Read the top consistently
This site writes the stack bottom first and top last. Other references may show the top first, so check the convention before comparing traces.
Respect depth limits
The EVM stack has a maximum depth of 1024 items. Instructions can fail for too few operands or excessive stack growth.
Separate stack from persistent state
The stack is temporary execution state. Pushing an integer does not store it in a contract slot or expose it as a returned output.
Trace the idea
[]
PUSH1 0x02 → [2]
PUSH1 0x03 → [2, 3]
ADD → [5]
Stack examples list the bottom first and the top last. These small traces omit gas and surrounding dispatch unless stated.