Gas Limit vs Gas Used vs Gas Price on Ethereum
Three terms that are easy to mix up
Gas measures computational work on the Ethereum Virtual Machine. Every operation, from adding two numbers to writing a value to storage, has a fixed gas cost. Gas used is the total consumed by your transaction. Gas limit is the maximum you allow it to consume. Gas price is how much ether you pay per unit, quoted in gwei. The fee is gas used multiplied by gas price, not gas limit multiplied by gas price.
Why set a gas limit at all?
Smart contracts can contain loops and branches, and a buggy or malicious contract could run forever. The gas limit is your circuit breaker: if execution reaches the limit, it stops, state changes are reverted and you keep whatever gas was not consumed. Wallets estimate the gas a transaction will need by simulating it, then add a safety margin. A plain ETH transfer is the exception. It always uses exactly 21,000 gas, so its limit is set to 21,000.
"Out of gas" and failed transactions
If the gas limit is too low, the transaction fails with an out-of-gas error. It is still included in a block, and the gas consumed up to the failure point is still paid, because validators did the work. The same applies to transactions that revert for other reasons, such as slippage protection on a swap or an expired deadline. That is why a failed swap during a volatile market can still cost you a fee.
Typical gas used by common actions
| Action | Typical gas used |
|---|---|
| Send ETH | 21,000 (exact) |
| Send an ERC-20 token (USDT, USDC) | ≈ 45,000–65,000 |
| Approve a token | ≈ 46,000 |
| DEX swap on Uniswap | ≈ 120,000–200,000 |
| Mint an NFT | ≈ 80,000–200,000 |
| Deploy a contract | ≈ 500,000–3,000,000+ |
Exact numbers depend on the contract implementation, how many storage slots change and whether a storage slot goes from zero to non-zero, which is more expensive than updating an existing value.
Block gas limit
There is also a gas limit per block, set by validator consensus. It caps the total gas of all transactions in a block. The protocol targets half of it on average, which is what drives the EIP-1559 base fee up or down. Recent increases in the block gas limit are a big reason mainnet fees have been far lower than in the 2021 peak.
Practical advice
- Leave the wallet's gas limit estimate alone unless you know the contract well.
- To save money, lower the gas price you are willing to pay, not the limit.
- Check that a transaction is likely to succeed before sending it during volatile periods, because reverts still cost gas.
Frequently asked questions
Do I pay for the entire gas limit?
No. You pay for the gas actually used. Unused gas up to the limit is not charged.
Why did my failed transaction cost money?
Validators executed it until it failed, so the gas consumed up to that point is charged even though the state changes were reverted.