x402AgentTools

ΞWei / Gwei / ETH Converter

Convert between wei, kwei, mwei, gwei, microether, milliether and ether with exact BigInt arithmetic. Decimal strings of any magnitude convert without floating-point error.

Worked examples

21,000 gwei → ETH

GET /api/v1/crypto/wei-eth-converter?value=21000&from=gwei&to=eth

Result: 0.000021000000000000 ETH

1 ETH → wei

GET /api/v1/crypto/wei-eth-converter?value=1&from=eth&to=wei

Result: 1000000000000000000 wei

0.1 ETH → wei (exact)

GET /api/v1/crypto/wei-eth-converter?value=0.1&from=eth&to=wei

Result: 100000000000000000 wei

Machine API (x402)

$0.001 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/crypto/wei-eth-converter?value=21000&from=gwei&to=eth HTTP/1.1
Host: agenttools-hub.vercel.app

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "crypto/wei-eth-converter",
  "input": {"value":"21000","from":"gwei","to":"eth"},
  "result": { "value": null, "answer": "0.000021000000000000 ETH" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

Ethereum denominations step by 10³ from wei (10⁻¹⁸ ETH) through gwei (10⁻⁹) to ether. Conversions use BigInt scaling, so 0.1 ETH is exactly 100,000,000,000,000,000 wei — never 1.0000000000000002e17.

atoms(value × 10^fromExp) → atoms × 10^(fromExp − toExp) rendered exactly

Frequently asked questions

What is gwei used for?

Gas prices are quoted in gwei (1 gwei = 10⁻⁹ ETH). A 21,000-gas transfer at 10 gwei costs 0.00021 ETH.

Why not just use floating point?

Floats cannot represent 0.1 exactly, so wei amounts come out wrong by hundreds of units. All conversions here use exact integer math on decimal strings.

Related tools