Token Decimals Converter

Raw base-unit amount ⇄ human-readable amount, for any token's decimals — not just ETH's fixed 18.

Why decimals vary at all

ERC-20 contracts store amounts as plain integers — there’s no native decimal type in the EVM. A token’s decimals() value just tells wallets and explorers where to mentally place the decimal point when displaying an amount. ETH-like 18 decimals is common but not universal: USDC and USDT use 6, WBTC uses 8, and some tokens deliberately use 0.

Where this trips people up

Reading a raw event log or calldata argument for an unfamiliar token and assuming 18 decimals (because that’s what most examples use) can be off by orders of magnitude — a 6-decimal token’s raw amount of 5000000 is 5 tokens, not 0.000000000005. Getting the decimals value right first is what makes the rest of the conversion trustworthy.

How this tool works

Conversion uses viem’s formatUnits/parseUnits with whatever decimals value you set, backed by native BigInt arithmetic — exact for any token, any amount size, entirely in your browser.

Frequently asked questions

The ETH converter is fixed to ETH's own units (Wei/Gwei/ETH, all defined relative to 18 decimals). Most other tokens don't follow that — USDC and USDT use 6 decimals, WBTC uses 8 — so reading their raw on-chain amounts needs the token's actual decimals value, not ETH's.

Call the token contract's decimals() function (most block explorers show this on the contract's "Read Contract" tab), or check the token's listing on the explorer directly. It's fixed at deployment and never changes for a given token.

The literal integer a contract stores and emits in events — no decimal point, ever. A human-readable "5.0 USDC" is stored on-chain as the raw integer 5000000 (5 × 10⁶, since USDC has 6 decimals). Block explorers usually show you the human amount, but raw calldata and event logs show the raw integer.

No — conversion uses native BigInt arithmetic throughout, so amounts are exact regardless of size or decimal count, unlike floating-point math which can silently lose precision on large token amounts.