Beginner to IntermediateGuide

Out of Gas Errors Explained: Why Blockchain Transactions Fail

Learn what an out of gas error means, why a failed crypto transaction still costs a fee, and how to fix the gas limit safely.

By Niki

Immediate guidance: Fee is final

An out of gas error means your transaction used up the maximum amount of computation you approved before it could finish, so the network cancelled the result and left your balance unchanged.

Never share a recovery phrase, private key, password, or two-factor code with anyone offering support.

Out of Gas Errors Explained: Why Blockchain Transactions Fail

Key Takeaways

  1. An out of gas error means your transaction used up the maximum amount of computation you approved before it could finish, so the network cancelled the result and left your balance unchanged.
  2. You still pay for a failed out of gas transaction, because validators already did the work. The money is spent on computation, not on the outcome.
  3. Most out of gas failures are fixed by raising the gas limit, refreshing the transaction so the wallet can re-estimate it, or checking whether the smart contract itself is rejecting your request.

What an Out of Gas Error Actually Means

Every action on Ethereum and other EVM networks has a computational price called gas. Gas is a unit of work, not a currency. Sending ETH from one wallet to another costs exactly 21,000 gas. Swapping tokens, minting an NFT, or repaying a loan costs far more, because the network has to run smart contract code to complete the job.

When you sign a transaction, you approve two separate things:

  • Gas limit: the maximum number of gas units the network may spend on your behalf.
  • Gas price: how much you pay per unit of gas, usually quoted in gwei.

An out of gas error happens when the work required is larger than the gas limit you approved. The Ethereum Virtual Machine (EVM) executes your transaction step by step, subtracting gas as it goes. If the meter hits zero before the last step, execution stops immediately. All state changes are rolled back, and the transaction appears on the block explorer as failed.

A useful picture: the gas limit is your fuel tank and the transaction is the journey. If the tank empties halfway, you do not arrive, and the fuel is still gone.


Gas Limit, Gas Price, and Gas Used

These three terms look similar and are the source of most confusion.

TermWhat it measuresWho sets itEffect if wrong
Gas limitMaximum units of work allowedYou or your walletToo low causes an out of gas error
Gas price or max feeCost per unit of workYou or your walletToo low causes a slow or stuck transaction
Gas usedUnits actually consumedThe networkDetermines your final fee
Total feeGas used multiplied by price paidCalculated at executionWhat leaves your wallet

Raising the gas limit does not make a transaction faster or more expensive by itself. Unused gas is returned when a transaction succeeds. Speed is controlled by the priority fee, which is a separate setting.


Why You Still Pay for a Failed Transaction

This is the part that frustrates newcomers. According to Ethereum documentation, the fee is paid whether a transaction succeeds or fails, because validators performed real computation either way. Refunding failures would let attackers spam the network for free.

There is an important distinction between two kinds of failure:

Failure typeWhat happensCost to you
Gas limit below the minimum required to start (for example, 20,000 for a simple transfer)Rejected during validation and never included in a blockNo gas consumed
Out of gas during executionIncluded in a block, then revertedThe full gas limit is consumed
Normal revert from contract logicIncluded in a block, then revertedOnly the gas used up to that point

The middle row is why out of gas failures feel expensive. A standard revert returns whatever gas was left over. A true out of gas failure does not, because the meter reached zero.


Common Causes of Out of Gas Errors

CauseWho it affectsTypical situation
Gas limit set manually and too lowEveryday usersSomeone edits advanced gas settings to save money
Network state changed after estimationTraders and DeFi usersThe price or pool balance moved between signing and execution
Complex or batched transactionsActive usersMulti-step swaps, claims, or bridge operations
Sending to a smart contract wallet with a 21,000 limitExchange withdrawalsThe receiving contract needs to run code on arrival
Unbounded loops in contract codeDevelopersA function that loops over a growing list
Congested blocks and stale estimatesEveryone during mints or launchesEstimates age quickly when demand spikes
Nested contract calls receiving too little gasDevelopersGas forwarding rules reserve part of the remaining gas

Wallets such as MetaMask estimate the gas limit automatically, and that estimate is usually sufficient. Problems appear most often when the estimate is overridden or when conditions change between simulation and execution.


How to Diagnose the Error Step by Step

Step 1: Open the transaction on a block explorer. Paste the transaction hash into a tool such as Etherscan, Blockscout, or the explorer for the network you used.

Step 2: Compare gas limit and gas used. If gas used is at or extremely close to 100 percent of the gas limit, it is an out of gas failure. If gas used is well below the limit, the contract rejected the request for another reason.

Step 3: Read the error string. Explorers often display a reason such as "out of gas", "execution reverted", or a custom message from the contract. Custom messages point to logic problems, not fuel problems.

Step 4: Check the contract state. Paused contracts, expired deadlines, missing approvals, and slippage limits produce similar looking failures.

Step 5: Retry with a buffer. If the diagnosis points to gas, resubmit with a higher gas limit rather than a higher gas price.


How to Fix and Prevent Out of Gas Errors

For everyday users:

  • Let the wallet estimate the gas limit unless you have a specific reason not to.
  • Close and reopen the transaction screen before signing during volatile periods, so the wallet re-estimates against fresh data.
  • Keep a small buffer of native tokens in the wallet, because fees are paid in ETH, BNB, POL, or the network's own asset.
  • Treat a wallet warning that a transaction is likely to fail as a reason to stop and investigate.

For developers and advanced users:

  • Add a buffer above the value returned by eth_estimateGas. Many teams use roughly 20 to 30 percent for standard calls and more for multi-step operations. These are common practices, not protocol rules.
  • Remember that eth_estimateGas simulates against current state. If state changes before inclusion, the estimate can be too low.
  • Under EIP-150, a contract can forward at most 63 of every 64 units of remaining gas to a nested call, so deep call stacks lose gas at every level.
  • The transfer and send functions in Solidity forward a fixed 2,300 gas stipend, which is not enough for receivers that run meaningful code. This is a well known cause of failures when sending value to contracts.
  • Avoid loops over arrays that grow without limit, since cost rises with the data.

Network Limits You Should Know

Gas rules differ by chain, and so do the ceilings that constrain any single transaction.

NetworkUnit of workNotable limits (as of 2026)
Ethereum mainnetGasBlock gas limit standardized at 60 million in the Fusaka upgrade of December 2025; EIP-7825 caps any single transaction at 16,777,216 gas
EVM layer 2 networks such as Arbitrum, Base, OptimismGasSame mechanics, much lower fees; some adopt the same per transaction cap for equivalence
Other EVM chains such as BNB Chain and PolygonGasSame error behaviour, different block limits and fee levels
SolanaCompute unitsInstructions default to 200,000 compute units, and a transaction is capped at 1,400,000; exceeding the budget aborts execution and the fee is not returned

Ethereum's block gas limit is not fixed forever. It moved from 30 million to 60 million during 2025, and the Ethereum Foundation has published plans to raise it further. Treat any ceiling as a snapshot, not a permanent number.


Out of Gas Compared With Other Transaction Errors

ErrorLikely meaningUsual response
Out of gasGas limit too low for the work requiredResubmit with a higher gas limit
Execution revertedContract logic rejected the requestCheck approvals, slippage, deadlines, balances
Insufficient funds for gasNot enough native token to cover the feeAdd the network's native asset
Nonce too lowThe transaction was already used or replacedRefresh the wallet or reset the account nonce
Replacement transaction underpricedA speed up attempt did not raise the fee enoughIncrease the priority fee and retry

Frequently Asked Questions

Does an out of gas error mean I lost my tokens? No. The blockchain reverts every state change, so your token balances stay as they were before the attempt. You lose only the network fee.

Can I get the fee back? No. Fees for failed transactions are not refundable. The computation was performed by validators and cannot be undone.

Should I just set a very high gas limit every time? A generous limit is harmless when a transaction succeeds, because unused gas is returned. It is not free protection though. If the transaction genuinely runs out of gas, the entire limit is consumed, so a very large limit raises the worst case cost.

Why did my wallet estimate the gas correctly last week and not today? Gas estimation simulates the transaction against the current state of the chain. Prices, pool balances, queue positions, and contract settings change constantly, and busy periods widen the gap between estimation and execution.

Is an out of gas error the same on every blockchain? The idea is the same on every network that meters computation, but the names differ. Solana uses compute units and reports a compute budget error. Non-EVM chains may use energy, fuel, or other terms.


  • Gas limit: the maximum computational work a transaction is allowed to perform.
  • Gwei: a denomination of ETH used to quote gas prices, equal to one billionth of an ETH.
  • Revert: the process of undoing all state changes when a transaction fails.
  • EVM: the Ethereum Virtual Machine, the runtime that executes smart contract code.
  • Compute units: Solana's equivalent of gas, measuring the resources a transaction may use.

Sources

  • Ethereum Foundation, Gas and Fees documentation, ethereum.org
  • Ethereum Foundation, Fusaka Mainnet Announcement, blog.ethereum.org, November 2025
  • EIP-7825: Transaction Gas Limit Cap, eips.ethereum.org
  • MetaMask Help Center, Why did my transaction fail with an out of gas error
  • Solana documentation, Compute Budget, solana.com

Further Reading

  1. Ethereum Foundation, Building on Ethereum in 2026, for how gas limits and upgrades have changed.
  2. RareSkills, EIP-150 and the 63/64 Rule for Gas, for how gas is forwarded between contracts.
  3. Solana documentation, Compute Budget and priority fees, for the non-EVM view of metered execution.

Disclaimer: This article is educational content. It is not financial, investment, tax, or legal advice. Network behaviour, fees, and explorer interfaces change over time, so verify current details against official documentation before relying on them.

Not sure which problem you have?

Use the Fixing Crypto Mistakes hub to identify the transaction, wallet, network, or exchange issue before taking another action.

OPEN TROUBLESHOOTING HUB

Share Transmission

Broadcast this signal to your network