Skip to main content
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.

Overview

Opcode: 0x15 Introduced: Frontier (EVM genesis) ISZERO checks if a 256-bit value is zero. Returns 1 if the value is zero, 0 otherwise. This is the most efficient way to check for zero values and implements boolean NOT when used with boolean (0/1) values. ISZERO is a specialized form of EQ optimized for the common case of checking equality to zero.

Specification

Stack Input:
Stack Output:
Gas Cost: 3 (GasFastestStep) Operation:

Behavior

ISZERO pops one value from the stack and pushes 1 if it is zero, otherwise 0:
  • If a == 0: Result is 1 (true)
  • If a != 0: Result is 0 (false)
This operation is functionally equivalent to EQ(a, 0) but uses only one stack item.

Examples

Zero Check

Non-Zero Check

Boolean NOT

Large Value Check

Small Non-Zero

Gas Cost

Cost: 3 gas (GasFastestStep) ISZERO shares the lowest gas tier with other comparison operations:
  • ISZERO, EQ, LT, GT, SLT, SGT
  • NOT
  • ADD, SUB
Comparison:
  • ISZERO: 3 gas
  • EQ: 3 gas (ISZERO is equivalent to EQ(x, 0))
  • LT/GT: 3 gas

Edge Cases

Zero Value

Non-Zero Values

Boolean Values

Stack Underflow

Out of Gas

Common Usage

Boolean NOT

Zero Address Check

Non-Zero Validation

Bounds Checking with Inversion

Conditional Logic

Boolean Coercion

Implementation

Testing

Test Coverage

Edge Cases Tested

  • Zero value (0 -> 1)
  • Non-zero values (42 -> 0, 1 -> 0)
  • Maximum value (MAX -> 0)
  • Boolean NOT behavior
  • Stack underflow (empty stack)
  • Out of gas (< 3 gas)
  • Stack preservation

Security

Zero Address Validation

CRITICAL: Always check for zero address in transfers and approvals:

Division by Zero Prevention

Non-Zero Requirement

Boolean Logic Errors

Optimizations

Boolean NOT

Double Negation (Boolean Coercion)

Zero Check vs EQ

Inverted Conditions

Benchmarks

ISZERO is one of the fastest EVM operations: Execution time (relative):
  • ISZERO: 0.95x (slightly faster than EQ)
  • EQ: 1.0x
  • LT/GT: 1.0x
  • ADD: 1.0x
  • MUL: 1.5x
Gas efficiency:
  • 3 gas per zero check
  • ~333,333 checks per million gas
  • Highly optimized (single comparison to zero)
Usage patterns:
  • Zero checks: 3 gas
  • Boolean NOT: 3 gas
  • Boolean coercion (double ISZERO): 6 gas

References

  • EQ - Equality check (ISZERO is specialized EQ)
  • NOT - Bitwise NOT (different from boolean NOT)
  • LT - Less than (often used with ISZERO for >=)
  • GT - Greater than (often used with ISZERO for ≤)