Gas is the unit measuring computational effort required to execute operations on Ethereum. Every transaction consumes gas, from simple transfers (21,000 gas) to complex smart contract interactions (hundreds of thousands). You pay for gas in ETH, and the price fluctuates based on network demand. Gas prevents spam and compensates validators for processing your transactions.
What Is Gas?
3 min read
The short version
Gas is like postage for the Ethereum network. A simple letter (ETH transfer) needs one stamp. A heavy package (complex DeFi trade) needs many stamps. When the post office is busy, stamps cost more. You set a maximum you are willing to pay, and the network charges you only what your transaction actually consumed.
How It Works
Since EIP-1559 (activated August 5, 2021 at block 12,965,000), Ethereum gas pricing works with two components: a base fee (algorithmically set by the protocol, burned) and a priority fee (tip to validators). Gas cost = gas_used × (base_fee + priority_fee). The base fee adjusts every block: if the previous block was more than 50% full, the base fee increases up to 12.5%; if less than 50% full, it decreases. This creates predictable pricing. You set a maxFeePerGas (ceiling you will pay) and a maxPriorityFeePerGas (tip). If the actual base fee at inclusion time is lower than your max, you pay less. Gas limits vary by operation: ETH transfer = 21,000 gas. ERC-20 token transfer = ~65,000 gas. Uniswap swap = ~150,000-300,000 gas. NFT mint = ~100,000-250,000 gas.
Calculating the cost of a Uniswap swap
You want to swap USDC for ETH on Uniswap. The transaction uses 184,000 gas. Current base fee: 25 gwei (1 gwei = 0.000000001 ETH). You set a priority fee of 2 gwei. Total per gas: 27 gwei. Cost: 184,000 × 27 gwei = 4,968,000 gwei = 0.004968 ETH. At $3,000/ETH, that is $14.90. If you had done the same swap at 3 AM UTC when the base fee was 8 gwei, the cost would be: 184,000 × 10 gwei = 0.00184 ETH = $5.52. Same transaction, different timing, 63% savings.
What People Get Wrong
Gas fees go to Ethereum developers
Since EIP-1559, the base fee is burned (permanently destroyed). Only the priority fee (tip) goes to validators. No fees go to the Ethereum Foundation or core developers.
Setting a higher gas limit means paying more
The gas limit is a maximum, you are only charged for gas actually consumed. Setting a higher limit protects against transaction failure but does not increase cost if the transaction uses less. However, if a transaction fails mid-execution, you still pay for the gas consumed up to the failure point.
Layer 2 networks do not use gas
L2s like Arbitrum and Optimism still use gas for execution, but at drastically lower prices (often 10-100x cheaper) because they batch many transactions into one L1 submission. You still pay gas, just much less of it.
You can avoid gas fees entirely
Every on-chain action requires gas. Some protocols abstract it (gasless transactions via meta-transactions or paymasters), but someone is always paying, it is just sometimes the dApp or a sponsor rather than you directly.
Keep Reading
Sources & Further Reading
- Ethereum.org: Gas and Fees
Official docs covering EIP-1559, base fees, priority fees, and gas limits
- Etherscan Gas Tracker
Real-time gas prices across slow/standard/fast tiers
- ultrasound.money
Live ETH burn tracking showing gas burned per block and net issuance
Questions People Also Ask
- Why did my transaction fail but I still paid gas?
- If your transaction runs out of gas mid-execution or hits a revert condition in a smart contract, all state changes are undone but the gas consumed up to that point is still paid. Validators did the computation work even though the end result was a failure. Set adequate gas limits and check contract conditions before sending.
- When is gas cheapest?
- Generally between midnight and 6 AM UTC on weekends, when US and European users are least active. Tools like Etherscan Gas Tracker or ultrasound.money show real-time and historical gas prices. Non-urgent transactions can save significantly by waiting for low-traffic periods.
- What is the difference between gas price and gas limit?
- Gas limit is the maximum units of computation you allow. Gas price (base fee + tip) is what you pay per unit. Total cost = gas_used × gas_price. The limit prevents runaway costs; the price determines your fee per unit of work.