Flash loan arbitrage lets you profit from price differences for the same asset across decentralized exchanges without putting up any of your own capital. The trick: borrow, buy low and sell high, and repay the loan plus fees all within a single atomic transaction. As long as the trading profit exceeds the flash loan fee and gas costs, the leftover money is pure profit. The entire process must be executed automatically by a smart contract. If any step fails, the whole transaction reverts – it’s as if nothing ever happened.
Introduction

Have you ever wondered how someone can make hundreds or even thousands of dollars in a matter of seconds using someone else’s money, without having a single token in their wallet to start? This isn’t a hack or an exploit – it’s a publicly available feature in decentralized finance (DeFi) called flash loan arbitrage.
For beginners, “zero-capital arbitrage” sounds too good to be true. But thanks to the atomic nature of blockchain transactions, it’s very real. This article starts from the very basics, walks you through a complete flash-loan arbitrage lifecycle, shows real cost comparisons with a data table, and answers the questions you’re most likely asking. Even if you only know basic Solidity, you’ll understand exactly how this whole game works by the end.
Full Breakdown: How Flash Loan Arbitrage Works
1. What’s a Flash Loan, and Why Does “Zero Capital” Work?
A flash loan is an uncollateralized, no-credit-check loan with one ironclad rule: the borrowed amount must be repaid within the same blockchain transaction. If repayment fails for any reason, the entire transaction is automatically reverted by the network, so the lender faces zero risk. Protocols like Aave, dYdX, and Uniswap V3 all offer flash loans.
Here’s a concrete example:
Inside one transaction, you borrow 100 ETH from Aave, use it for an arbitrage operation, and then pay back the 100 ETH plus a 0.09% fee. If the arbitrage fails and you can’t repay, the whole transaction rolls back. Your only loss is the gas fee for the failed attempt.
Because the funds are only in your contract’s possession for the few seconds that the transaction executes, you don’t need to own that capital upfront. That’s the door to “zero-capital arbitrage.”
2. Where Do Arbitrage Opportunities Come From?
Decentralized exchanges (DEXs) aren’t perfectly synchronized. When a token is cheaper on Uniswap than on Sushiswap, an arbitrageur can:
-
Buy that token at the lower price on Uniswap.
-
Sell it immediately at the higher price on Sushiswap.
-
Repay the flash loan principal and fee, and pocket the difference.
All these actions are performed by your smart contract within one atomic transaction. You just need to code the contract ahead of time and monitor on-chain price spreads. The moment a profitable gap appears, your bot fires off the transaction.
3. Step-by-Step Arbitrage in Practice
Step 1: Spot the opportunity
-
Run an off-chain script (Python or Node.js) that uses WebSocket connections to track the same trading pair (e.g., USDC/ETH) across multiple DEXs.
-
When the spread, after subtracting flash loan fees and gas costs, still shows a profit, trigger a transaction.
Step 2: Write the arbitrage smart contract
The core logic looks like this (pseudocode):
function executeArbitrage(
address dexBuy, address dexSell,
uint256 amount, address tokenIn, address tokenOut) external {
// 1. Borrow tokenIn (e.g., USDC) from a flash loan provider
flashLoanProvider.flashLoan(tokenIn, amount, data);}function onFlashLoan(uint256 amount, uint256 fee, bytes data) internal {
// 2. On dexBuy, swap tokenIn for tokenOut
dexBuy.swap(tokenIn, tokenOut, amount);
// 3. On dexSell, swap the received tokenOut back into tokenIn
uint256 amountBack = dexSell.swap(tokenOut, tokenIn, tokenOutBalance);
// 4. Repay the flash loan principal + fee
repayFlashLoan(tokenIn, amount + fee);
// 5. Send any leftover tokenIn to the contract owner as profit
sendProfit(tokenIn, amountBack - amount - fee);}
A real contract needs IERC20 transfers, SafeMath, and rigorous checks for slippage and minimum profit on every swap.
Step 3: Deploy the contract and fuel it with gas
Deploy the contract on Ethereum, Arbitrum, Polygon, or another EVM chain. Your externally owned account (EOA) wallet only needs enough of the native token (like ETH or MATIC) to cover gas fees. You don’t need to hold any of the tokens being traded.
Step 4: Listen and execute
When your off-chain bot detects a profitable spread, it calls executeArbitrage on your contract, using a high gas price to outbid competitors and avoid being front-run.
Step 5: Transaction completes, profit lands
Within a block (typically seconds), the transaction is mined. If it succeeds, the net profit sits in your contract or wallet. If it fails because someone beat you to it or the price moved, the whole thing reverts, and you’re only out the gas fee.
4. Critical Details: The Fee and Profit Calculation
Your profit must exceed two layers of cost:
-
Flash loan fee: For example, Aave V3 charges 0.05%–0.09% of the borrowed amount. Some protocols like Balancer even offer free flash loans.
-
DEX trading fees: Typically 0.3% per swap on constant-product AMMs. Two swaps (buy then sell) usually double that to ~0.6% total.
-
Gas fees: An arbitrage transaction on Ethereum mainnet usually consumes 300,000–500,000 gas. Depending on network demand, that could cost anywhere from $30 to $200.
The profit formula:
Net Profit = Proceeds from sell - Cost of buy - Flash loan fee - Gas cost
= Principal × (Spread% - Flash loan fee% - DEX fee%) - Gas cost
Only when the spread is wide enough to cover all three layers does the trade become worth executing.
Data Comparison: Real Costs and Profits Across Chains
The table below assumes a USDC/ETH arbitrage where a 1.2% price spread is detected between Uniswap V2 and Sushiswap. The borrowed principal is $100,000 worth of USDC. The flash loan fee is set at Aave V3’s 0.09%, and total DEX fees (two swaps) are 0.6%.
| Blockchain Network | Spread (after DEX fees) | Flash Loan Fee (0.09%) | Avg Gas Fee (USD) | Expected Net Profit (USD) | Net Profit as % of Principal |
|---|---|---|---|---|---|
| Ethereum | 0.6% | $90 | $85 | $425 | 0.425% |
| Arbitrum | 0.6% | $90 | $2.50 | $507.50 | 0.507% |
| Polygon | 0.6% | $90 | $0.15 | $509.85 | 0.51% |
| BNB Chain | 0.6% | $90 | $0.30 | $509.70 | 0.51% |
| Optimism | 0.6% | $90 | $3.00 | $507.00 | 0.507% |
What this tells you:
-
For the same $100k arbitrage, Ethereum mainnet’s gas cost eats heavily into profits. On L2s and sidechains, gas is almost negligible, so you keep way more profit.
-
In reality, most high-value arbitrage opportunities are already captured by MEV bots. If you’re doing this yourself, you’ll need to use private relays like Flashbots to avoid getting front-run.
-
If the spread shrinks to 0.8%, the math flips. On Ethereum, you’d likely lose money after fees; on Polygon, you’d still come out ahead. That’s exactly why arbitrage bots have flocked to L2s.
Q&A
Q1: Does flash loan arbitrage really require zero of my own money?
A: Yes, the “capital” used for the trade comes entirely from the flash loan within one transaction. You don’t need to hold USDC or ETH beforehand. However, your executing wallet must have a small amount of the native token (like ETH or MATIC) to pay for gas – usually just a few dozen dollars. That’s negligible next to the six-figure loan you’re momentarily using.
Q2: I can’t write smart contracts. Can I still do flash loan arbitrage?
A: It’s very difficult. Arbitrage contracts must dynamically build the trade route based on real-time prices. There’s no one-click wallet for it. You can study open-source arbitrage bot code or use visual tools like Furucombo, but flexibility will be limited. At a minimum, you should learn Solidity and ethers.js or web3.js.
Q3: What do I lose if the arbitrage fails?
A: If your contract logic is correct but the final profit isn’t enough to cover the repayment, the entire transaction reverts. You lose only the gas fee for that transaction. On Polygon, that might be $0.10; on a congested Ethereum mainnet, it could be over $100. There’s also a one-time gas cost to deploy the contract initially.
Q4: How often do arbitrage opportunities appear? Is it free money?
A: They appear constantly, but the vast majority are snapped up by professional MEV bots running on private channels like Flashbots or Eden Network. A regular person firing transactions manually has almost no chance unless you’re hunting obscure trading pairs or operating on smaller chains. The window of opportunity is extremely short.
Q5: What’s MEV front-running and how do I avoid it?
A: When you broadcast a transaction to the public mempool, bots can see it, copy it, and pay a higher gas price to get ahead of you. That’s front-running. The fix is to send your transaction directly to block builders via Flashbots, bypassing the public mempool entirely so nobody can spy on your trade.
Q6: Besides Uniswap and Sushiswap, where else can I arbitrage?
A: Any market with a price discrepancy can work, for example:
-
Between a DEX and a centralized exchange (often requires a bridge and isn’t fully atomic)
-
Stablecoin pools that temporarily depeg (like Curve’s 3pool)
-
Funding rate differences across derivatives protocols
-
Liquidation arbitrage: use a flash loan to repay a borrower’s debt and instantly claim the liquidation bonus
Q7: Don’t flash loans get used in attacks? How does that affect me?
A: Flash loans are a neutral financial primitive, but yes, attackers have combined them with protocol vulnerabilities to manipulate prices. For legitimate arbitrageurs, this means mainstream opportunities are even more competitive, and you must guard against extreme price moves by setting strict slippage protection.
Q8: What’s the best blockchain for a beginner to start on?
A: Polygon or Arbitrum. Gas fees are so low you can afford to make mistakes while testing. Build and debug your full workflow on a testnet like Sepolia first, then move to a low-cost mainnet for small-value live trades.
Summary
Flash loan arbitrage is a perfect showcase of DeFi’s “composability.” Lending, swapping, and atomic execution snap together like Lego bricks inside a few lines of code, automatically capturing profits from market inefficiencies. It requires zero starting capital, but demands serious technical chops and lightning-fast execution.
For beginners, understanding the mechanics is a fantastic gateway into DeFi’s inner workings. But actually making money on mainnet has become an arms race against sophisticated MEV bots. If you’re passionate about coding and on-chain data, start in a simulation environment, write your own simple arbitrage contract, and watch capital flow in a single transaction. Just remember: control your risk, and never commit more to gas fees than you’re willing to lose.
