In this track: Tokens and digital ownership
intermediate · 3 MIN READ

The ERC-20 decimals convention

A metadata method helps applications format a raw token integer.

LET’S PICTURE IT

A ruler’s scale tells you how many small marks make one display unit; it does not change the thing being measured.

SEE IT FOR YOURSELF
The same native ether amount shown as ETH, Gwei and WeiETH1× 1 billionGWEI1000000000× 1 billionWEI1000000000000000000

1 ETH = 1000000000 Gwei = 1000000000000000000 Wei.

Same value · different units · native ether only

A display exponent

When a token reports decimals d, an interface commonly divides raw quantities by 10 to the power d for display. A raw 2500 with three decimals becomes 2.5 tokens.

Optional does not mean universal

The ERC-20 specification treats decimals as optional metadata. Applications should not assume every address returns a sensible value or that a failed metadata call proves the token has eighteen decimals.

The ABI integer stays raw

A transfer function’s uint256 argument does not contain an embedded decimal point. The raw integer 2500 can be encoded perfectly while a frontend labels its human meaning incorrectly.

Keep display policy explicit

Verify the token and network, preserve integer values and separate metadata handling from accounting. Our ETH converter uses the native eighteen-decimal scale only; it is not an automatic token-metadata resolver.

TURN UNDERSTANDING INTO PRACTICEOpen the ABI encoder →
QUICK CHECK · NO PRESSURE

With three decimals, what does a raw quantity of 2500 display as?

Your progress stays in this browser.
Keep exploring the original referenceEthereum Improvement Proposals ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.