⛽Gas Fee Calculator
Calculate a transaction's gas fee: gas units × gas price (gwei) gives the ETH cost, multiplied by the ETH price for USD. Exact BigInt math for the wei amounts.
Worked examples
Plain transfer: 21,000 gas @ 10 gwei
GET /api/v1/crypto/gas-fee-calculator?gasUnits=21000&gweiPrice=10ðPriceUsd=3000
Result: $0.63
ERC-20 transfer: 65,000 gas @ 15 gwei
GET /api/v1/crypto/gas-fee-calculator?gasUnits=65000&gweiPrice=15ðPriceUsd=3000
Result: $2.93
Swap: 150,000 gas @ 25 gwei
GET /api/v1/crypto/gas-fee-calculator?gasUnits=150000&gweiPrice=25ðPriceUsd=3000
Result: $11.25
Machine API (x402)
$0.001 / callThis 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/gas-fee-calculator?gasUnits=21000&gweiPrice=10ðPriceUsd=3000 HTTP/1.1
Host: agenttools-hub.vercel.app
→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)
{
"tool": "crypto/gas-fee-calculator",
"input": {"gasUnits":21000,"gweiPrice":10,"ethPriceUsd":3000},
"result": { "value": 0.63, "answer": "$0.63" }
}Agent docs: /llms.txt · OpenAPI spec · integration guide
About this tool
Ethereum fees are gas units × gas price. Typical operations use 21,000 gas (plain transfer), ~65,000 (ERC-20 transfer) and 100,000–200,000+ (DEX swaps). Enter the current gwei price and ETH price for the cost in USD.
fee(wei) = gasUnits × gweiPrice × 10⁹ · fee(USD) = fee(ETH) × ETH price
Frequently asked questions
Where do I find current gas prices?
Wallets and block explorers show live 'base fee' values in gwei; under EIP-1559 you pay base fee + tip, capped by your max fee setting.
What happens if I set the gas price too low?
The transaction waits in the mempool until the base fee drops to your price, or is dropped after a timeout. It cannot get 'stuck mid-payment'.