What Are Gas Fees, and How Do They Work?
Gas fees are the cost of running a transaction on a blockchain. Learn what sets the price, why it changes through the day, and how to keep it low.
On this page
Short answer
Gas fees are the payments users make to run a transaction or a smart contract call on a blockchain. The fee covers the computing work the network does and the storage it writes, and it rises when the network is busy. You can lower it by waiting for a quiet hour, using a layer 2 chain, or batching actions into one transaction.
What are gas fees?
Gas fees are the payments users make to run a transaction or a smart contract call on a blockchain. Every action on a chain costs computing work, and the fee pays the network to do that work and record the result.
The name comes from the idea that a transaction needs fuel. A simple transfer uses little fuel, while a complex smart contract call uses much more. The fee is set by how much work the action needs and how busy the network is at that moment.
| Action | Typical work | Fee level |
|---|---|---|
| Simple transfer | Move coins from one address to another | Low |
| Token transfer | Update token balances in a contract | Medium |
| Token swap | Run pricing and balance maths in a contract | Higher |
| NFT mint | Create and store new token data | Higher |
| Complex contract call | Many steps and storage writes | Highest |
Gas is not a separate coin. On Ethereum the fee is paid in ETH, and on other chains it is paid in that chain's own coin. The fee goes to the people who run the network, not to the app you are using.
What does a gas fee pay for?
A gas fee pays for the computing work and storage your transaction needs. Validators or miners run each step of the transaction, check that it follows the rules, and write the result to the chain. The fee compensates them for that work.
It also pays for security. Because every action costs something, it is expensive to flood the network with junk transactions. The fee is what makes spam costly and keeps the chain usable for everyone else.
How is a gas fee calculated?
A gas fee is calculated by multiplying the gas used by the gas price. Gas used measures the work: each step of a transaction has a fixed gas cost, and the total is the sum of those steps. Gas price is what you pay per unit of gas, usually quoted in gwei.
On Ethereum, the price has two parts since the London upgrade. The base fee is set by the network and rises when blocks are full; the priority fee, or tip, is what you add to get your transaction picked up sooner. A wallet usually suggests both numbers for you.
| Part | Who sets it | What it does |
|---|---|---|
| Gas limit | You, or your wallet | Caps the work a transaction may use |
| Gas used | The transaction itself | The work actually done |
| Base fee | The network | Rises when blocks are full, falls when they are empty |
| Priority fee | You | Tips validators to pick your transaction sooner |
One gwei is a billionth of an ether. A fee of 30 gwei on a transaction that uses 21,000 gas costs 630,000 gwei, which is 0.00063 ETH. Wallets show the total in the chain's coin so you can judge it before you confirm. If you are building the contract itself, read what smart contract development covers first.
Why do gas fees rise and fall?
Gas fees rise when many people want to use the chain at the same time. A popular token launch, a market rush or a busy hour can fill every block, so users bid higher priority fees to get in first. When demand drops, fees fall back.
The type of action matters too. A simple transfer competes for little space, while a contract call that writes a lot of data needs more gas and costs more. Network upgrades and layer 2 chains can lower fees by moving work off the main chain, which is why the same action can cost very different amounts on different chains. See what layer 2 is if that term is new to you.
How can you pay less in gas fees?
The simplest way to pay less is to wait for a quiet hour. Fees follow demand, so a transaction sent at a busy time can cost several times more than the same one sent a few hours later. A good hot wallet shows the fee estimate before you confirm, so check it every time.
- Use a layer 2 chain. Rollups batch many transactions together and share the cost, which is why a transfer there can cost far less than on the main chain.
- Batch your actions. Doing two things in one transaction is cheaper than sending two separate ones.
- Set a gas limit that fits. A limit that is far too high does not cost extra, but a limit that is too low fails and still burns the gas used.
- Check the priority fee. A small tip is enough when the network is quiet, so do not accept a wallet default that is far above the current base fee.
Never accept a fee you have not read. A wallet that shows the total cost before you confirm is doing its job, and a rushed click is how small transfers end up costing more than the amount they move.
Example (hypothetical): sending coins on a busy evening
Example (hypothetical): Maya wants to send 0.5 ETH to a friend. Her wallet estimates the transfer will use 21,000 gas. At a gas price of 30 gwei, the fee is 21,000 times 30, which is 630,000 gwei, or 0.00063 ETH.
An hour later the network is busy and the gas price rises to 120 gwei. The same transfer now costs 21,000 times 120, which is 2,520,000 gwei, or 0.00252 ETH. That is four times the earlier fee for the same 0.5 ETH.
Maya waits until the evening rush passes. The price falls back to 25 gwei, so the fee is 21,000 times 25, which is 525,000 gwei, or 0.000525 ETH. Waiting saved her 0.001995 ETH against the busy-hour price, and the transfer still arrived in the next block.
What are the common mistakes?
The most common mistakes are ignoring the fee estimate, setting a gas limit too low, and sending a small amount when the fee is larger than the transfer.
- Confirming without reading the fee. Always read the total before you approve, especially on a busy day.
- Setting a gas limit below what the transaction needs. The transaction fails, the gas already used is still charged, and you have to send it again.
- Paying a large fee on a tiny transfer. If the fee is more than the amount you are moving, wait or use a layer 2 chain.
- Assuming the fee is the same on every chain. Each chain has its own fee market, so check the current price on the chain you are using.
Key takeaways
- Gas fees pay for the computing work and storage a transaction needs
- The fee is gas used times gas price, usually quoted in gwei
- Base fees rise when blocks are full; priority fees buy faster pickup
- Fees follow demand, so the same action can cost far more at busy hours
- Waiting, layer 2 chains and batching are the main ways to pay less
Frequently asked questions
Do I pay gas fees on every transaction?
Yes, every transaction on a fee-based chain needs gas, even a simple transfer. The amount depends on how much work the transaction does and how busy the network is. Read the fee estimate in your wallet before you confirm.
What is gwei?
Gwei is a small unit of ether, equal to one billionth of an ETH. Gas prices are quoted in gwei so the numbers stay readable. A fee of 30 gwei on 21,000 gas is 630,000 gwei, which is 0.00063 ETH.
Why did my transaction fail but still cost gas?
A failed transaction still used computing work before it failed, and the network charges for that work. This usually happens when the gas limit is too low or the contract call cannot complete. Raise the limit next time.
Can gas fees be zero?
On most public chains they cannot, because the fee is what pays validators and stops spam. Some private chains and test networks charge no fee, but a public chain with no fee would be flooded with junk transactions.
Are gas fees lower on layer 2 chains?
Yes, in most cases. Layer 2 chains batch many transactions together and share the cost of writing to the main chain, so a transfer there can cost far less than the same transfer on the main chain.
What is the difference between gas limit and gas price?
The gas limit caps how much work a transaction may use, while the gas price is what you pay per unit of that work. The total fee is gas used times gas price, so both numbers shape what you pay.