What is a Gas Fee and How is it Calculated?
A gas fee is what you pay for the computing resources a transaction uses on Ethereum and similar networks. It equals the gas used multiplied by the price per unit of gas, quoted in gwei, and is paid in ETH.
On this page 11
- What is gwei?
- How do you calculate a gas fee? An example
- What are the base fee and priority fee?
- What is a gas limit?
- Why do failed transactions still cost gas?
- I have tokens. Why can’t I send them?
- Why does a swap involve two fees?
- Why do gas fees sometimes spike?
- How can you lower gas fees?
- Where can you see what you paid?
- Sources
A gas fee is what you pay for the computing resources a transaction uses on Ethereum and compatible networks. The formula is simple: gas fee = gas used × price per unit of gas. The price is usually quoted in gwei, and the fee is paid in ETH.
Gas measures how much work a transaction does; the gas price is what each unit of that work costs. Think of a road trip: the liters of fuel you burn and the price per liter are separate, and your total cost is the two multiplied. A simple ETH transfer uses little gas; a complex DeFi trade uses a lot.
What is gwei?
Gwei is a small denomination of ETH: 1 ETH equals 1,000,000,000 (one billion) gwei, so 1 gwei is 0.000000001 ETH. It exists so gas prices don’t need a string of zeros. Gwei isn’t a separate token, just a way of expressing ETH, the way cents express dollars.
How do you calculate a gas fee? An example
A plain ETH transfer always uses 21,000 gas. At a gas price of 10 gwei:
- 21,000 × 10 = 210,000 gwei
- 210,000 gwei = 0.00021 ETH
- With ETH at a hypothetical $3,000, the fee is $0.63.
Other actions use more. An ERC-20 token transfer typically takes a few tens of thousands of gas, and a swap on a decentralized exchange such as Uniswap often uses more than 100,000. At the same gas price, a swap can cost several times as much as a simple transfer. Your wallet’s estimate is specific to the action you’re taking.
What are the base fee and priority fee?
Since the EIP-1559 upgrade in August 2021, the gas price on Ethereum has had two parts:
- Base fee: set automatically by the protocol based on demand. If blocks are more than half full, it rises in the next block; if less, it falls. The base fee is burned, permanently removing that ETH from circulation.
- Priority fee: a tip to the validator to include your transaction. When the network is busy, a bigger tip gets you in sooner.
The max fee in your wallet is the most you’re willing to pay per unit of gas. What you actually pay is the base fee plus the priority fee at the moment of inclusion, and the difference is never charged. If the base fee rises above your max, the transaction waits until it falls back.
What is a gas limit?
The gas limit is the maximum amount of gas you allow a transaction to consume. It stops a buggy or malicious contract from burning unlimited resources. Wallets estimate it automatically; lowering it without knowing what you’re doing can make the transaction run out of gas mid-way. You aren’t charged for gas you don’t use.
Why do failed transactions still cost gas?
If a transaction runs out of gas or reverts because a contract condition isn’t met, its changes are undone, but validators have already done the computation and get paid for it. That’s why you can see “swap failed, fee charged.” Setting slippage tolerance too tight or miscalculating your balance are common causes of failed transactions.
I have tokens. Why can’t I send them?
On Ethereum, even sending a token requires ETH for gas. If your wallet holds 1,000 USDT and no ETH, the transfer won’t go through. Other networks follow the same rule with their own coin: POL on Polygon, BNB on BNB Chain, and ETH again on Layer 2s such as Arbitrum and Base. Your address may look identical across networks, but the balances are separate, so keep enough of the right coin on the right chain.
Why does a swap involve two fees?
The first time you trade a token, you usually have to approve the contract to spend it. That approval is its own transaction with its own gas fee; the swap comes after. On top of that you may pay the pool’s trading fee, an interface fee and slippage. None of those are gas, so look at each line separately to see the full cost. It’s also good practice to review the approvals you’ve granted from time to time; our guide on revoking token allowances shows how.
Why do gas fees sometimes spike?
Each Ethereum block has limited capacity, so when lots of people want to transact at once, they compete for space. The base fee climbs with every full block, and users raise their tips to get in first. Hyped NFT mints, new token launches and waves of liquidations during sharp market drops are typical triggers. At those moments even a simple transfer can cost several times the usual amount, and postponing non-urgent transactions is the easiest fix.
How can you lower gas fees?
- Timing: if it isn’t urgent, wait for quieter periods when the base fee is usually lower.
- Use Layer 2: the same action on Layer 2 networks such as Arbitrum, Optimism and Base is usually far cheaper. The Dencun upgrade in March 2024 cut their costs substantially.
- Avoid wasted transactions: repeated approvals and failed attempts multiply your costs.
- Count the full cost: moving funds to a Layer 2 means paying for a bridge, and on small amounts that can wipe out the savings.
Where can you see what you paid?
Open your transaction ID (TXID) on the right network’s block explorer, such as Etherscan. “Gas Used” shows how much gas was consumed, “Gas Price” the actual price per unit, and “Transaction Fee” the total. Exchange withdrawal fees are a different thing: platforms usually charge a flat fee that can be higher than the actual network cost you see on the explorer.
Sources
Read next
Related news
Topic archive ↗
Ethereum Protocol Halts Deposits and Withdrawals Amid 2,500 ETH Security Concerns

Ethereum’s Biggest Exchange Outflow in Four Months: Price Recovered After the Previous Major Outflow

Ethereum Developers Delay Upgrade Test: What Risk Do Smart Contracts Face?

Ethereum Investor Sells 3,000 ETH Bought Nine Years Ago for a 128x Return

Plan to Cut Ethereum’s 16-Minute Wait to Four: What Will Change for Transfers?
