MrDeFi
Ethereum2026-05-054 min read

How Ethereum Gas Fees Work: A Complete Explainer

How Ethereum gas fees work: understand gas units, gas price, base fee, and tips, and how your transaction cost gets calculated.

Ethereum gas fees are the cost paid to have a transaction processed by the network, calculated by multiplying the amount of computational work a transaction requires (gas units) by the price per unit of gas, which itself is split into a network-set base fee and an optional tip to validators.

Every action on Ethereum, from a simple ETH transfer to a complex DeFi swap, consumes computational resources on every node that processes it. Gas is the unit that measures and prices that consumption. Understanding the formula behind your transaction cost helps explain why fees spike during busy periods and how to avoid overpaying. For the underlying execution model, see our explainer on what the EVM is.

The basic gas fee formula

Total transaction fee is calculated as:

Gas units used × Gas price (in gwei) = Total fee

Gwei is a denomination of ETH (one billionth of an ETH), used because gas prices in whole ETH would be impractically small numbers. The two components work as follows:

  • Gas units: How much computational work the transaction requires. A simple ETH transfer uses a fixed, small amount of gas (21,000 units). A complex smart contract interaction — like a multi-step DeFi swap — can use hundreds of thousands of units.
  • Gas price: How much you're willing to pay per unit, expressed in gwei. This is where market demand comes in.

Base fee and tip: the EIP-1559 model

Since the Ethereum upgrade known as EIP-1559, gas price is split into two parts:

  • Base fee: A protocol-determined fee per gas unit that adjusts automatically block by block based on how full the previous block was. If blocks are consistently more than half full, the base fee rises; if they're less full, it falls.
  • Priority fee (tip): An optional additional amount paid directly to the validator to prioritize inclusion, especially useful during high demand.

A key feature of this system: the base fee is burned (permanently removed from circulation) rather than paid to validators, while the tip goes to whoever validates the block. This burn mechanism has made ETH's supply dynamics tied directly to network usage — more activity means more ETH burned.

Example calculation

Suppose a swap on a decentralized exchange requires 150,000 gas units, the current base fee is 20 gwei, and you add a 2 gwei tip.

Component Value
Gas units 150,000
Base fee 20 gwei
Priority fee (tip) 2 gwei
Total gas price 22 gwei
Total fee 150,000 × 22 gwei = 3,300,000 gwei = 0.0033 ETH

The dollar cost then depends on ETH's market price at the time. This is why the same transaction can feel cheap or expensive depending both on network congestion (affecting gas units' price) and ETH's price (affecting the dollar conversion).

Why gas fees spike

Gas fees rise when many people try to transact at once and total demand for block space exceeds supply. Popular NFT mints, major DeFi launches, or broad market volatility events historically have driven short-term base fee spikes, sometimes by an order of magnitude, because everyone is competing to get included in the next block.

Gas fees vs other blockchain fee models

Network type Fee mechanism Typical cost pattern
Ethereum mainnet Gas units × (base fee + tip), base fee burned Variable, can spike sharply with demand
Ethereum layer 2 (rollups) Similar gas model but cheaper execution, batched settlement to mainnet Generally much lower and more stable
Bitcoin on-chain Fee rate based on transaction size in virtual bytes Variable with block space demand
Bitcoin Lightning Small routing fee per hop Typically near-zero, more stable

Our comparison of Bitcoin on-chain vs Lightning fees covers the Bitcoin side of this pattern in more depth.

Where gas fees fit into DeFi activity

Gas costs directly affect the profitability of DeFi strategies, particularly ones involving frequent transactions. Activities like yield farming, adjusting positions to manage impermanent loss, or avoiding a liquidation event all require timely, sometimes repeated transactions — and high gas fees can erode returns on smaller positions. Our yield farming guide and impermanent loss explainer discuss these dynamics further.

Bottom line

Ethereum gas fees reflect real computational cost, priced through a base fee that adjusts with network demand plus an optional tip for faster inclusion. Understanding the gas units × gas price formula — and how EIP-1559's burn mechanism works — makes it easier to predict costs and, as covered in our companion piece on how to reduce Ethereum gas fees, to avoid overpaying.

Related articles

This article is for educational purposes only and is not financial advice. DeFi involves significant risk, including total loss of funds. Always do your own research.