The developer tools you reach for every day, all in one place.

Converters, formatters, hashes, validators, and the small utilities you keep reopening stay together instead of getting lost across tabs.

GitHub

/ Tools

/ Tool Finder
109 tools
/ Contract Storage Slot Calculator
/ Selected Tool

Contract Storage Slot Calculator

Calculate storage slots for mappings and arrays in Solidity smart contracts

01

What is a storage slot?

In Ethereum smart contracts, storage is organized into 32-byte slots. Each state variable occupies a specific slot, and mappings use a calculated slot based on the key and base slot number.

02

How does it work?

For mappings, the storage slot is calculated as: keccak256(key . slot) Where key is the mapping key (padded to 32 bytes) and slot is the base slot number of the mapping. // Example: Calculate slot for balances[user] con…

03

Sample Cases

Covers ERC-20 balance mapping, NFT owner mapping (uint256 key), and Nested mapping so you can compare common inputs and outputs quickly.

/ Code

/ Integration

Source code from the selected tool, shown here alongside the live version on the right.

/ Source Code
TypeScript
typescript
// npm install viem

import { keccak256, encodePacked, pad, toHex } from 'viem';

// Calculate storage slot for mapping
function getMappingSlot(key: string, slotNumber: number): string {
  let keyBytes: `0x${string}`;

  // Handle address (20 bytes) or uint256 (32 bytes)
  if (key.startsWith('0x')) {
Buidl Now icon

Keep every utility in one place and stay inside the build flow.

Pick a tool, finish the check, copy what you need, and get back to the actual product work.

Developer tools for builders who ship fast.© 2026 Buidl Now. All rights reserved.