· 4 min read
How to Work Out a Transaction Fee by Hand
Heshan Fernando
Co-founder & COO
A wallet quotes a fee and you want to know whether it is reasonable. Working it out means understanding three numbers, two of which move continuously and one of which depends entirely on what the transaction does.
None of it requires connecting anything to anything.
The three inputs
Gas limit is the maximum computational work the transaction may consume. A plain transfer is 21,000 — a fixed, protocol-defined amount. A contract interaction depends on what the contract does, and ranges from tens of thousands to millions.
Base fee is set by the protocol and adjusts block by block according to how full recent blocks have been. It is burned rather than paid to anyone, and it is the part that spikes during congestion.
Priority fee is what you add to compete for inclusion. This is the part that actually goes to the validator, and it is the lever you control.
fee = gas used × (base fee + priority fee)
At 21,000 gas with an 18 gwei base fee and 1.5 gwei priority, that is 21,000 × 19.5 gwei = 0.0004095 in native units.
Limit is a ceiling, not a charge
The most common misunderstanding.
You pay for gas used, not gas limited. Setting a limit of 200,000 on a transaction that uses 21,000 costs the same as setting 21,000 — the unused portion is simply not charged.
That makes a generous limit safe. What is not safe is a limit set too low: the transaction runs out of gas partway, fails, and you still pay for the gas consumed up to the failure point. You get nothing and pay anyway.
So the asymmetry runs one way. Over-estimating the limit costs nothing; under-estimating costs the fee for a transaction that did not happen.
| Limit set | Gas used | Cost |
|---|---|---|
| 21,000 | 21,000 | Full fee, succeeds |
| 200,000 | 21,000 | Same fee, succeeds |
| 15,000 | 15,000 (runs out) | Fee charged, fails |
Why the numbers move so much
Base fee responds to demand. When blocks are full it rises; when they empty it falls. Over a day it can vary by an order of magnitude, which is why the same transaction costs very different amounts at different times.
For anything not time-sensitive, that variability is an opportunity — the same operation at a quiet period costs a fraction of what it costs during congestion. Wallets and block explorers show recent base fee history, which is enough to judge whether now is expensive.
Priority fee competes for position within a block. During congestion a higher priority fee gets included sooner; when blocks are not full, a minimal priority fee is enough.
Why do the arithmetic offline
A calculator that connects to a wallet or queries a network learns things about you — addresses, balances, what you are about to do.
Doing the arithmetic from numbers you read off a block explorer keeps all of that local. The trade is that the figures are only as current as when you looked, which for a sanity check is fine and for an actual transaction means checking again at the moment.
Common mistakes to avoid
- Setting a gas limit too low to save money, which risks paying for a failed transaction.
- Confusing gwei with the native unit — a factor of a billion, and an easy misread.
- Treating a fee estimate from an hour ago as current.
- Transacting during peak congestion when the operation could wait.
- Assuming a contract interaction costs the same as a transfer.
How to do it with Gas Fee Estimator
The Gas Fee Estimator does the arithmetic on values you supply.
- Take the current base fee from a block explorer.
- Enter the gas limit — 21,000 for a transfer, or your wallet’s estimate for a contract call.
- Add a priority fee appropriate to how quickly you need inclusion.
- Read the fee in native units and fiat, and check the base fee again before sending.
Other finance tools are in the tools directory.
Frequently asked questions
Why does it ask me for the base fee?
Because it does not connect to any network or wallet. You supply the current values from a block explorer, which keeps everything about the transaction local to your machine.
What gas limit should I use?
A plain transfer is 21,000. Contract interactions vary widely, and your wallet estimates it before signing. A generous limit costs nothing since you pay only for gas used.
Why do I sometimes pay less than the limit?
Because the limit is a ceiling. Unused gas is not charged. The risk runs the other way — a limit set too low means the transaction fails and you still pay for what it consumed.
Final thought
Set the limit generously and the priority fee deliberately. One of those costs nothing to get wrong in your favour, and the other is the only part you actually control.