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.

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.

Related

Published May 14, 2026