---
eip: 3855
label: EIP-3855
title: PUSH0 instruction
status: Final
type: Standards Track
category: Core
created: 2021-02-19
official: https://eips.ethereum.org/EIPS/eip-3855
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3855.md
canonical: https://eips.huatuo.xyz/eip-3855/
lang: en
tldr: Adds the PUSH0 opcode (0x5f), which pushes a zero onto the stack for 2 gas in one byte, making contracts smaller and cheaper than with PUSH1 0.
tags: [evm, opcode, gas, core, shanghai]
---

# EIP-3855: PUSH0 instruction

> Introduce a new instruction which pushes the constant value 0 onto the stack

**TL;DR:** Adds the PUSH0 opcode (0x5f), which pushes a zero onto the stack for 2 gas in one byte, making contracts smaller and cheaper than with PUSH1 0.

## What problem does it solve?

Zero is the most common constant in EVM code: memory offsets, return-data sizes in `CALL`, empty values, default arguments. Before this EIP the only honest way to push it was `PUSH1 0x00`, which costs 3 gas and takes two bytes of bytecode (and every deployed byte costs 200 gas).

Because that felt wasteful, compilers and hand-optimisers used tricks such as `RETURNDATASIZE`, `CALLVALUE` or `MSIZE`, which happen to return zero in some contexts. Those tricks are fragile: if a future upgrade changes when such an opcode returns zero, contracts that depend on it may break, and core developers become reluctant to change those opcodes at all.

The authors measured that about 11.5 % of all executed `PUSH*` instructions on Mainnet pushed zero, so a dedicated instruction pays off broadly.

## How it works

- New opcode `PUSH0` at `0x5f`, right before `PUSH1` (`0x60`), so it sits in the same contiguous `PUSH` range.
- No immediate data, pops nothing, pushes one item with value `0`.
- Costs 2 gas (the `base` tier, same as `ADDRESS`, `ORIGIN`, etc.).
- Stack limits apply as usual: 1024 `PUSH0`s succeed, the 1025th aborts with stack overflow.
- Jump-destination analysis is unaffected because there are no immediate bytes to skip.

It was activated on Mainnet in the Shanghai upgrade (April 2023), together with [EIP-3651](/eip-3651/), [EIP-3860](/eip-3860/) and [EIP-4895](/eip-4895/).

## Sample code

Bytecode comparison for "return zero bytes" (`RETURN(0, 0)`):

```text
Before:  60 00 60 00 f3   PUSH1 0, PUSH1 0, RETURN   -> 5 bytes, 6 gas for the pushes
After:   5f 5f f3         PUSH0, PUSH0, RETURN       -> 3 bytes, 4 gas for the pushes
```

Solidity emits `PUSH0` automatically when targeting Shanghai or later. Pin the EVM version explicitly in your build config if you deploy to several chains:

```json
{
  "language": "Solidity",
  "settings": {
    "evmVersion": "shanghai",
    "optimizer": { "enabled": true, "runs": 200 }
  }
}
```

In inline assembly there is no special syntax; the compiler chooses `PUSH0` for a literal `0`:

```solidity
function zero() external pure returns (uint256 z) {
    assembly { z := 0 } // compiles to PUSH0 on shanghai+
}
```

## Things to know

- Bytecode containing `0x5f` fails with an invalid-opcode error on chains or L2s that have not activated Shanghai. This was a common deployment surprise when Solidity 0.8.20 changed its default EVM target to Shanghai; set `evmVersion` to `paris` for such chains.
- Before activation, `0x5f` was an undefined opcode, so contracts already deployed with that byte in executable code could change behaviour. In practice this was not considered a real risk.
- The gain per instruction is small (1 gas, 1 byte) but it applies to almost every contract.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-3855
