ERC-20 Token Amount Converter
Convert between human token amounts and the integer base units a contract expects, for any decimals value, with exact arithmetic and the float precision trap made visible.
Last reviewed by the Radiatus Cloud team
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Contracts hold integers, and the decimal point is a display convention
An ERC-20 balance is an unsigned 256-bit integer. The decimals value a token reports is metadata used by interfaces to place a decimal point, and it has no effect on the arithmetic the contract performs. Sending "one token" means sending 10^decimals base units, and getting that exponent wrong is the single most common way a transfer goes badly: USDC has 6 decimals while most tokens have 18, so a transfer written for 18 decimals against USDC moves a trillion times too much, and against a token with 18 decimals written for 6 it moves a trillion times too little.
Floating point cannot represent these numbers
A double-precision float has about 15 to 16 significant decimal digits. A balance of 1234.5678 tokens with 18 decimals is 1234567800000000000000, which is 22 digits, so converting through a float silently rounds it. The rounding is invisible in a display and produces a transfer for the wrong amount, or an approval that does not cover the transfer that follows. This is why every serious library uses big integers end to end, and why a conversion done with multiplication in a spreadsheet is not safe.
Decimals is a self-reported field, not a guarantee
The decimals value comes from the token contract and a contract can report anything, including nothing at all: the field is optional in the standard, and some early tokens omit it. A few tokens use unusual values, and a handful of rebasing and fee-on-transfer tokens make the relationship between the amount sent and the amount received non-obvious regardless of decimals. Reading decimals from the contract rather than assuming 18 is the minimum, and it is not sufficient on its own.
Related tools
- Ethereum Unit Converter — Convert between Wei, Gwei, and Ether units.
- Gas Fee Calculator — Calculate transaction costs based on gas price and limit.
- IPFS CID Generator — Generate IPFS Content Identifiers (CID) from text or files.
- Wallet Address Validator — Validate Ethereum and Bitcoin wallet addresses.
Frequently Asked Questions
Why do tokens have different decimals?
Because the standard leaves it to the token. Most use 18, matching ether, but USDC and USDT use 6 and WBTC uses 8, and a transfer written for the wrong exponent is off by a factor of a trillion or a hundred million.
Why not just use floating point?
Because a double holds about 16 significant digits and an 18-decimal balance regularly needs more than 20. The conversion silently rounds, which produces a transfer for the wrong amount or an approval that does not cover it.
Is decimals guaranteed to be accurate?
No. It is self-reported by the contract and is optional in the standard, so some tokens omit it entirely. Read it from the contract rather than assuming 18, and treat that as the minimum rather than sufficient.
What is the maximum a uint256 can hold?
About 1.16 times 10 to the 77. With 18 decimals that is around 1.16 times 10 to the 59 whole tokens, so overflow is not a practical concern for real balances.
What does the max approval value mean?
The largest uint256, used as an unlimited allowance so no further approval is needed. It is convenient and it means a compromised or malicious contract can move the whole balance at any future time.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Enter an amount and the token decimals to convert between forms.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.