A cabinet map needs both the drawer number and the compartment width.
SEE IT FOR YOURSELF
Pack small values into Solidity storage slotsStep 1 / 4
In this simple default-layout example, two uint128 values come before one uint256. Each slot holds thirty-two bytes.
In this simple default-layout example, two uint128 values come before one uint256. Each slot holds thirty-two bytes.The first sixteen-byte value occupies the low-order half of slot zero. Low-order bytes are shown on the right.The second uint128 fits in the remaining sixteen bytes. Both values now share slot zero.C needs a complete thirty-two-byte slot, so it begins at slot one. Two packed small values plus C use two slots.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Request the correct artifact
Solidity’s standard JSON output can include storageLayout for a contract. Keep the exact source hierarchy and compiler settings used to generate it.
Read slot and byte offset
A field at slot zero with offset sixteen begins sixteen bytes from the low-order end. Slot keys and inner byte offsets are different coordinate systems.
Follow referenced type entries
Structs, arrays and mappings need the type descriptions and their own layout rules. A single top-level label may represent several storage words.
Compare before and after carefully
For an upgrade review, inspect the full old and new layouts. Matching variable names alone does not establish preserved field meaning.
Define the test
field a: slot 0, offset 0, uint128
field b: slot 0, offset 16, uint128
field c: slot 1, offset 0, uint256
Test plans are framework-neutral unless labeled as complete Solidity or JavaScript. Use a local test environment and no real funds.
QUICK CHECK · NO PRESSURE
Is byte offset sixteen the same as storage slot sixteen?