Mispricing Gazette

Home › Strategy & Costs › Gas Fees and Arbitrage Profit: How to Calculate the Real Margin

Gas Fees and Arbitrage Profit: How to Calculate the Real Margin

Editorial team · Updated 2026-10-14 · 6 min read

To calculate arbitrage profit after gas, take the gross output of the trade, subtract the input, pool fees and slippage, then subtract gas used multiplied by the gas price in ETH terms. If the result is not clearly positive under pessimistic assumptions, do not send the transaction.

The basic formula

Net profit per attempt = (amount out - amount in) - gas cost - any flash loan fee.

The first bracket already contains pool fees and price impact, because the amount out comes from the actual swap maths. Gas cost is the product of gas used and gas price. On Ethereum, the gas and fees documentation explains that the price has two parts since the London upgrade: a protocol base fee that is burned, and a priority fee that goes to the block proposer. Your effective price per gas is the base fee plus the tip you attach, up to the maximum you set.

Gas used depends on the route. A single swap uses less gas than a two-leg arbitrage, and a route through several pools uses more again. This is why a profitable-looking gap in a popular pair may still be rejected: the route that captures it simply burns too much gas.

Key takeaway: gas is a fixed cost, so the same percentage gap is worth taking at a large size and not worth taking at a small one.

A worked example with illustrative numbers

These numbers are invented to show the method. They are not current market data.

Step Value
Trade size 20 ETH-equivalent
Gross spread between pools 0.9%
Gross gain 0.18 ETH
Pool fees (two legs at 0.3%) about 0.12 ETH
Estimated price impact 0.02 ETH
Gas used (two-leg route) 250,000 gas, as an assumption
Gas price 20 gwei, as an assumption
Gas cost 0.005 ETH
Net 0.18 - 0.12 - 0.02 - 0.005 = 0.035 ETH

At 20 ETH the trade nets a small positive. Now cut the size to 2 ETH with the same spread. Gross gain is 0.018 ETH, fees are 0.012 ETH, impact is smaller at roughly 0.0002 ETH, and gas is still 0.005 ETH. Net is about 0.0008 ETH, essentially zero, and one competing bid or a slightly higher gas price turns it negative.

Now raise gas to 60 gwei at the original 20 ETH size. Gas cost becomes 0.015 ETH, net drops to 0.025 ETH. At 2 ETH the same change makes net clearly negative. The takeaway is that small trades are fragile and that gas spikes matter.

Gas price is not a single number

Gas is set by supply and demand for block space. When activity spikes, base fees rise, and when competing searchers bid, tips rise. For arbitrage there is an extra effect: competitors pay higher tips to land first, which is how a large share of profit from an opportunity ends up going to the block proposer. That dynamic is described in the ethereum.org MEV overview.

Practical consequences:

  1. Use a conservative gas estimate. Compute profit at a gas price somewhat above the current one, so a small move does not flip the sign.
  2. Cap what you will bid. Decide in advance the maximum share of expected profit you will pay as tip.
  3. Recompute just before sending. Base fee can move between blocks.
  4. Know the break-even gap for each route. Divide total fixed cost by trade size to see the minimum spread needed.

Reverts, outbids and the cost of failing

Not all failures cost the same. If a transaction is never mined, you pay nothing. If it is mined but reverts, because the pool moved or a competitor took the gap, you pay the gas that was consumed up to the point of failure. In the public mempool, bots often send many attempts, and the reverted ones add up.

Outcome Gas paid Notes
Included and profitable Yes Covered by profit
Included and reverts Yes, up to the revert point Pure loss
Not included No Opportunity lost
Sent privately, not included No Depends on the bundle design, see Flashbots Protect and arbitrage

Vendors market this point. CryptoMEV Bot’s flash loan arbitrage page states that a failed transaction reverts and costs only the gas fee, not the loan amount. That is accurate as a description of atomic execution, but it also means that the gas fee is a real loss on each failed attempt, and the page does not quantify how often failures occur.

What a gas-aware bot should do

A bot that claims to calculate profit after gas should at minimum:

  • simulate the exact transaction against the latest state before submitting;
  • apply a safety margin to the result;
  • refuse trades whose margin is below a threshold you set;
  • log gas spent on failed attempts so you can see the real loss rate.

CryptoMEV Bot’s Ethereum arbitrage page lists simulation and gas-aware profit calculation as core features, together with Flashbots integration. Those are the right features to look for. Whether the implementation is accurate under live conditions is something you can only confirm by testing, as outlined in how to choose an arbitrage bot.

Break-even size: a quick way to filter routes

Instead of recalculating everything for every candidate, compute a break-even size for each route type once, and update it when gas moves. The logic is simple. Net profit is roughly spread times size, minus fees proportional to size, minus a fixed gas cost. Rearranged, the minimum size is fixed gas cost divided by the net spread after proportional fees.

For example, suppose the net spread after both pool fees is 0.3 percent and the route’s gas cost is 0.005 ETH. Break-even size is 0.005 divided by 0.003, about 1.7 ETH-equivalent. Below that size the trade loses money even before price impact, and the sensible target is a size comfortably above it. If the pool is too shallow to absorb that size without moving the price, the route is dead regardless of how wide the headline gap looks. Again, all values here are illustrative and must be replaced with live ones.

This filter has useful side effects. It stops a bot from chasing tiny gaps in deep pools, where fixed gas dominates. It focuses attention on pairs where the combination of depth and spread supports a sensible size. And it makes gas spikes visible: if break-even size doubles when gas doubles, you can see which routes switch off.

For a broader look at how this plays out in practice, the vendor’s own educational article on crypto arbitrage trading lists trading fees, withdrawal fees and slippage as the cost items that can shrink or eliminate small margins, which matches the logic above.

A checklist before every strategy change

  • Have I computed break-even spread for my typical size?
  • Is my profit estimate still positive at higher gas?
  • Do I know my historical revert rate?
  • Does the bot cap tips as a share of profit?
  • Have I included flash loan premiums and licence costs in my monthly view? See whether Ethereum arbitrage is still profitable.

Summary

Gas converts a percentage gap into a break-even size. Calculate net profit with pessimistic gas, count reverts as real losses and rerun the numbers whenever conditions change. The figures in this article are illustrations only, so use live data. This is general information, not financial advice.

Frequently asked questions

How do gas fees affect arbitrage profit?

Gas is a fixed cost per transaction that must be covered by the price gap. If gas plus pool fees exceed the gross spread, the trade loses money.

Do failed arbitrage transactions cost gas?

Yes. A transaction that is included but reverts still consumes gas. A transaction that is never included costs nothing, but you also earn nothing.

What is the base fee?

Since EIP-1559, each block has a protocol-set base fee that is burned, plus an optional priority tip paid to the block proposer.

How can I estimate gas for an arbitrage route?

Simulate the transaction against current state to get gas used, then multiply by the expected base fee plus tip.

Sources