Key Takeaways
- 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.
- 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.
- 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.
| Term | What it measures | Who sets it | Effect if wrong |
|---|---|---|---|
| Gas limit | Maximum units of work allowed | You or your wallet | Too low causes an out of gas error |
| Gas price or max fee | Cost per unit of work | You or your wallet | Too low causes a slow or stuck transaction |
| Gas used | Units actually consumed | The network | Determines your final fee |
| Total fee | Gas used multiplied by price paid | Calculated at execution | What 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 type | What happens | Cost 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 block | No gas consumed |
| Out of gas during execution | Included in a block, then reverted | The full gas limit is consumed |
| Normal revert from contract logic | Included in a block, then reverted | Only 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
| Cause | Who it affects | Typical situation |
|---|---|---|
| Gas limit set manually and too low | Everyday users | Someone edits advanced gas settings to save money |
| Network state changed after estimation | Traders and DeFi users | The price or pool balance moved between signing and execution |
| Complex or batched transactions | Active users | Multi-step swaps, claims, or bridge operations |
| Sending to a smart contract wallet with a 21,000 limit | Exchange withdrawals | The receiving contract needs to run code on arrival |
| Unbounded loops in contract code | Developers | A function that loops over a growing list |
| Congested blocks and stale estimates | Everyone during mints or launches | Estimates age quickly when demand spikes |
| Nested contract calls receiving too little gas | Developers | Gas 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_estimateGassimulates 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
transferandsendfunctions 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.
| Network | Unit of work | Notable limits (as of 2026) |
|---|---|---|
| Ethereum mainnet | Gas | Block 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, Optimism | Gas | Same mechanics, much lower fees; some adopt the same per transaction cap for equivalence |
| Other EVM chains such as BNB Chain and Polygon | Gas | Same error behaviour, different block limits and fee levels |
| Solana | Compute units | Instructions 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
| Error | Likely meaning | Usual response |
|---|---|---|
| Out of gas | Gas limit too low for the work required | Resubmit with a higher gas limit |
| Execution reverted | Contract logic rejected the request | Check approvals, slippage, deadlines, balances |
| Insufficient funds for gas | Not enough native token to cover the fee | Add the network's native asset |
| Nonce too low | The transaction was already used or replaced | Refresh the wallet or reset the account nonce |
| Replacement transaction underpriced | A speed up attempt did not raise the fee enough | Increase 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.
Related 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
- Ethereum Foundation, Building on Ethereum in 2026, for how gas limits and upgrades have changed.
- RareSkills, EIP-150 and the 63/64 Rule for Gas, for how gas is forwarded between contracts.
- 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



