Reference · Solidity reference

Solidity cheatsheet

Type limits, units, globals, selectors and gas facts you keep looking up, on one page.

Runs in your browser

Filter by name or value. Try “gwei”, “max”, “sender” or a raw number.

Addresses

Zero address
0x0000000000000000000000000000000000000000
Zero hash, bytes32(0)
0x0000000000000000000000000000000000000000000000000000000000000000

Unsigned integer limits

uint256 max, type(uint256).max
115792089237316195423570985008687907853269984665640564039457584007913129639935
uint128 max
340282366920938463463374607431768211455
uint64 max
18446744073709551615
uint32 max
4294967295
uint16 max
65535
uint8 max
255

Signed integer limits

int256 max, type(int256).max
57896044618658097711785492504343953926634992332820282019728792003956564819967
int256 min, type(int256).min
-57896044618658097711785492504343953926634992332820282019728792003956564819968

Wei units

1 wei
1
1 gwei, in wei
1000000000
1 ether, in wei
1000000000000000000

Time units

1 minutes, in seconds
60
1 hours, in seconds
3600
1 days, in seconds
86400
1 weeks, in seconds
604800

Solidity's time suffixes (seconds, minutes, hours, days, weeks) turn a number into seconds, the unit block.timestamp uses.

Global variables

Address that called this function
msg.sender
Wei sent with the call
msg.value
Complete calldata
msg.data
Function selector of the call
msg.sig
Current block's Unix timestamp, in seconds
block.timestamp
Current block number
block.number
Current chain ID
block.chainid
Current block's base fee
block.basefee
Current block's gas limit
block.gaslimit
Gas left in this call
gasleft()
Account that signed the transaction
tx.origin
This contract's ETH balance
address(this).balance

Function selectors

transfer(address,uint256)
0xa9059cbb
approve(address,uint256)
0x095ea7b3
transferFrom(address,address,uint256)
0x23b872dd
balanceOf(address)
0x70a08231
allowance(address,address)
0xdd62ed3e
totalSupply()
0x18160ddd
ownerOf(uint256)
0x6352211e
safeTransferFrom(address,address,uint256)
0x42842e0e

A selector is the first 4 bytes of the keccak256 hash of the signature, written with no spaces or argument names.

Event topics

Transfer(address,address,uint256)
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
Approval(address,address,uint256)
0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925
ApprovalForAll(address,address,bool)
0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31
OwnershipTransferred(address,address)
0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0

An event's topic0 is the full keccak256 hash of its signature. ERC-20 and ERC-721 Transfer events share one signature, so they share one topic0.

ERC-165 interface IDs

ERC-165
0x01ffc9a7
ERC-721
0x80ac58cd
ERC-721 Metadata
0x5b5e139f
ERC-1155
0xd9b67a26
ERC-2981 royalties
0x2a55205a

Pass one of these to supportsInterface(bytes4) to ask a contract whether it implements the standard.

Proxy storage slots

EIP-1967 implementation slot
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc
EIP-1967 admin slot
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103
EIP-1967 beacon slot
0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50

Gas

Base cost of every transaction (a plain ETH transfer)
21000
Most gas one transaction can use on Ethereum mainnet (EIP-7825)
16777216

The block gas limit is not a fixed number: validators can move it a little with each block, and it has been raised several times since early 2025, so read the current value from a recent block on a block explorer. The per-transaction cap of 16,777,216 gas has applied since the Fusaka upgrade in December 2025.

About this tool

This Solidity cheatsheet collects the values developers look up again and again: the zero address, integer limits, wei and time units, global variables such as msg.sender, common function selectors and event topics, ERC-165 interface IDs and gas facts. Selectors, topics and interface IDs are computed with ethers.js when the page loads, and every value copies with a click. Use the search box to filter.

Common questions

What is the maximum value of uint256?

2^256 - 1, which is 115792089237316195423570985084269984665640564039457584007913129639935. In Solidity you can write it as type(uint256).max.

What is the Ethereum block gas limit?

It is not fixed. Validators can move it a little with each block, and it has been raised several times since early 2025, so read the current value from a recent block on a block explorer. Separately, since the Fusaka upgrade in December 2025, one transaction can use at most 16,777,216 gas (EIP-7825).

What is msg.sender?

The address that called the current function: a wallet for a direct transaction, or a contract when one contract calls another. tx.origin is always the wallet that signed the transaction, and should not be used for access control.