Skip to main content

Array Storage Demo

Configure a Solidity array and visualize how elements map to 32-byte EVM storage slots with packing, keccak256 addressing, and gas costs.

Quick Scenarios

Array Configuration

Array Kind
Element Type
Length5
050
Base Slot
uint256[] public myArray;
Total Slots
6
Elements
5
Bytes Used
160B / 160B
Efficiency
100%

Storage Slots

length (32B)
[0]
[1]
[2]
[3]
[4]

Element Access Calculator

Element Index
Slot
0x290dec…f3e563 + 0
Byte Offset
bytes 0\u201331
Formula
dataStart = keccak256(0)
slot = dataStart + floor(0 × 32 / 32) = 0x290dec…f3e563 + 0
offset = (0 × 32) % 32 = 0
uint256
32B per element1 per slot

Gas Costs

Initialize all elements120,000 gas

5 data slots × 20,000 + 1 length slot × 20,000

Read element (SLOAD)

2,100 cold SLOAD + ~30 keccak256

2,130 gas
Write element (SSTORE)

5,000 gas to update existing slot value

5,000 gas
push() — append

~27,100 gas (new slot + length update)

27,100 gas
pop() — remove last

~7,900 gas (zero element + length update, refund eligible)

7,900 gas

Dynamic arrays use slot for length, data at keccak256(slot). One extra SLOAD per access.

Previous: Data Types Explorer
Back to data types explorer