A long note uses its index card for a length marker and stores the text on another shelf.
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.
Identify the long form
For bytes or string with at least thirty-two payload bytes, the declared slot stores twice the byte length plus one. The low bit distinguishes this long representation.
Find the content base
The data region begins at Keccak-256 of the encoded declared slot. Its consecutive words hold the byte content under the storage byte-array rules.
Inspect the boundary case
Thirty-one payload bytes use the short inline form. Thirty-two payload bytes use the long form, whose marker is sixty-five, even though the content itself fits one word.
Measure strings in bytes
Multi-byte UTF-8 text can cross the storage threshold with fewer than thirty-two visible symbols. Count actual encoded bytes before choosing the representation.
Inspect the layout
payload length: 32 bytes
main slot marker: 65 (0x41)
data begins: keccak256(encoded declared slot)
This is storage layout, not standard ABI head-and-tail encoding.