How to Calculate MEV Loss
What is MEV Loss?
The MEV Loss Calculator estimates how much value you have lost to Maximal Extractable Value attacks — primarily sandwich attacks and front-running on DEX swaps — where bots extract profit by manipulating your transaction execution price.
Formula
MEV Loss = (Actual Execution Price - Fair Price) × Trade Size
- TS
- Trade Size ($) — Dollar value of the DEX swap transaction
- ST
- Slippage Tolerance (%) — Maximum acceptable price deviation set by user
- ML
- MEV Extracted ($) — Value extracted by MEV bots from the transaction
- FP
- Fair Price ($) — Mid-market price without MEV manipulation
Step-by-Step Guide
- 1Enter your DEX swap details: token pair, trade size, and slippage tolerance setting
- 2The calculator estimates typical MEV extraction based on your trade size and slippage
- 3Compare your executed price to the mid-market price at the time of your transaction
- 4Calculate cumulative MEV losses across all your historical DeFi transactions
Worked Examples
Input
$10,000 ETH→USDC swap on Uniswap, 0.5% slippage tolerance
Result
Typical sandwich attack extracts 0.1-0.3% = $10-$30 MEV loss per trade
Input
$100,000 swap with 1% slippage tolerance
Result
MEV bots can extract up to 0.5% = $500 per trade. Annual if trading weekly = $26,000 in MEV losses
Common Mistakes to Avoid
- ✕Setting slippage tolerance too high, giving MEV bots more room to extract value
- ✕Not using MEV protection tools like Flashbots Protect or private mempools
- ✕Executing large trades on-chain instead of using aggregators with MEV protection
Frequently Asked Questions
What is a sandwich attack?
A sandwich attack is when an MEV bot detects your pending swap in the mempool, front-runs it with a buy (raising the price), lets your trade execute at the worse price, then back-runs with a sell to pocket the difference. You get a worse execution price.
How can I protect myself from MEV?
Use Flashbots Protect RPC (sends transactions directly to block builders, bypassing the public mempool), use DEX aggregators with MEV protection (CoW Swap, 1inch Fusion), or set tight slippage tolerances.
Ready to calculate? Try the free MEV Loss Calculator
Try it yourself →