Flash Loan Arbitrage Profit Calculator (DeFi)
Estimate flash loan arbitrage profit after gas and fees from loan size and the price gap between two DEX pools.
Flash Loan Arbitrage Profit Calculator (DeFi)
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Net Profit = (Tokens ร Sell Price) โ Loan โ Flash Fee โ DEX Fees โ Slippage โ Gas
Worked example โ Net Profit: $160.78 | ROI: 0.16% | Profitable: Yes
Formula
Net Profit = (Tokens ร Sell Price) โ Loan โ Flash Fee โ DEX Fees โ Slippage โ Gas
Net profit from flash loan arbitrage equals the gross revenue from selling tokens at the higher price, minus the original loan amount, flash loan protocol fee, DEX trading fees on both swaps, slippage costs, and Ethereum gas fees.
Worked Examples
Example 1: ETH Arbitrage Between Uniswap and SushiSwap
Problem:Borrow $100,000 via Aave flash loan (0.09% fee). Buy ETH at $1,800 on Uniswap, sell at $1,825 on SushiSwap. Gas: 30 Gwei, DEX fee: 0.3%, slippage: 0.5%.
Solution:Tokens bought: 100,000 / 1,800 = 55.556 ETH Gross revenue: 55.556 ร $1,825 = $101,388.89 Gross profit: $1,388.89 Flash loan fee: $100,000 ร 0.09% = $90.00 DEX fees: $100,000 ร 0.3% + $101,389 ร 0.3% = $604.17 Slippage: $101,389 ร 0.5% = $506.94 Gas: ~$27.00 Total fees: $1,228.11 Net profit: $1,388.89 - $1,228.11 = $160.78
Result:Net Profit: $160.78 | ROI: 0.16% | Profitable: Yes
Example 2: Small Spread Arbitrage (Unprofitable)
Problem:Borrow $50,000 via flash loan. Buy token at $100, sell at $100.50 (0.5% spread). Gas: 50 Gwei.
Solution:Tokens bought: 50,000 / 100 = 500 tokens Gross revenue: 500 ร $100.50 = $50,250 Gross profit: $250 Flash loan fee: $50,000 ร 0.09% = $45 DEX fees: $50,000 ร 0.3% + $50,250 ร 0.3% = $300.75 Slippage: $50,250 ร 0.5% = $251.25 Gas: 500,000 units ร 50 Gwei = 0.025 ETH ร $100 token price = $2.50 Total fees: $599.50 Net profit: $250 - $599.50 = -$349.50
Result:Net Profit: -$349.50 | Not profitable โ spread too small to cover fees
Frequently Asked Questions
What is a flash loan in DeFi?
A flash loan is an uncollateralized loan unique to decentralized finance (DeFi) that must be borrowed and repaid within a single blockchain transaction. Introduced by Aave in 2020, flash loans allow anyone to borrow millions of dollars instantly without any collateral, provided the full amount plus fees is returned before the transaction completes. If the loan is not repaid, the entire transaction is reverted as if it never happened, meaning the lender faces zero risk. Flash loans are primarily used for arbitrage (exploiting price differences across exchanges), collateral swaps, and self-liquidation. They democratize access to large amounts of capital for trading opportunities that were previously only available to well-capitalized traders.
How does flash loan arbitrage work?
Flash loan arbitrage exploits price discrepancies of the same asset across different decentralized exchanges (DEXs). The process works in a single transaction: first, you borrow a large sum via a flash loan from a protocol like Aave or dYdX. Second, you buy the underpriced asset on one DEX (e.g., Uniswap). Third, you sell the same asset at the higher price on another DEX (e.g., SushiSwap). Fourth, you repay the flash loan plus fees. Fifth, you keep the remaining profit. All of this happens atomically in one transaction, meaning if any step fails, everything reverts. The profit margin must exceed the combined costs of the flash loan fee, DEX trading fees, slippage, and gas costs.
What are the risks of flash loan arbitrage?
While flash loans themselves are risk-free (failed transactions simply revert), several practical risks exist. Gas costs can consume profits, especially during network congestion when gas prices spike. Front-running bots watch the mempool and can execute your arbitrage trade before you, eliminating the price difference. Slippage on large trades can significantly reduce the actual profit compared to the quoted price. Smart contract bugs in your arbitrage contract could lead to unexpected behavior. The price difference may disappear between when you submit the transaction and when it executes. Additionally, developing and deploying flash loan smart contracts requires substantial Solidity programming expertise, and vulnerabilities in your code could potentially be exploited.
What fees are involved in flash loan arbitrage?
Flash loan arbitrage involves multiple layers of fees that can quickly erode profits. The flash loan protocol fee is typically 0.09% on Aave and 0.3% on dYdX (though dYdX actually charges 0 for flash loans but requires 2 wei). DEX trading fees apply on both the buy and sell sides, typically 0.3% per swap on Uniswap V2 or 0.05-1% on Uniswap V3 depending on the pool. Gas fees for executing the transaction on Ethereum can range from $5 to $500+ depending on network congestion and transaction complexity. Price slippage on both trades further reduces returns. To be profitable, the price spread between exchanges must exceed all these combined costs, which typically means you need at least a 0.5-1% price difference for profitable arbitrage.
Which protocols support flash loans?
Several major DeFi protocols support flash loans across multiple blockchain networks. Aave is the most popular flash loan provider, available on Ethereum, Polygon, Avalanche, Arbitrum, and Optimism, charging a 0.09% fee (or 0% for Aave V3 when repaying with aTokens). dYdX offers flash loans on Ethereum with effectively zero fees. Uniswap V2 and V3 provide flash swaps, which function similarly to flash loans but operate through their liquidity pools. Balancer offers flash loans with no fees on their pool assets. DODO exchange provides flash loans as well. On Binance Smart Chain, PancakeSwap offers flash swaps. The choice of protocol affects fees, available assets, and maximum borrowable amounts, which can reach hundreds of millions of dollars.
Why does the break-even spread barely change when I increase the loan size?
Three of the four cost terms are proportional to notional: the protocol premium, the DEX fee on each leg, and slippage all scale with the amount traded, so they cancel out of the percentage margin. Only gas is fixed per transaction. With a 0.09 percent premium and 0.30 percent per swap the proportional drag is about 0.69 percent before slippage, and that figure is the same on a 10,000 dollar loan as on a 10 million dollar one. Borrowing more raises the dollar profit on a viable spread but does not make an unviable spread viable, and beyond a point it makes things worse because slippage grows with trade size.
What is the difference between a flash loan and a flash swap?
A flash loan comes from a lending protocol such as Aave: you borrow an asset, do what you like, and repay the same asset plus a premium before the transaction ends. A flash swap, introduced with Uniswap V2, pulls tokens straight out of a liquidity pool and lets you settle either by returning the same token with the pool fee, or by delivering the counter-asset so the withdrawal becomes an ordinary swap. Flash swaps avoid a separate lending premium but are limited to the reserves of one pool and charge that pool's swap fee. Flash Loan Arbitrage Profit Calculator (DeFi)'s loan fee field models the lending-protocol style.
How is slippage actually determined on a constant-product AMM?
This tool takes slippage as a flat percentage you supply, but on a constant-product pool it is a function of trade size relative to reserves. Swapping into a pool that holds x and y with x times y held constant moves the marginal price along a curve, so the average execution price worsens as your input grows as a share of the reserve. A trade worth one percent of pool depth costs roughly one percent on that leg, because the impact resolves to the trade size divided by the reserve plus the trade size. That percentage climbs toward but never past one hundred percent as the trade grows, while the dollar cost of slippage rises roughly with the square of the trade size. Check both pools' reserves before trusting a fixed slippage assumption on a large notional.
How does the gas price in Gwei translate into a dollar cost?
Gas cost in ether equals gas units multiplied by the gas price in Gwei, divided by one billion, since a Gwei is 0.000000001 ETH. This model assumes roughly 500,000 gas units for a multi-step arbitrage contract, so at 30 Gwei that is 15,000,000 Gwei, or 0.015 ETH. At an ether price of 1,800 dollars that is 27 dollars. The same route at 200 Gwei costs 0.1 ETH, or 180 dollars, which alone can erase a thin spread. Gas is the one cost that does not scale with notional, so it dominates on small trades and is negligible on large ones.
If a price gap is visible on two DEXs, why is it usually gone before my transaction lands?
Pending transactions are broadcast publicly, so an obviously profitable route is visible to automated searchers who can copy it and pay a higher priority fee to be ordered first. This is the maximal extractable value auction, and in practice most of the margin on a clean arbitrage is bid away to block builders rather than kept by the trader. Serious operators submit through private relays instead of the public mempool for that reason. Treat any spread you can see on a public interface as already contested, and treat Flash Loan Arbitrage Profit Calculator (DeFi)'s output as an upper bound on what an unprotected transaction would capture.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎFutures Funding Rate Calculator
Calculate the cost or income from perpetual futures funding rate payments.
๐งฎDeFi Yield Tax Calculator
Calculate tax on DeFi yield farming, staking, and lending income by jurisdiction.
๐งฎBitcoin Mining Profitability Calculator
Calculate BTC mining profit from hash rate, electricity cost, pool fees, and difficulty.
๐งฎCrypto Tax Lot Calculator
Calculate capital gains using FIFO, LIFO, HIFO, and specific identification for crypto trades.
๐งฎCrypto Airdrop Tax Calculator
Calculate tax liability on crypto airdrops based on fair market value at time of receipt.
๐งฎCrypto Loss Harvesting Calculator
Identify crypto positions with unrealized losses for tax-loss harvesting opportunities.
๐งฎCrypto Position Size Calculator
Calculate optimal crypto position size from account balance, risk percentage, and stop loss.
๐งฎCrypto Leverage Calculator
Calculate crypto leveraged position size, liquidation price, and risk from margin and leverage.