In this track: Connect everything together
advanced · 6 MIN READ

Build an exact unit converter

Preserve every digit through ETH, Gwei and Wei conversions.

LET’S PICTURE IT

An exact ruler must not bend when the number becomes large.

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

Define accepted inputs

Wei values are whole integers; ETH can have up to eighteen fractional places and Gwei up to nine. Decide and explain how invalid precision is rejected.

Use lossless arithmetic

Parse decimal strings into integer raw units. Avoid routing a large amount through JavaScript Number before converting it to BigInt.

Format deterministically

Show decimal strings without scientific notation or hidden rounding. Keep the asset quantity separate from any price or fiat calculation.

Verify boundary fixtures

Test zero, one Wei, one ETH and a very large exact integer. A valid parse-format round trip should retain the intended amount.

Your acceptance target

1 ETH = 1000000000000000000 Wei
1 Gwei = 1000000000 Wei
1 Wei = 0.000000000000000001 ETH

Use only local examples and public sample addresses. State the assumptions and limits alongside the result.

TURN UNDERSTANDING INTO PRACTICEOpen the Wei / Gwei / ETH →
QUICK CHECK · NO PRESSURE

Which representation avoids initial floating-point loss?

Your progress stays in this browser.
Keep exploring the original referenceethereum.org ↗

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