NefiSwap

Ethereum gas fees: reading the fee before a transaction

Learn how gas used, the gas limit and per-unit fees combine, and why an estimate may differ from the fee recorded after execution.

NefiSwap Desk

Updated:

Editorial illustration of Ethereum gas fees and transaction costs

Key points

  • Gas measures computation; it does not measure the amount of tokens transferred.
  • The gas limit is a cap, while the fee depends on gas consumed and the effective per-unit fee.
  • An included execution may incur a fee even when it reverts; rejection before inclusion is a different case.

Ethereum gas fees are charges for computation performed by a transaction on Ethereum mainnet. Gas describes the work, not the number of ETH or tokens being sent. The network fee is separate from the transfer amount: a transaction can send tokens to a recipient while also charging the sender a fee for processing it.

Before reviewing a transaction, separate three quantities: gas used, the gas limit and the fee per unit of gas. They describe different things, and an estimate shown before submission is not necessarily the final amount charged.

Gas used, gas limit and fee per unit

Gas used is the computation actually consumed when an included transaction executes. A simple transfer and a contract interaction can require different amounts of work. The amount sent does not, by itself, tell you how much gas execution will use.

Gas limit is the maximum amount of gas the transaction is permitted to consume. It is a cap, not a report of completed work and not automatically the amount charged. If execution finishes using less gas than the limit, the fee is calculated from the gas actually consumed. A transaction that runs out of gas may fail after consuming the gas available to it.

The fee per unit is the price applied to each unit of gas used. In broad terms, the execution charge is gas used multiplied by the effective fee per gas. Looking at only one field can therefore give a misleading picture: a large gas limit does not mean that the full limit will be charged, and a fee-per-unit figure does not tell you how much computation the transaction will use.

Base fee, priority fee and maximum fee

On Ethereum’s post-EIP-1559 fee model, the base fee is set by the network and applies to included transactions. The priority fee, also called a tip, is an additional per-unit amount for the block proposer. The base-fee portion is burned; the priority fee goes to the proposer.

A transaction can also specify a maximum fee per gas, which sets the most its sender is willing to pay per unit. This is a ceiling, not necessarily the price ultimately paid. The effective per-unit fee used for the calculation depends on the fee fields and the base fee when the transaction is included. Do not treat the maximum as a prediction of the final charge or as a recommendation for what to enter.

Estimate versus recorded fee

A pre-transaction estimate is an expectation based on available information, not a fixed tariff or a confirmation guarantee. Network demand can change, and the final recorded fee reflects the gas consumed and effective per-unit fee for the included execution. Review the transaction record after it is processed to see its execution status and actual fee.

Keep the network fee distinct from the value transferred. For example, a fee paid in ETH is not part of the token amount a recipient receives. Wallets and other services may present fee details differently, so check which field is the gas limit, which is an estimate, and which describes the recorded charge. Ethereum mainnet fee rules should not be assumed to describe every other network or payment arrangement.

Why a failed execution can still cost

An included transaction can revert: its attempted state changes are undone, but the computation that ran still used network resources. The fee can therefore be charged even though the intended action did not complete. Running out of gas is another kind of included failure; it is not the same as being rejected before inclusion.

A transaction rejected before it is included has not run on-chain in the same way as an included execution. A dropped or replaced transaction is also different from an included transaction that reverts. Check its status and whether it was included before concluding that a failed action should have incurred no fee.

For more general educational material, browse the NefiSwap blog guides.

Quick answers

Does the gas limit equal the fee?

No. It caps permitted computation. The charge is based on gas actually consumed and the effective fee per unit.

Does a failed transaction always cost gas?

No single answer covers every failure. An included execution that reverts can consume paid computation; a request rejected before inclusion is different. Check the recorded status and fee.

Sources

This is NefiSwap's own summary of public reporting, prepared with automation. It is not financial advice.

Related articles