What Is a Gas Refund?
A gas refund is a reduction in the final gas charged for a blockchain transaction after the Ethereum Virtual Machine completes its execution.
The term can also refer more generally to unused gas that is returned when a transaction consumes fewer gas units than its specified gas limit.
These two meanings are related, but they describe different parts of Ethereum’s transaction accounting system.
Unused gas comes from the difference between the transaction’s gas limit and the amount of gas consumed during execution.
A protocol-level gas refund comes from a refund counter that may receive credits when a smart contract performs certain eligible storage operations.
Ethereum applies protocol refunds automatically, so users do not need to submit a claim, contact a validator, or visit a refund website.
A gas refund is measured in gas units before its monetary value is calculated in ETH.
The ETH value of the refund depends on the transaction’s effective price per gas unit.
Gas refunds cannot make an Ethereum transaction completely free because current protocol rules limit how much of the transaction’s gas consumption can be refunded.
What Are the Two Types of Gas Refund?
The phrase gas refund is commonly used for both unused transaction gas and EVM refund-counter credits.
Unused gas is gas that the sender authorized through the gas limit but the transaction never consumed.
For example, a transaction with a gas limit of 100,000 that completes after consuming 60,000 gas does not charge the sender for the remaining 40,000 gas units.
The official Ethereum gas documentation explains that the gas limit is the maximum amount of gas a transaction is allowed to consume rather than a guaranteed final charge.
An EVM gas refund is different because it reduces gas consumption after eligible operations have already been executed and recorded in the transaction’s refund counter.
The most important current example is clearing an eligible persistent storage slot by changing its value from nonzero to zero.
Both mechanisms reduce the final cost, but only the second mechanism is technically called the EVM refund counter.
How Ethereum Gas Payments Work
Gas is the unit Ethereum uses to measure the computational and storage resources required by a transaction.
Every EVM operation has a gas cost based on the resources it requires from Ethereum nodes.
A basic ETH transfer to a normal externally owned account generally requires 21,000 gas units.
A token transfer, decentralized finance transaction, NFT operation, or complex smart contract call may require substantially more gas.
The sender specifies a gas limit that places a maximum on the amount of execution gas the transaction can consume.
The sender must also specify fee parameters that determine the maximum price the sender is willing to pay for each gas unit.
Under the fee model introduced by EIP-1559, a normal transaction can include a maximum fee per gas and a maximum priority fee per gas.
The base fee is determined by the protocol and is burned when the transaction is included in a block.
The priority fee is paid to the block proposer as compensation for including the transaction.
The final transaction cost depends on the gas units charged and the effective gas price rather than simply multiplying the full gas limit by the maximum fee.
How Unused Gas Is Returned
A transaction’s gas limit is a safety ceiling rather than an amount that must be fully spent.
If a user submits a transaction with a gas limit of 150,000 and the transaction needs only 90,000 gas, the unused 60,000 gas is returned through transaction accounting.
The user does not receive a separate incoming ETH transfer representing this unused amount.
Instead, the final balance reflects that the unused gas was not permanently charged.
A wallet may temporarily display a maximum possible network cost before the transaction is confirmed.
The confirmed cost can be lower because the transaction used less than the gas limit or because the effective gas price was lower than the maximum fee.
Setting a higher gas limit does not normally make a successful transaction more expensive when the additional gas is not consumed.
However, the sender must have enough ETH to satisfy the transaction’s maximum funding requirements when it is submitted.
A gas limit that is too low can cause the transaction to fail before or during execution.
What Is the EVM Refund Counter?
The EVM refund counter is an internal accounting value maintained while a transaction executes.
Eligible operations can increase the counter, while later operations may reduce a previously added refund.
The counter does not add gas to the amount available for smart contract execution.
It is applied only after execution has completed.
This means a contract cannot depend on a future refund to prevent an out-of-gas failure during the same transaction.
The refund counter is mainly connected to persistent storage changes performed with the
SSTORE
opcode.
Ethereum’s EIP-2200 net gas metering rules compare the original, current, and new values of a storage slot to calculate charges and refunds.
This system prevents contracts from receiving an excessive reward for repeatedly changing the same slot within one transaction.
If execution reverts, refund credits associated with the reverted state changes do not survive as usable protocol refunds.
Current Ethereum Gas Refund Rules
Ethereum’s current core gas-refund rules were established by EIP-3529 during the London upgrade.
The upgrade removed the gas refund previously associated with
SELFDESTRUCT
.
It reduced the standard refund for clearing an eligible storage slot from 15,000 gas to 4,800 gas.
It also reduced the maximum applied refund from one-half of gross gas used to one-fifth.
One-fifth is equal to 20%.
As a result, a transaction must still be charged for at least 80% of its gross gas usage after the protocol refund is applied.
Later Ethereum upgrades changed other gas prices and EVM behavior, but they did not restore the old refund system.
The official Ethereum network-upgrade timeline identifies EIP-3529 as the London proposal that reduced EVM gas refunds.
How the 20% Gas Refund Cap Works
The maximum applied protocol refund is calculated by dividing the transaction’s gross gas usage by five.
The basic formula is Applied Refund = Minimum of Refund Counter and Gross Gas Used ÷ 5.
The final billed gas is the gross gas used minus the applied refund.
Suppose a transaction consumes 100,000 gas before refunds and creates a refund counter of 30,000 gas.
The maximum refund is 20,000 gas because 100,000 divided by five equals 20,000.
The transaction is therefore billed for 80,000 gas rather than 70,000 gas.
Suppose another transaction consumes 100,000 gas but creates a refund counter of only 8,000 gas.
The complete 8,000-gas refund can be applied because it is below the 20,000-gas maximum.
The transaction is then billed for 92,000 gas.
Refund counter credits that exceed the cap are not saved for another transaction.
How an SSTORE Gas Refund Works
SSTORE
is the EVM operation used to write a value into a smart contract’s persistent storage.
Persistent storage remains part of Ethereum’s state after the transaction ends.
Creating new persistent state is expensive because Ethereum nodes may need to maintain that information indefinitely.
Clearing an eligible nonzero storage value to zero can add 4,800 gas to the refund counter.
This refund provides an economic incentive for smart contracts to remove storage that is no longer required.
The 4,800-gas figure is a refund credit rather than an immediate payment of 4,800 gas units.
The transaction must consume enough other gas to apply the full credit under the 20% cap.
A 4,800-gas refund requires at least 24,000 gross gas usage to be fully applied because 20% of 24,000 is 4,800.
If several storage slots are cleared in a low-cost transaction, part of the accumulated refund may be lost to the cap.
Why Storage Refund Calculations Can Be Complicated
A storage slot can be modified several times within one transaction.
The EVM therefore examines the slot’s original value, its current value, and the new value being written.
The original value is the value that existed before the transaction began.
The current value is the value present after any earlier writes in the same transaction.
The new value is the value requested by the current
SSTORE
operation.
A transaction that changes a slot from zero to nonzero and then restores it to zero is treated differently from a transaction that permanently deletes an older nonzero value.
Some refund-counter changes reverse part of an earlier storage charge rather than rewarding the permanent removal of historical state.
Warm and cold storage-access rules introduced by EIP-2929 also affect the gross cost of accessing a slot.
Developers should use current compiler tools, execution traces, and transaction simulations instead of relying only on a simplified storage-cost chart.
Gas Refund Example With ETH Fees
Suppose a smart contract transaction consumes 120,000 gross gas and creates 10,000 gas units of eligible refund credits.
The 20% cap is 24,000 gas because 120,000 divided by five equals 24,000.
The full 10,000-gas refund can therefore be applied.
The final billed gas usage is 110,000 gas.
If the effective gas price is 20 gwei, the final fee is 2,200,000 gwei.
This amount equals 0.0022 ETH.
Without the protocol refund, the gross fee would have been 0.0024 ETH.
The refund therefore saves 0.0002 ETH in this example.
The same number of refunded gas units would have a higher ETH value during a period with a higher effective gas price.
Gas Refunds and EIP-1559
EIP-1559 and EVM gas refunds affect different parts of transaction fee accounting.
EIP-1559 determines the effective price paid for each billed gas unit.
The EVM refund mechanism helps determine how many gas units are ultimately billed.
The effective gas price generally equals the base fee plus an eligible priority fee, subject to the sender’s maximum fee settings.
The base-fee portion of the final charge is burned by the Ethereum protocol.
The priority-fee portion is paid to the block proposer.
When the sender’s maximum fee is higher than the required effective gas price, the difference is not retained as an additional transaction fee.
Wallet interfaces sometimes describe this unused maximum allowance as a refund even though it is separate from the EVM refund counter.
The final cost can therefore be lower than the displayed maximum because of unused gas, a lower effective price, protocol refund credits, or a combination of these factors.
Are Gas Refunds Paid by Validators?
Validators do not manually send protocol gas refunds to users.
Refund processing is part of Ethereum’s consensus rules and is calculated by execution clients.
Every correctly functioning Ethereum node independently applies the same gas-accounting rules when verifying the transaction.
The block proposer receives only the eligible priority-fee portion of the final charge.
The base-fee portion is burned after the transaction’s final billable gas usage has been determined.
A user does not need permission from a validator to receive unused gas or an eligible storage refund.
No validator can legitimately request a processing payment to release an Ethereum gas refund.
What Happens When a Transaction Reverts?
A reverted transaction normally reverses its state changes but still charges for the computation performed before the revert.
Gas that remains unused when the
REVERT
operation occurs can be returned to the sender.
Refund credits associated with storage changes that were reverted are not retained as if those changes had completed successfully.
A user therefore cannot create refund credits inside a call that is intentionally rolled back and still receive the financial benefit.
The exact fee depends on how much execution occurred before the failure and how much gas remained.
A reverted transaction can be expensive even though no token transfer or contract state change remains after execution.
What Happens When a Transaction Runs Out of Gas?
An out-of-gas failure occurs when execution needs more gas than the transaction or call frame has available.
The EVM reverses the state changes made by the failed execution.
The gas supplied to an execution that runs out of gas is consumed rather than returned as unused gas.
A protocol refund cannot rescue an execution that has already exhausted its gas supply because refunds are applied only after execution.
This is why developers must estimate a sufficient gas limit even when the transaction is expected to clear storage.
A transaction rejected before inclusion because it is invalid is different from an included transaction that fails during execution.
The official Ethereum gas guide distinguishes pre-inclusion rejection from an on-chain out-of-gas failure.
Does SELFDESTRUCT Still Provide a Gas Refund?
SELFDESTRUCT
does not provide a gas refund on current Ethereum mainnet.
EIP-3529 removed the former
SELFDESTRUCT
refund during the London upgrade.
The later EIP-6780 change to SELFDESTRUCT also reduced the opcode’s ability to delete contracts.
For a contract that was not created in the same transaction,
SELFDESTRUCT
generally transfers the contract’s ETH balance and halts the execution frame without deleting its code or storage.
Full deletion behavior is retained only when the contract is created and destroyed within the same transaction.
No gas refund is granted in either case.
SELFDESTRUCT
is deprecated, and official documentation discourages its use in newly deployed smart contracts.
Developers should not use it as a gas-optimization strategy.
What Were Gas Tokens?
Gas tokens were smart contract assets designed to take advantage of Ethereum’s older gas-refund rules.
Users could perform state-creating operations when gas prices were low and later remove that state when gas prices were high.
The resulting refund could reduce the gas charged for a more valuable transaction.
This process was sometimes described as storing or banking gas.
Gas tokens did not literally store gas units as transferable network resources.
They used smart contract operations that qualified for large refunds under earlier protocol rules.
The system could increase Ethereum’s state size and allow actual execution workloads to exceed the intended block gas pattern.
EIP-3529 removed the
SELFDESTRUCT
refund, reduced the storage-clearing refund, and lowered the refund cap.
These changes made traditional gas-token strategies economically ineffective under current Ethereum rules.
Why Ethereum Reduced Gas Refunds
Ethereum originally used refunds to encourage developers to clear state that was no longer needed.
In practice, the mechanism created incentives to add state during low-fee periods solely so it could be deleted later.
This behavior worked against the goal of reducing Ethereum’s long-term storage burden.
Large refunds also increased the difference between the gas reported for a transaction and the computational work nodes might need to perform.
Older rules allowed transactions to receive refunds worth as much as half of their gross gas consumption.
This increased block workload variability and complicated resource planning for Ethereum clients.
EIP-3529 retained a smaller incentive for good storage hygiene while reducing opportunities to exploit refund accounting.
The 20% cap limits the extent to which refunds can increase effective execution work within a block.
Gas Refunds and Transient Storage
Transient storage is temporary EVM storage that exists only during one transaction.
Ethereum introduced the
TLOAD
and
TSTORE
opcodes through
EIP-1153.
Values in transient storage are discarded automatically when the transaction ends.
Transient storage does not need to be written permanently to Ethereum’s state database.
It therefore uses simpler gas accounting and does not rely on the gas refund counter.
One common use is a reentrancy lock that must remain active across several internal calls but does not need to exist after the transaction.
Older contracts often used persistent storage and reset the lock before completing, which could create a storage refund.
New contract designs can use transient storage where appropriate to avoid unnecessary permanent state operations.
Developers must still review compiler support, contract compatibility, and security behavior before adopting transient storage.
Can a Smart Contract Send a Gas Refund to Another Address?
The protocol-level gas refund belongs to the sender responsible for the top-level transaction fee.
A smart contract cannot redirect the Ethereum refund counter directly to an arbitrary address.
A contract or application can separately transfer ETH or tokens as an incentive, reimbursement, or rebate.
Such a payment is an application-level gas rebate rather than a native EVM gas refund.
A sponsored transaction system may also arrange for another party to pay or reimburse the user’s gas cost.
The terms, funding source, eligibility, and risks of that arrangement depend on the application.
Users should distinguish a protocol refund from a promotional reward or private reimbursement program.
Gas Refunds on Layer-2 Networks
Ethereum-compatible layer-2 networks may use EVM gas concepts while calculating total transaction costs differently.
A layer-2 fee can include local execution costs and the cost of publishing data or proofs to Ethereum.
A storage refund may reduce the execution component without reducing every other component of the total fee.
Some networks modify gas schedules, refund handling, transaction types, or fee reporting.
Users should not assume that Ethereum mainnet’s exact 4,800-gas refund and 20% cap apply identically to every EVM-compatible network.
Developers should consult the official protocol documentation for the network on which the contract will run.
Why a Wallet May Show a Gas Refund
A wallet may estimate the maximum transaction fee before the transaction is confirmed.
This estimate can be based on the gas limit multiplied by the maximum fee per gas.
The final amount can be lower when the transaction consumes less gas than the limit.
It can also be lower when the effective gas price is below the user’s maximum fee setting.
Eligible smart contract storage operations may reduce final billed gas further through the refund counter.
The wallet may group these differences under a general label such as refund, savings, unused fee, or returned gas.
Users should inspect the confirmed gas used, effective gas price, transaction status, and balance change to understand the final charge.
How Developers Can Optimize Gas Without Chasing Refunds
Developers should focus on reducing unnecessary computation and persistent state rather than designing contracts solely to generate refunds.
Storage writes are usually more expensive than memory operations because persistent state must remain available after the transaction.
Contract designs should avoid writing the same data repeatedly when the value can be calculated or reused safely.
Related operations can sometimes be grouped into one transaction to reduce repeated authentication and setup costs.
Transient storage can be considered for temporary transaction-scoped values.
Calldata, memory, storage packing, immutable values, custom errors, and efficient data structures can also affect gas usage.
Developers should use realistic tests because an optimization that saves gas in one execution path may increase costs in another.
Transaction traces should be examined to confirm where gas is being consumed and whether expected refund credits are actually applied.
A smart contract audit should evaluate security before an optimization is accepted because lower gas cost does not justify unsafe logic.
Common Misunderstandings About Gas Refunds
One misunderstanding is that all unused gas is permanently paid and later sent back as a separate transaction.
In reality, unused gas is handled within the original transaction’s balance accounting.
Another misunderstanding is that a gas refund can make additional gas available while a contract is executing.
Refunds are applied after execution and cannot prevent an out-of-gas failure.
A third misunderstanding is that clearing storage always reduces the fee by exactly 4,800 gas.
The actual applied amount may be lower because of the 20% refund cap or more complex same-transaction storage changes.
A fourth misunderstanding is that
SELFDESTRUCT
remains an effective gas-refund strategy.
Ethereum removed its refund and later restricted its deletion behavior.
A fifth misunderstanding is that a failed transaction should receive a complete fee refund.
Validators and nodes still performed computational work, so the gas used before failure remains chargeable.
Gas Refund Scams
Ethereum gas refunds are automatic and do not require a manual claim website.
A person claiming to be support staff cannot reverse a confirmed network fee or release a hidden protocol refund.
Scammers may create websites that promise to recover all gas fees previously paid by a wallet.
These websites may request a malicious token approval, wallet signature, seed phrase, or direct cryptocurrency payment.
No legitimate gas-refund process requires a seed phrase or private key.
An unexpected token named Gas Refund may be an unrelated asset and should not be treated as an Ethereum reimbursement.
Users should verify the transaction through a trusted blockchain explorer and review wallet permissions before signing anything.
A promotional rebate offered by a crypto application should be verified through the application’s official domain and terms.
FAQ
What is a gas refund in simple terms?
A gas refund is a reduction in the final gas charged because some authorized gas was unused or because eligible EVM operations created refund credits.
Does Ethereum return unused gas?
Yes, gas that remains unused when a transaction completes is not included in the final permanent charge.
Is unused gas the same as an SSTORE refund?
No, unused gas comes from the remaining gas limit, while an
SSTORE
refund is a protocol credit generated by eligible storage changes.
What is the maximum Ethereum gas refund?
The maximum protocol refund is 20% of the transaction’s gross gas usage.
Why is the gas refund cap 20%?
EIP-3529 reduced the cap to limit refund-based gas tokens, block workload variation, and state-related abuse.
How much gas is refunded for clearing storage?
An eligible nonzero-to-zero persistent storage change can add 4,800 gas to the refund counter.
Is the 4,800-gas refund always fully applied?
No, the applied amount remains subject to the transaction-wide 20% refund cap.
Does SELFDESTRUCT refund gas?
No, Ethereum removed the
SELFDESTRUCT
gas refund through EIP-3529.
Does SELFDESTRUCT still delete a contract?
It generally does not delete an existing contract unless that contract was created and destroyed within the same transaction.
Can a refund stop an out-of-gas error?
No, protocol refunds are applied only after execution has finished.
Do failed transactions receive unused gas back?
A transaction that explicitly reverts may return remaining gas, but an execution that runs out of gas consumes the gas supplied to that failed execution.
Why must I pay for a reverted transaction?
The transaction still required nodes to verify and execute operations before the failure occurred.
Are gas refunds paid in ETH?
The refund is calculated in gas units, and its ETH value is determined by the transaction’s effective gas price.
Does a validator manually approve my refund?
No, Ethereum execution clients calculate and apply the refund automatically according to protocol rules.
Can I claim old Ethereum gas fees?
No native Ethereum mechanism allows users to reclaim normal historical transaction fees after they have been finalized.
Are gas refund websites legitimate?
A website claiming to unlock automatic Ethereum protocol refunds is likely unsafe unless it clearly provides a separate, verifiable application-funded rebate.
What happened to gas tokens?
EIP-3529 made traditional gas-token strategies economically ineffective by removing and reducing the refunds they depended on.
What is transient storage?
Transient storage is transaction-scoped EVM storage that is automatically discarded and does not use the gas refund counter.
Can a gas refund make a transaction free?
No, the 20% cap means at least 80% of gross gas usage remains billable through the protocol-refund calculation.
Why was my final fee lower than my wallet estimate?
The transaction may have used less than its gas limit, paid a lower effective gas price than the maximum, earned protocol refund credits, or combined these effects.
Conclusion
A gas refund reduces the final cost of an Ethereum transaction through unused gas or eligible EVM refund-counter credits.
Unused gas is the portion of the transaction’s gas limit that execution did not consume.
Protocol refunds are calculated separately after execution and are primarily connected to eligible persistent-storage changes.
Clearing an appropriate nonzero storage slot to zero can add 4,800 gas to the refund counter.
The total applied protocol refund cannot exceed 20% of gross gas usage.
The refund does not provide additional execution gas and cannot prevent an out-of-gas failure.
SELFDESTRUCT
no longer provides a gas refund and should not be used as a modern gas-optimization strategy.
Traditional gas tokens are also obsolete because Ethereum reduced the refund mechanisms on which they relied.
Developers should focus on efficient contract architecture, reduced persistent storage, realistic gas testing, and transient storage where appropriate.
Users should remember that native Ethereum refunds are automatic and never require a seed phrase, private key, or manual claim payment.
Gas refund is best understood as part of Ethereum’s internal resource-accounting system rather than as a cash-back service or guaranteed recovery of transaction fees.