Gas Fee Optimizer
Estimate optimal gas price and transaction timing for Ethereum network transactions. Compare L1 vs L2 costs and find the best time to transact.
Gas Fee Optimizer
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Total Fee = (Base Fee + Priority Fee) x Gas Limit / 10^9 x ETH Price
Worked example โ Gas fee: 0.000567 ETH ($1.70) | Burned: 0.000525 ETH | Tip: 0.000042 ETH
Formula
Total Fee = (Base Fee + Priority Fee) x Gas Limit / 10^9 x ETH Price
Under EIP-1559, the total gas fee is the sum of the base fee (burned) and priority fee (tip to validator), multiplied by the gas units consumed. The result in gwei is converted to ETH by dividing by 10^9, then to USD by multiplying by the current ETH price.
Worked Examples
Example 1: Simple ETH Transfer Cost
Problem:Calculate the gas fee for an ETH transfer with base fee 25 gwei, priority fee 2 gwei, and ETH price $3,000.
Solution:Max fee per gas = 25 + 2 = 27 gwei Gas limit for ETH transfer = 21,000 Total gas = 27 x 21,000 = 567,000 gwei Total in ETH = 567,000 / 1,000,000,000 = 0.000567 ETH Total in USD = 0.000567 x $3,000 = $1.70 Burned: 25 x 21,000 = 525,000 gwei (0.000525 ETH) Tip to validator: 2 x 21,000 = 42,000 gwei (0.000042 ETH)
Result:Gas fee: 0.000567 ETH ($1.70) | Burned: 0.000525 ETH | Tip: 0.000042 ETH
Example 2: Uniswap Swap During Congestion
Problem:Calculate swap gas fee with base fee 80 gwei, priority fee 5 gwei, 150,000 gas limit, ETH at $3,000.
Solution:Max fee per gas = 80 + 5 = 85 gwei Gas limit for swap = 150,000 Total gas = 85 x 150,000 = 12,750,000 gwei Total in ETH = 12,750,000 / 1,000,000,000 = 0.01275 ETH Total in USD = 0.01275 x $3,000 = $38.25 On Arbitrum L2: ~$0.76 (98% savings)
Result:L1 fee: 0.01275 ETH ($38.25) | Arbitrum: ~$0.76 | Savings: $37.49
Frequently Asked Questions
What are gas fees on Ethereum and how are they calculated?
Gas fees are payments made by users to compensate for the computational energy required to process and validate transactions on the Ethereum blockchain. Every operation on Ethereum, from simple ETH transfers to complex smart contract interactions, requires a certain amount of gas measured in units. The total fee is calculated by multiplying the gas used by the gas price in gwei (1 gwei = 0.000000001 ETH). A simple ETH transfer uses 21,000 gas units, while a Uniswap token swap might use 150,000 gas units. When the network is congested with many pending transactions, gas prices rise as users compete to have their transactions included in the next block.
What is EIP-1559 and how does it change gas pricing?
EIP-1559, implemented in August 2021 via the London hard fork, fundamentally changed Ethereum gas pricing from an auction model to a base fee plus priority tip model. The base fee is algorithmically determined by the network based on block utilization and is burned (destroyed), reducing ETH supply. Users also include a priority fee (tip) to incentivize validators to include their transaction. The base fee adjusts up when blocks are more than 50% full and down when they are less than 50% full, creating more predictable pricing. This replaced the old system where users blindly bid gas prices and frequently overpaid. The burning mechanism also introduced deflationary pressure on ETH supply.
When are gas fees lowest and how can I save money?
Gas fees follow predictable patterns based on network activity. Fees are typically lowest during weekends, especially Saturday and Sunday mornings UTC, and during off-peak hours between 1 AM and 5 AM UTC on weekdays. Fees are highest during US and European business hours on weekdays, and spike during major NFT drops, token launches, or market volatility events. To save money, batch multiple operations together, use Layer 2 solutions like Arbitrum, Optimism, or Base for routine transactions, and time non-urgent transactions during off-peak periods. Setting a lower max fee and being patient can also save significantly since many wallets default to overpaying.
What are Layer 2 solutions and how do they reduce gas fees?
Layer 2 (L2) solutions are separate blockchains built on top of Ethereum that process transactions off the main chain while inheriting its security. They dramatically reduce gas fees by bundling hundreds or thousands of transactions together and posting a single compressed proof to Ethereum L1. Optimistic rollups like Arbitrum and Optimism assume transactions are valid and only check if challenged, while zero-knowledge rollups like zkSync and StarkNet use cryptographic proofs to verify transactions mathematically. Typical L2 fees are 90-99% lower than L1, making a $5 L1 swap cost just $0.05-0.50 on L2. Users bridge assets from L1 to L2 and then transact cheaply within the L2 ecosystem.
How do different transaction types affect gas costs?
Different Ethereum operations require varying amounts of computational work, directly impacting gas consumption. A simple ETH transfer is the cheapest at 21,000 gas units because it only updates two account balances. ERC-20 token transfers use approximately 65,000 gas because they involve smart contract execution and storage updates. Token approvals cost about 46,000 gas. Decentralized exchange swaps use 100,000-200,000 gas depending on routing complexity and number of pools involved. NFT minting typically uses 100,000-150,000 gas. Contract deployments are the most expensive, consuming 500,000 to several million gas units depending on code size. Understanding these differences helps users budget appropriately for their on-chain activities.
What is the difference between the gas limit and the gas actually used?
The gas limit is the ceiling you authorise for a transaction; gas used is what execution actually consumed. You are charged only for gas used, and the unused remainder is never taken, so setting a generous limit costs nothing extra by itself. The danger is the opposite: if execution needs more than the limit, it halts with an out-of-gas error, the state change is reverted, and the gas consumed up to that point is still charged. Wallets estimate the limit by simulating the call, which can be wrong if state changes before inclusion.
How do maxFeePerGas and maxPriorityFeePerGas interact?
maxPriorityFeePerGas is the tip you offer the proposer; maxFeePerGas is the absolute most you will pay per unit of gas including the burned base fee. The price you actually pay is the base fee of the including block plus your tip, capped at your max fee, and anything you authorised above that is refunded automatically. So raising the max fee buys tolerance for a rising base fee rather than a higher price, while raising the tip is what buys faster inclusion.
How fast can the base fee move, and what does that mean for a pending transaction?
EIP-1559 lets the base fee change by at most one eighth, 12.5 percent, per block, up when the previous block was more than half full and down when it was less. Because moves are bounded, a spike takes several blocks to build and several to decay, which is what makes fees forecastable a few minutes ahead. It also means a transaction whose max fee sits modestly below the current base fee may become includable within a handful of blocks once demand eases, so waiting is often cheaper than resubmitting.
How do I speed up or cancel a transaction that is stuck in the mempool?
Replace it rather than send a new one. Broadcast another transaction from the same address with the same nonce and a higher fee: to accelerate, keep the original destination and data; to cancel, send zero ETH to yourself so the nonce is consumed harmlessly. Clients generally require a meaningful bump over the original fee before they will accept the replacement, and only one of the two can ever be mined because a nonce can be used once.
Why does a Layer 2 transaction still carry a fee that moves with Ethereum?
A rollup fee has two parts: a small execution charge on the L2 itself, and the share of the cost of publishing your transaction's data to Ethereum for availability. That second component tracks L1 pricing, which is why L2 fees rise during mainnet congestion. Blob-carrying transactions introduced a separate, cheaper fee market for that rollup data, sharply reducing the L1 component, but it remains the reason L2 costs are not fixed.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎDEX Swap Fee Calculator
Calculate total swap costs on Uniswap, SushiSwap, and PancakeSwap including slippage and gas.
โฝCrypto Gas Fee
Estimate Ethereum and EVM chain gas fees in Gwei, USD, and native token for transfers, swaps, and smart contract interactions
๐งฎCrypto Exchange Fee Comparison Calculator
Compare trading fees across Binance, Coinbase, Kraken, and Bybit for your volume tier.
๐งฎWeb3 Gas Price Tracker Calculator
Calculate average gas prices and optimal transaction timing across EVM chains.
๐งฎSmart Contract Gas Estimator
Estimate gas costs for deploying and interacting with smart contracts on EVM chains.
๐งฎCross-Chain Bridge Fee Calculator
Compare bridging fees across Stargate, Across, LayerZero, and Wormhole for token transfers.
๐งฎLayer 2 Fee Comparison Calculator
Compare transaction fees across Arbitrum, Optimism, Base, zkSync, and Polygon.
๐งฎFlash Loan Arbitrage Profit Calculator (DeFi)
Calculate potential flash loan arbitrage profit from price difference, loan amount, and gas.