Wei

General Updated Feb 2026

What Is Wei?

Wei is the smallest denomination of Ether (ETH), the native cryptocurrency of the Ethereum network. Just as a dollar is divisible into 100 cents and a Bitcoin is divisible into 100 million satoshis, one ETH is divisible into 10^18 (one quintillion) wei. Every transaction fee, gas cost, and ETH transfer on the Ethereum network is ultimately calculated and denominated in wei, even if your wallet displays the values in ETH or Gwei.

The concept of wei exists because blockchains operate at the level of integers, not floating-point numbers. Smart contracts cannot natively handle decimal arithmetic — the Ethereum Virtual Machine (EVM) only supports 256-bit unsigned integers (uint256). To represent fractional values like 0.5 ETH or 1.734 ETH, the network uses wei as the atomic unit. Your wallet may display “1.5 ETH,” but under the hood, the network records “1,500,000,000,000,000,000 wei.”

The name “wei” honors Wei Dai, a pioneering cryptographer who published the “b-money” proposal in 1998 — a conceptual precursor to Bitcoin. Vitalik Buterin has acknowledged that b-money was a direct inspiration for Ethereum’s design philosophy.

The Wei Denomination System

Ethereum has a system of named denominations for different powers of 10 of wei, similar to how traditional finance has dollars, cents, and mills. Here is the complete conversion table:

DenominationWei ValueETH ValueCommon Use
Wei1 wei0.000000000000000001 ETHOn-chain arithmetic, contract storage
Kwei (babbage)10^3 wei0.000000000000001 ETHRarely used
Mwei (lovelace)10^6 wei0.000000000001 ETHRarely used
Gwei (shannon)10^9 wei0.000000001 ETHGas pricing
Szabo10^12 wei0.000000001 ETHRarely used in practice
Finney10^15 wei0.001 ETHOccasionally referenced
Ether10^18 wei1 ETHStandard unit
KEther10^21 wei1,000 ETHLarge protocol treasury figures
MEther10^24 wei1,000,000 ETHNetwork-level statistics

Most of these names are honors to cryptographic pioneers: Lovelace (Ada Lovelace), Babbage (Charles Babbage), Shannon (Claude Shannon), Szabo (Nick Szabo), and Finney (Hal Finney). In practice, only wei, Gwei, and ETH are commonly used by developers and users.

Gwei: The Gas Denomination

Gwei (giga-wei, 10^9 wei or 0.000000001 ETH) is the standard unit for expressing gas prices on Ethereum. When you see “Gas Price: 30 Gwei,” it means each unit of gas costs 30 billion wei, or 0.00000003 ETH.

To calculate a transaction’s total fee in ETH:

  • Total Fee (ETH) = Gas Used × Gas Price (Gwei) × 10^-9

For a simple ETH transfer (21,000 gas) at 30 Gwei:

  • 21,000 × 30 × 10^-9 = 0.00063 ETH (about $1.15 at $1,800/ETH)

For a complex DeFi interaction (150,000 gas) at 50 Gwei:

  • 150,000 × 50 × 10^-9 = 0.0075 ETH (about $13.50)

Gwei became the standard because wei numbers are unwieldy (30 Gwei = 30,000,000,000 wei) and ETH gas prices are tiny fractions (0.00000003 ETH). Gwei hits a sweet spot for human readability.

Why Wei Matters for Smart Contracts

Understanding wei is critical for smart contract development. The EVM does not support floating-point arithmetic, so all token amounts must be handled as integers in the token’s smallest denomination. For ERC-20 tokens, this means:

  • USDC has 6 decimals, so 1 USDC = 1,000,000 (in the contract).
  • USDT has 6 decimals, so 1 USDT = 1,000,000.
  • DAI has 18 decimals, so 1 DAI = 10^18.
  • WBTC has 8 decimals, so 1 WBTC = 100,000,000.

When a contract needs to calculate “1.5 ETH,” it works with “1,500,000,000,000,000,000 wei” (1.5 × 10^18). Developers must be extremely careful with decimal handling — the most common smart contract bug is confusing wei with ETH or using the wrong number of decimals for ERC-20 tokens.

Wei in Token Standards

The ERC-20 token standard uses a decimals() function that returns the number of decimal places the token uses. The standard amount representation is always in the smallest unit (similar to wei for ETH). When you see a balance of “1,000,000,000” for a token with 6 decimals, the actual balance is 1,000 tokens.

OpenZeppelin’s SafeERC20 and the @uniswap/v3-sdk libraries provide helper functions for handling token math with proper decimal precision. The ethers.js library’s parseUnits("1.5", "ether") function converts “1.5 ETH” to “1500000000000000000 wei” automatically.

Historical Context

Wei was defined in Ethereum’s earliest specifications. The Yellow Paper (Ethereum’s formal specification by Gavin Wood) explicitly defines wei as the base unit and all other denominations as multipliers of wei. This design choice influenced virtually every subsequent EVM-compatible blockchain — BSC, Polygon, Avalanche, Arbitrum, Optimism, and others all use wei as their atomic unit.

Common Pitfalls

  • Off-by-10^18 errors: The single most common mistake in smart contract development is handling amounts in ETH instead of wei. Transferring 1 ETH when you meant 1 wei will lose you the entire amount.
  • Decimal mismatches: When working with ERC-20 tokens, always check the token’s decimals() value. Assuming 18 decimals for a token that uses 6 (like USDC) will cause calculations to be off by a factor of 10^12.
  • Display confusion: Different wallets and explorers display amounts in different units. Etherscan shows gas in Gwei, MetaMask shows balances in ETH, and raw RPC responses return everything in wei. Always know which unit you are looking at.
  • Integer overflow concerns: While the EVM uses 256-bit integers (which can hold up to ~1.16 × 10^77), multiplication operations between large wei values can overflow. Solidity 0.8+ has built-in overflow protection, but older contracts (pre-0.8) do not.
  • Precision loss in frontend: JavaScript’s Number type loses precision above 2^53. For large wei values (which can exceed this), always use BigInt or a library like ethers.js with BigNumber / bigint.