Skip to main content

2026-02-27

5 min

By Formatho Editorial

Ethereum Unit Converter: Wei, Gwei, and Ether Explained

EthereumWeb3Blockchain
Code patterns and regular expressions on screen

Why ether has subunits

Ethereum's native asset is divisible to 18 decimal places, and the EVM does all arithmetic in the smallest unit — wei — as unsigned 256-bit integers. Floating-point ether is a bug factory: 0.1 + 0.2 !== 0.3 in IEEE-754, and rounding at the 18th decimal loses real money at scale. The rule: store and compute in wei, format for humans only at the edges.

The unit ladder

UnitWeiTypical use
wei1EVM arithmetic, balances
Kwei103rarely used
Mwei106rarely used
gwei109gas prices
microether1012rarely used
milliether1015rarely used
ether1018human amounts

Gas math you'll do weekly

Transaction cost = gas used × gas price (in gwei), paid in ether. A swap using 180,000 gas at 12 gwei costs 180,000 × 12 gwei = 2,160,000 gwei = 0.00216 ETH. Since EIP-1559, "gas price" splits into a base fee (burned) plus a priority tip; wallets quote maxFeePerGas and refund the difference.

Pitfalls that cost money

  • JavaScript numbers top out at 253 — about 9 ETH in wei. Always use BigInt (1000000000000000000n) or a decimal library; Number("3 ETH in wei") silently loses precision.
  • Decimals differ per token. ERC-20 tokens choose their own — USDC uses 6, most others 18. Reading balanceOf without dividing by the token's decimals gives answers 1012× off.
  • Formatting: display with fixed decimals and explicit rounding — trailing-zero trimming can hide rounding that shortchanges users.

Convert wei/gwei/ether exactly, with BigInt precision, using the EVM Unit Converter — no floating-point traps.

Formatho Editorial — written and maintained by the team behind formatho.com, a library of free, privacy-first developer tools that run entirely in your browser. Every guide is tested against the tools it describes. Corrections and suggestions: github.com/formatho.