# Understanding Gas Fees: Why Transactions Cost What They Cost

*A deep dive into how gas fees work on Ethereum and L2s, what factors drive prices, and how to minimize your costs.*

By [Onchain Diary](https://paragraph.com/@onchaindiary) · 2026-07-19

security, crypto, onchaindiary

---

Why Do Gas Fees Exist?
----------------------

Every action on a blockchain — sending tokens, interacting with a smart contract, minting an NFT — requires computational resources. Gas fees are the mechanism that ensures those resources are compensated and that the network isn't spammed with free transactions.

The Anatomy of a Gas Fee
------------------------

A gas fee has two main components:

1.  **Gas Limit**: The maximum amount of gas units you're willing to spend. A simple ETH transfer uses 21,000 gas units. More complex operations (like swapping tokens on a DEX) can use 100,000–300,000+.
    
2.  **Gas Price**: How much you pay per gas unit, measured in gwei (1 gwei = 0.000000001 ETH).
    

`Total Fee = Gas Limit × Gas Price (in gwei) × 0.000000001 ETH/gwei`

EIP-1559: Base Fee + Priority Fee
---------------------------------

Since August 2021, Ethereum uses a two-part fee structure:

*   **Base Fee**: Set by the protocol, adjusts automatically based on network demand. This portion is **burned** (permanently removed from supply).
    
*   **Priority Fee (Tip)**: Optional tip to validators to prioritize your transaction.
    

What Drives Gas Prices?
-----------------------

Gas prices fluctuate based on simple supply and demand:

*   **Block space is limited**: Ethereum targets ~15 million gas per block
    
*   **High-demand events**: NFT mints, popular token launches, or airdrop claims can spike fees to 100+ gwei
    
*   **Time of day**: Fees are typically lower during Asian and European nighttime hours
    

How to Save on Gas
------------------

1.  **Use Layer 2s**: Arbitrum, Optimism, and Base offer 10–100x lower fees
    
2.  **Time your transactions**: Use tools like Gas Now or Etherscan Gas Tracker to find low-fee windows
    
3.  **Batch transactions**: Some wallets and protocols support batching multiple operations
    
4.  **Set appropriate gas limits**: Don't overpay by setting unnecessarily high limits
    

Try Our Calculator
------------------

Use our [Gas Fee Calculator](https://theonchaindiary.com/tools/gas-calculator/) to estimate your transaction costs across different networks.

* * *

_Originally published at_ [_https://theonchaindiary.com/articles/understanding-gas-fees/_](https://theonchaindiary.com/articles/understanding-gas-fees/)_. More Web3 security guides and risk-scoring tools at_ [_Onchain Diary_](https://theonchaindiary.com)_._

---

*Originally published on [Onchain Diary](https://paragraph.com/@onchaindiary/understanding-gas-fees)*
