Explainers
What gas is on Ethereum, and why fees change
Gas is Ethereum’s unit of computational work, and a transaction fee is the gas a transaction uses multiplied by a price per unit. The two halves move for different reasons: the amount depends on what the transaction does, and the price depends on how many other people want the same block. Since 2021 the price has had two parts, a base fee the protocol sets and burns and a tip that goes to whoever produces the block. Rollups add a third cost, for posting their data to Ethereum, which since 2024 can be paid in a separate market for blobs.
Units and price
ethereum.org’s gas page defines gas as the unit that measures the computational effort needed to run operations on the network, and the fee as the amount of gas used multiplied by the cost per unit. It exists so that computation is paid for: without a price, the network would be open to spam and to code that loops forever.
The amount is a property of the transaction. A plain transfer of ether uses 21,000 gas, a figure EIP-1559 carries as the base intrinsic cost of its transaction type. A swap, a loan or anything else that runs contract code uses more, because each operation has its own cost in the protocol’s schedule. Those costs are not fixed for ever; upgrades reprice operations, and the Glamsterdam upgrade’s meta EIP lists several such repricings among the changes scheduled for it.
The price is quoted in gwei. One gwei is one-billionth of an ether, 10⁻⁹ ETH, and the fee is always paid in ether, whatever token the transaction moves. That is why an account holding tokens but no ether cannot move them on its own, a constraint the MetaMask recovery phrase piece flags for anyone recovering a compromised wallet.
Every transaction also states a gas limit, the most it will consume. ethereum.org gives the arithmetic: set a limit of 50,000 on a transfer that needs 21,000, and the remaining 29,000 is returned. The limit is a cap on what the sender is willing to spend, not an amount spent.
The base fee and the priority fee
EIP-1559 replaced a simple auction, in which each transaction bid a price and paid it, with two components. It was introduced in the London upgrade, which ethereum.org’s history of upgrades dates to 5 August 2021.
The base fee is a price per gas that the protocol sets for each block from the block before it. Each block has a gas target, defined as its gas limit divided by an elasticity multiplier of 2. If the previous block used more gas than the target, the base fee rises; if less, it falls. The change is proportional to the gap and capped by a denominator of 8, so the most it can move in one block is 12.5%. Every transaction in the block pays the same base fee, and the base fee is burned: in the EIP’s reference code the block producer receives only the priority fee, and the base fee is given to no one.
The priority fee is a tip per gas paid to the block producer. ethereum.org describes it as the incentive for validators to include transactions at all, since their staking rewards do not depend on how many transactions a block holds, and as the way a sender signals urgency. It is one of the payers in where crypto yield comes from, alongside issuance.
A sender sets two ceilings, a maximum fee per gas and a maximum priority fee per gas. Per the EIP’s code, the tip actually paid is the smaller of the maximum priority fee and whatever is left of the maximum fee after the base fee, and the sender is refunded for gas not used. ethereum.org’s worked example: a transfer using 21,000 gas at a base fee of 10 gwei and a tip of 2 gwei costs 21,000 × 12 = 252,000 gwei, or 0.000252 ETH, of which 0.00021 ETH is burned and 0.000042 ETH goes to the validator.
The burn is also a supply mechanism. The EIP’s authors wrote that it counterbalances issuance, and that keeping the base fee from the block producer removes any incentive to manipulate it. How burns and issuance net out in a token’s supply is the kind of question the tokenomics piece works through.
Why fees spike
Fees rise when more people want block space than the target allows, and the base fee rule makes the rise steep. At 12.5% per full block, the base fee doubles after six consecutive full blocks (1.125⁶ ≈ 2.03) and is about ten and a half times higher after twenty. ethereum.org’s blocks page spaces slots twelve seconds apart, so six full blocks take a little over a minute. ethereum.org’s own table runs the same rule from 100 gwei and reaches more than 2,700 gwei by block 30. The gas page adds that sustained spikes are unlikely for exactly that reason: the base fee climbs fast enough to price demand back down to the target.
The tip rises for a different reason. When many transactions want the same block, the ones that pay more are included first, and where a trade’s profit depends on its position in a block, bots compete to outbid one another; that competition is where maximal extractable value began. The EIP’s motivation section describes the old system’s fees as extremely volatile once blocks were full, and the two-part design is meant to make the base fee predictable from block to block even when the total is high.
The other driver is the transaction itself. ethereum.org notes that complex contract applications can perform many operations and so consume a lot of gas. The same swap costs the same gas whether the network is quiet or busy. What changes is the price of each unit.
What a failed transaction still costs
The gas page says it plainly: the fee is paid whether a transaction succeeds or fails. A failure undoes the transaction’s changes, but the work the network did before it stopped still has to be paid for. How much depends on how it failed.
If execution runs past the gas limit, ethereum.org says, the changes are
reverted and all the gas provided is consumed. A contract can instead stop
itself with the REVERT instruction, which
EIP-140 introduced so that execution
could be aborted and rolled back without consuming all the remaining gas; the
sender then pays for the gas used up to that point. And a limit below what the
transaction needs just to start, such as 20,000 for a 21,000-gas transfer, is
rejected before it is included, in which case ethereum.org says no gas is
consumed at all.
An illustration with invented numbers. A swap is sent with a gas limit of 200,000, at a base fee of 20 gwei and a tip of 1 gwei. If it succeeds using 150,000 gas, it costs 150,000 × 21 = 3,150,000 gwei, or 0.00315 ETH. If the price moves and the router’s minimum-output check fails after 90,000 gas, the contract reverts and the swap still costs 90,000 × 21 = 1,890,000 gwei, or 0.00189 ETH. If it runs out of gas, it costs the whole 200,000, or 0.0042 ETH. That revert is the cost of a slippage tolerance set too tight, which what MEV is weighs against the cost of one set too loose.
Layer 2 fees, and blobs
A rollup executes transactions on its own chain and posts their data to Ethereum, so its fee has two kinds of part. OP Mainnet’s fee documentation is a clear example. The execution fee works as on Ethereum, with its own EIP-1559 base fee (a few parameters differ, for the shorter block times) and priority fee, and the gas a transaction uses is the same as it would be on Ethereum; the price per unit is lower. On top sits an L1 data fee for publishing the transaction to Ethereum, set by the transaction’s compressed size and by Ethereum’s fees, and, since that network’s Isthmus upgrade, an operator fee. The page notes that a transaction cannot cap the L1 data fee it is willing to pay. Other rollups divide their fees differently; layer 2 explained covers the designs, and what is Base takes one rollup in detail.
The data part is where EIP-4844 comes in. It added blob-carrying transactions, which attach large pieces of data that the Ethereum virtual machine cannot read, though contracts can see a commitment to them. Each blob is 4,096 field elements of 32 bytes, 128 KiB. Blobs have their own blob gas and their own base fee, which rises exponentially with how far blob usage runs above target, at most about 12.5% per block in the EIP’s original parameters. The blob fee is burned and, the EIP specifies, not refunded if the transaction fails. Nodes keep blobs for 4,096 epochs, about 18 days, rather than for ever, which is what makes them cheaper than ordinary calldata. ethereum.org’s danksharding page says the change went live with the Dencun upgrade in March 2024.
The blob count per block has been raised since. EIP-4844 set a target of three blobs and a maximum of six. EIP-7691, part of the Pectra upgrade, raised them to six and nine. The Fusaka upgrade, which ethereum.org’s Fusaka page says went live on 3 December 2025, added blob-parameter-only forks for raising the count without a full upgrade, and EIP-7918, which gives blobs a reserve price tied to the execution base fee so the blob fee can no longer sink to almost nothing while execution is expensive. The consensus specification’s mainnet configuration, as it stood on 22 November 2026, schedules a maximum of 15 blobs per block from 9 December 2025 and 21 from 7 January 2026. Each further fork of that kind can change the figure again.
The practical consequence is that a rollup fee has two moving inputs: demand on the rollup itself, and the price of data on Ethereum. Either can move the total.
Fees that are not gas
Not every charge that looks like a network fee is one. An exchange’s crypto withdrawal fee is often a fixed amount it sets, which the exchange fees piece explains can sit well above the gas the withdrawal actually costs. And a worse price from a sandwiched trade appears nowhere as a fee at all.
Gas is the part that can be reconstructed exactly from public records. The transaction carries its gas limit and its two fee ceilings, the block carries its base fee, and the receipt records the gas used and whether the transaction succeeded. When a fee looks wrong, those numbers are where to start: the gas used, multiplied by the base fee plus the tip actually paid. On a rollup there is one more input, the data fee, and it depends on a market the user does not see. Addresses on rollups also look like Ethereum addresses, a separate trap set out in why wallets are chain specific.