EVMTools

Token Unit Converter

Convert between human-readable token amounts and raw values for any ERC-20 token. Supports custom decimals for USDC, WBTC, ETH, and more.

Direction:
Token Presets

Common Token Decimals

TokenSymbolDecimals
EtherETH18
USD CoinUSDC6
TetherUSDT6
Wrapped BitcoinWBTC8
DaiDAI18
ChainlinkLINK18
UniswapUNI18
AaveAAVE18
SUISUI9
Shiba InuSHIB18

How to Use This Token Unit Converter

This tool converts between human-readable token amounts and their raw uint256 values for any ERC-20 token. It supports all decimal configurations from 0 to 18 and beyond.

  1. Select or enter the token decimals — choose a preset (18 for ETH/DAI, 6 for USDC/USDT, 8 for WBTC) or enter a custom decimal value.
  2. Enter a human-readable amount (e.g., 1.5) to see the raw uint256 value, or enter a raw value to see the human-readable equivalent.
  3. View the conversion — the tool shows both representations instantly, handling arbitrary precision without rounding errors.
  4. Copy the result for use in smart contract calls, test scripts, or transaction parameters.

All conversions run locally in your browser with arbitrary precision arithmetic. No data is sent to any server.

Common Use Cases

  • Smart contract parameters — Convert human-readable token amounts to raw uint256 values for function call arguments like transfer amounts and allowances.
  • Event log interpretation — Convert raw uint256 values from Transfer and Approval events into human-readable token amounts.
  • DeFi development — Calculate precise token amounts for swap parameters, liquidity amounts, and fee calculations across tokens with different decimals.
  • Testing and debugging — Quickly convert between display amounts and raw values when writing tests or debugging token-related smart contract logic.
  • Cross-token calculations — Compare amounts across tokens with different decimal configurations (e.g., USDC with 6 decimals vs DAI with 18 decimals).

Related Tools

Frequently Asked Questions

What are ERC-20 token decimals?

ERC-20 token decimals define how many decimal places a token supports. Since the EVM only works with integers, decimals are a display convention. A token with 18 decimals stores 1.0 tokens as 1000000000000000000 (10^18) in its raw uint256 form. Common values: 18 (ETH, DAI, LINK), 6 (USDC, USDT), 8 (WBTC).

How do I convert raw token values to human-readable amounts?

Divide the raw uint256 value by 10^decimals. For example, a USDC balance of 1500000 (6 decimals) equals 1.5 USDC (1500000 / 10^6). For ETH with 18 decimals, 2500000000000000000 equals 2.5 ETH. In code, use ethers.js formatUnits() or viem's formatUnits() to avoid floating-point errors.

Why do different tokens have different decimals?

Token creators choose decimals based on the token's use case and precision requirements. ETH and most DeFi tokens use 18 decimals for maximum precision. Stablecoins like USDC and USDT use 6 decimals to mirror traditional currency precision. WBTC uses 8 decimals to match Bitcoin's satoshi subdivision.

What happens if I use the wrong decimals?

Using incorrect decimals can result in sending the wrong amount of tokens. For example, if you enter a USDC amount assuming 18 decimals instead of 6, the actual value will be 10^12 times larger than intended. Always verify the token's decimals by checking the contract's decimals() function before making transfers.

Can a token have 0 decimals?

Yes. Some tokens have 0 decimals, meaning each unit is indivisible. This is common for NFT-like fungible tokens, governance tokens where fractional voting is not desired, or tokens representing whole items. With 0 decimals, the raw value and the display value are identical.