Crypto glossary

Token decimals

Definition

Token decimals set how many decimal places a token uses: balances are stored as whole numbers and divided by 10 to the power of decimals for display.

Smart contracts do not handle fractions well, so token balances are stored as integers. The decimals value tells wallets how to display them. ETH and most ERC-20 tokens use 18 decimals, meaning one token is stored as 1 followed by 18 zeros of its smallest unit; USDC and USDT use 6, and wrapped bitcoin uses 8 to match satoshis.

Decimals matter whenever software converts between raw amounts and human-readable ones. Wallets, DEXs, bridges and price oracles all have to read the value correctly. Developers writing scripts or integrating a new token check it in the contract, and block explorers show raw and formatted amounts side by side.

Getting it wrong is a common source of bugs and losses. Treating a 6-decimal token as if it had 18 can make an amount appear a trillion times too small or too large, and DeFi protocols have been exploited through rounding errors between tokens with different decimals. Some scam tokens also play with decimals to display misleading balances.

Example

A contract stores a balance of 2,500,000 for a 6-decimal stablecoin; the wallet divides it by 1,000,000 and shows 2.5 tokens.

Try it with live data

Related terms