loading prices...
prices by coingecko
onchain.search tools/local · 0 uploads/links/about

home / ethereum / storage-slot-calculatorlocal

Solidity Storage Slot Calculator

Find the storage slot of a mapping value or the start of a dynamic array from the variable's slot number.

storage-slot-calculatorready · runs in this browser

Runs locally in your browser. Nothing you type is sent anywhere.

ethereum tools · free · runs in your browser · no sign-up · no wallet

01 // about this tool

In Solidity, a mapping's value for key k is stored at keccak256(k . slot), with both padded to 32 bytes (string keys are hashed unpadded). A dynamic array's elements start at keccak256(slot). Use the result with eth_getStorageAt.

02 // how to use it

  1. Pick the key type and enter the key.
  2. Enter the slot number of the mapping variable.
  3. Press Run.

03 // faq

How do I know the slot number?

Count state variables in declaration order, allowing for packing. Check your compiler's storage layout output.

Does this handle nested mappings?

Not directly. Feed the result back in as the next slot, using bytes32 as the key type for the next level's slot.

04 // related tools

all 43 ethereum tools →