Skip to content

Comparison

Wei vs Gwei: which unit to use when

Wei is the atomic unit. Gwei is the gas-price unit. Don't mix them up.

By Published

TL;DR. Wei is the atomic indivisible unit of Ethereum (1 ETH = 10¹⁸ Wei); Gwei is the gas-price unit (1 Gwei = 10⁹ Wei = 10⁻⁹ ETH). Use Wei in smart contracts and raw transaction data, Gwei for quoting gas prices, and ETH for user-facing balances.

Ethereum has three denominations in everyday use. ETH is the human-readable unit. Wei is the atomic, indivisible unit at the bottom of the stack. Gwei sits in the middle and exists for one practical reason: it’s the right size for quoting gas prices.

The factor sheet

1 ETH = 10⁹ Gwei = 10¹⁸ Wei
1 Gwei = 10⁹ Wei = 10⁻⁹ ETH

Convert any value in either direction via our Wei / Gwei / ETH converter, which uses BigInt math throughout.

When to use Wei

  • Smart-contract code.Solidity stores all balances as integer Wei amounts. There’s no floating point on-chain; every arithmetic operation must produce integer Wei.
  • Reading raw transaction objects. The value field of a transaction is denominated in Wei. Block explorers (Etherscan, etc.) display it in ETH for readability, but the underlying number is Wei.
  • RPC API responses. Most JSON-RPC fields return Wei strings. eth_getBalance returns a hex Wei value, not an ETH value.

When to use Gwei

  • Gas prices.Universally. “25 Gwei gas” is the natural unit; “25,000,000,000 Wei gas” or “0.000000025 ETH gas” would both be illegible on a wallet screen.
  • EIP-1559 base fee + priority fee quotes. Both are denominated in Gwei. Etherscan’s Gas Tracker quotes everything in Gwei. MetaMask, Rabby, and every other wallet display gas in Gwei.
  • Network fee estimation tools.If you’re building a UI that says “estimated fee: 0.0042 ETH”, the underlying multiplication is gas-units × Gwei-per-gas, converted to ETH for display.

When to use neither — use ETH

For balances, transfers, and any human-facing amount, use ETH. Wei amounts of order 10¹⁸ are unreadable; Gwei amounts of order 10⁹ are barely better. ETH with 4-6 decimal places is the natural unit for “how much did this cost.”

Why the BigInt issue matters

JavaScript’s Number type uses IEEE 754 double precision, which gives roughly 15-17 significant decimal digits. 1 ETH = 10¹⁸ Wei needs 19 digits to represent. So:

  • Storing a balance of 9 ETH or more in Number loses precision.
  • Math like “0.1 ETH + 0.2 ETH = 0.3 ETH” doesn’t round-trip cleanly when expressed in Wei via Number.
  • The naive Number(weiString) conversion silently rounds.

Production libraries (ethers.js, viem, web3.js) all use BigInt or a custom bigint-like class for Wei amounts. Our Wei / Gwei / ETH converter uses BigInt throughout the conversion, so a value like 123,456,789,012,345,678 Wei round-trips to 0.123456789012345678 ETH and back without a single lost digit.

The mental model

Think of it like dollars and cents — but with two intermediate units between the smallest and largest. Wei is the cent (atomic, no smaller). Gwei is the dollar (the unit prices are quoted in). ETH is the thousand-dollar bill (the unit balances are reported in).

Try to do gas-price math in Wei: ugly. Try to write a smart contract in ETH: impossible (no floating point). Each unit has its lane. Don’t mix them.

The honest takeaway

For gas prices, Gwei. For on-chain code, Wei. For balances and user-facing amounts, ETH. The three coexist for good reason. Convert via our converterwhen crossing between them; don’t trust your own mental arithmetic past ~12 zeros.

Numeric facts

  • 1 ETH = 10¹⁸ Wei = 1,000,000,000,000,000,000 Wei — 18 zeros, the full uint256 footprint of every balance.
  • 1 Gwei = 10⁹ Wei = 1,000,000,000 Wei; 1 ETH = 10⁹ Gwei.
  • Number.MAX_SAFE_INTEGER = 2⁵³−1 ≈ 9.007 × 10¹⁵, which means JS Number can represent up to ~0.009 ETH in Wei without precision loss; anything larger silently rounds.
  • Typical gas prices (2024-2026): base fee 5-50 Gwei in normal conditions, 100-500 Gwei during NFT mint spikes, >1000 Gwei in 2021-era congestion.
  • Standard ETH transfer cost: 21,000 gas × current Gwei. At 30 Gwei that’s 630,000 Gwei = 0.00063 ETH.
  • Other named units (rarely used): 1 Kwei = 10³ Wei (Babbage), 1 Mwei = 10⁶ Wei (Lovelace), 1 Twei = 10¹² Wei (Micro/Szabo).
  • EIP-1559 base-fee adjustment: max 12.5% change per block (~12 sec); converges to demand within ~6 blocks.

Decision matrix

ContextUnitWhy
Solidity uint256 balanceWeiNo floats on-chain; uint256 stores Wei natively
eth_gasPrice, eth_getBalance RPCWei (hex)JSON-RPC returns hex Wei strings
MetaMask gas sliderGwei5-200 fits a UI dial
EIP-1559 maxFeePerGasGweiStandard wallet/explorer unit
User-facing balance displayETH (4-6 decimals)Human-readable magnitude
Block explorer transaction valueETHEtherscan converts Wei → ETH for display
Arithmetic in JS / PythonWei as BigIntAvoids 64-bit float precision loss

Sources

Frequently asked questions

What's 1 Gwei in ETH?
1 Gwei = 10⁻⁹ ETH = 0.000000001 ETH. The factor sheet: 1 ETH = 10⁹ Gwei = 10¹⁸ Wei. Going up: divide. Going down: multiply.
Why is gas priced in Gwei instead of ETH or Wei?
Because gas prices land in the 10-100 Gwei range — readable as small whole numbers. The same price in Wei (10¹⁰-10¹¹) or ETH (10⁻⁸) would be illegible on a wallet screen. Gwei is just the unit that makes the typical magnitude convenient.
Why do Ethereum libraries need BigInt for Wei?
Because 1 ETH = 10¹⁸ Wei needs 19 decimal digits to represent. JavaScript's Number type only has ~15-17 digits of precision, so storing balances in Number silently loses precision past about 9 ETH. Production libraries (ethers, viem, web3.js) use BigInt throughout.
Is Gwei the same as Shannon?
Yes — both names refer to the 10⁻⁹ ETH unit. Gwei (giga-wei) became the dominant name once EIP-1559 and wallet UIs adopted it; Shannon (after Claude Shannon) is an older convention occasionally still seen in academic write-ups.

Related

Published May 14, 2026