EVMTools

Storage Slot Calculator

Calculate Solidity storage slots for variables, mappings, and nested mappings using keccak256.

Solidity Storage Layout Reference

Simple Variables

Stored sequentially starting at slot 0. Each slot is 32 bytes. Multiple small variables can be packed into one slot.

Mappings

The value for mapping(keyType => valueType) at slot p with key k is at: keccak256(abi.encode(k, p))

Nested Mappings

For mapping(k1Type => mapping(k2Type => valueType)) at slot p: compute keccak256(abi.encode(k2, keccak256(abi.encode(k1, p))))

Dynamic Arrays

Length is stored at slot p. Element i is at keccak256(p) + i.