How gwei works
Ether has several named units. The smallest is wei; one gwei is a billion wei, and one ETH is a billion gwei. Gwei is used because gas prices would be long decimals in ETH.[2]
The name is short for giga-wei, meaning a billion wei. In powers of ten, 1 wei = 10^-18 ETH and 1 gwei = 10^-9 ETH.[1]
The protocol itself works in wei. Every transaction's value field is denominated in wei, and account balances are stored in wei. Gwei is a display unit that wallets and gas trackers use so fee numbers stay short.[2]
The chainid.network registry lists 18 decimals for ETH on Ethereum and on L2s such as Base, which is why 1 ETH is 10^18 wei on all of them.[5]
Gwei and gas fees
A transfer that uses 21,000 gas at a gas price of 10 gwei costs 210,000 gwei, which is 0.00021 ETH. See gas fee.[1]
EIP-1559 stores the base fee per gas in wei. Its INITIAL_BASE_FEE constant is 1,000,000,000 wei, which is exactly 1 gwei.[4]
Node APIs also return prices in wei, as hex. The eth_gasPrice example in the JSON-RPC docs returns 0x1dfd14000, which is 8,049,999,872 wei. Divide by 1,000,000,000 to get 8.049999872 gwei, which a wallet would round to about 8.05 gwei.[3]
Conversion examples
The numbers in this section are illustrative. The rule is to multiply by 1,000,000,000 to go down one named unit (ETH to gwei, gwei to wei) and divide by 1,000,000,000 to go up.
0.05 ETH × 1,000,000,000 = 50,000,000 gwei. 250,000 gwei ÷ 1,000,000,000 = 0.00025 ETH.[2]
A transfer of 21,000 gas at 12 gwei costs 21,000 × 12 = 252,000 gwei = 0.000252 ETH. In wei that is 252,000 × 1,000,000,000 = 252,000,000,000,000 wei.[1]
To see the dollar cost, multiply the ETH amount by an ETH price. At an illustrative $3,000 per ETH, 0.000252 × 3,000 = $0.756, or about 76 cents.
L2 gas prices are often fractions of a gwei. A transfer using 21,000 gas at an illustrative 0.05 gwei costs 21,000 × 0.05 = 1,050 gwei = 0.00000105 ETH.[1]
Common mistakes
Mixing up wei and gwei gives an answer off by a factor of a billion. Raw RPC output and smart contract values are in wei; wallet fee screens are in gwei. Check which one a tool uses before you paste a number into a custom gas field.[3]
Reading a hex value as decimal is another trap. 0x1dfd14000 is not 1 billion of anything; converted from hex it is 8,049,999,872 wei.[3]
Reading a fee screen in gwei
ethereum.org's own example uses gwei throughout: an ETH transfer of 21,000 gas with a 10 gwei base fee and a 2 gwei tip costs 21,000 × (10 + 2) = 252,000 gwei, or 0.000252 ETH. Of that, 21,000 × 10 = 210,000 gwei (0.00021 ETH) is burned and 21,000 × 2 = 42,000 gwei (0.000042 ETH) goes to the validator.[1]
The max fee and priority fee you set in a wallet are prices per unit of gas, also in gwei. They are not totals. A max fee of 30 gwei on a 21,000 gas transfer caps the fee at 21,000 × 30 = 630,000 gwei, or 0.00063 ETH (illustrative values).[1]
Gwei also makes the base fee limit easy to read. The base fee can rise at most 12.5% per block, so from ethereum.org's example of 202.7 gwei the next block's base fee can be at most 202.7 × 1.125 = 228.1 gwei.[1]
Wallets round gwei for display, but the protocol does not. In EIP-1559, when a block is over its target, the base fee rises by at least 1 wei, which is 0.000000001 gwei, even if the percentage formula rounds down to zero.[4]
The Bottom Line
Gwei is just a convenient unit for small amounts of ETH, used mainly to express gas prices.
Educational content, not financial advice.