Flash Loan Profit Calculator
Calculate potential flash loan arbitrage profit from price difference, loan amount, and gas. Enter values for instant results with step-by-step formulas.
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\nGross revenue: 55.556 ร $1,825 = $101,388.89\nGross profit: $1,388.89\nFlash loan fee: $100,000 ร 0.09% = $90.00\nDEX fees: $100,000 ร 0.3% + $101,389 ร 0.3% = $604.17\nSlippage: $101,389 ร 0.5% = $506.94\nGas: ~$27.00\nTotal fees: $1,228.11\nNet 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\nGross revenue: 500 ร $100.50 = $50,250\nGross profit: $250\nFlash loan fee: $50,000 ร 0.09% = $45\nDEX fees: $50,000 ร 0.3% + $50,250 ร 0.3% = $300.75\nSlippage: $50,250 ร 0.5% = $251.25\nGas: ~$45\nTotal fees: $642.00\nNet profit: $250 - $642 = -$392
Result: Net Profit: -$392.00 | 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.
How accurate are the results from Flash Loan Profit Calculator?
All calculations use established mathematical formulas and are performed with high-precision arithmetic. Results are accurate to the precision shown. For critical decisions in finance, medicine, or engineering, always verify results with a qualified professional.