Common Token Decimals — ETH, BTC, USDT, USDC & More

On-chain balances are stored as integers in the smallest unit; the decimals value tells you where the decimal point goes. This reference lists common assets and explains why decimals matters.

Common decimal values

ETH — 18. BTC — 8. TRX — 6. TON — 9. USDT — 6. USDC — 6. WBTC — 8. DAI — 18. A raw balance is divided by 10 to the power of decimals to get the human amount. So a USDT balance of 1000000 (with 6 decimals) is 1 USDT, while an ETH balance of 10^18 wei is 1 ETH.

Why decimals matters for balanceOf

ERC-20 balanceOf returns an integer in the smallest unit, with no decimal point. To display a value you must know the token's decimals and divide accordingly. Assuming 18 decimals for every token is a common bug: a stablecoin such as USDT or USDC uses 6, so treating its balance as 18-decimal understates it by a factor of 10^12.

Reading decimals reliably

Do not hardcode decimals. Read the decimals() view function from the token contract and cache it, since it does not change. For native assets, use the fixed chain value: 18 for ETH, 8 for BTC, 6 for TRX, 9 for TON. Wrapped assets often mirror the underlying asset's precision, which is why WBTC uses 8 like BTC.

Частые вопросы

Why does USDT use 6 decimals instead of 18?

Token issuers choose their own decimals value. USDT and USDC use 6, matching a cent-level precision that is ample for a stablecoin. Because it differs from ETH's 18, you must read each token's decimals rather than assuming a default.

What happens if I use the wrong decimals?

You will display or compute an amount off by a power of ten. Treating a 6-decimal token as 18-decimal, for example, makes a real balance look 10^12 times too small, which can cause serious accounting or payment errors.

Похожие инструменты

Пополнили, получили ключ, запустили.

Полное самообслуживание. Оплата криптой или картой. Тарификация в кредитах — тяжёлые примитивы дороже, простые дёшевы.

Получить API-ключ