Markets

What is a flash loan?

A flash loan is an uncollateralised loan borrowed and repaid in one transaction. Learn how atomicity makes it possible and why it appears in DeFi exploits.

What is a flash loan?

Mechanics, not signals. This explains how a market feature works. It is not a trading strategy, entry, target, or recommendation to buy or sell anything.

Quick answer

A flash loan is an uncollateralised loan that must be borrowed and repaid within a single blockchain transaction. If it is not repaid with its fee before the transaction ends, the whole transaction reverts, which is what lets the loan be issued with no collateral at all.

Key points

  • A flash loan is borrowed and repaid in one atomic transaction
  • Atomicity means the whole transaction reverts if repayment fails
  • No collateral is needed because failed loans are simply erased
  • Legitimate uses include arbitrage, collateral swaps and refinancing
  • Flash loans amplify attacks on weak oracles but are not the flaw itself

A flash loan is an uncollateralised loan that must be borrowed and repaid within a single blockchain transaction. If the borrowed amount, plus any fee, is not returned before that transaction finishes, the entire transaction is reversed as though it never happened — which is what allows the loan to be made with no collateral at all. Flash loans are a distinctive product of decentralised finance and exist because of how blockchain transactions settle atomically.

This article explains how flash loans work, what makes them possible, and why they carry both legitimate uses and security implications. It is educational and describes mechanics; it is not a how-to for building or exploiting them.

What makes a flash loan possible

The property that makes flash loans work is atomicity. On networks such as Ethereum, a single transaction can contain many steps, and it either completes entirely or fails entirely — there is no in-between. If any step fails, or a condition is not met, every change made in that transaction is rolled back to its starting state.

A flash loan uses this all-or-nothing guarantee as its security. A smart contract lends funds at the start of a transaction on one condition: by the end of that same transaction, the funds plus a fee must be back. If they are not, the whole transaction reverts, so from the lender’s point of view the loan was never actually made. There is no risk of default in the ordinary sense, because a failure to repay simply erases the entire operation, including the borrowing.

How a flash loan works, step by step

Within one transaction, a typical flash loan proceeds like this:

  • Borrow. The user’s contract requests a large amount of an asset from a lending protocol’s liquidity pool. The funds are transferred immediately.
  • Use. The contract does something with the borrowed funds — a sequence of on-chain actions across one or more protocols — all still inside the same transaction.
  • Repay. Before the transaction ends, the contract returns the borrowed amount plus the protocol’s fee to the pool.
  • Settle or revert. If repayment succeeds, the transaction confirms and everything stands. If it does not, the transaction reverts entirely — the borrow, the actions, and any intermediate state all disappear.

Because all of this happens atomically, the borrower never has to post collateral. The protocol is protected not by a deposit but by the certainty that non-repayment cancels the whole thing.

Legitimate uses of flash loans

Despite their association with attacks, flash loans have genuine, everyday uses in DeFi where a large sum is needed only momentarily:

  • Arbitrage. Capturing a price difference for the same asset across venues within one transaction, without needing to own the capital upfront. See arbitrage and how automated market makers work.
  • Collateral swaps. Replacing the collateral backing a loan on a lending protocol in a single step, avoiding the need to unwind and rebuild a position manually.
  • Refinancing and self-liquidation. Moving a debt position from one protocol to another, or closing a position cleanly, using borrowed funds that are repaid in the same transaction.

In each case the defining feature is the same: a large amount of capital is required only for the instant of the transaction, and the flash loan supplies it without collateral because repayment is guaranteed by atomicity.

A worked illustration: arbitrage in one transaction

These figures are invented to show the flow, not real data. Suppose the same token is momentarily priced lower on one exchange than another. Without a flash loan, capturing that gap would need a large amount of capital upfront. With one, the whole thing fits in a single transaction:

  • Borrow 1,000,000 units of a stablecoin from a lending pool via a flash loan.
  • Buy the underpriced token on the cheaper venue with the borrowed funds.
  • Sell it on the dearer venue, ending with more stablecoin than was borrowed.
  • Repay the 1,000,000 units plus the protocol’s fee, keeping the remainder as profit.

If, at the repayment step, there were not enough funds to return the loan and fee — because the price gap closed, or fees ate the margin — the transaction would revert and none of the steps would have happened. The borrower risks only the transaction (gas) cost of a failed attempt, never the borrowed capital. That asymmetry is the whole appeal of the tool for legitimate uses.

The security dimension

Flash loans also feature in a class of DeFi exploits, and it is worth understanding why at an awareness level. A flash loan lets anyone command a very large amount of capital for one transaction, regardless of their own wealth. If another protocol has a vulnerability that depends on the size of a position — for example, one that relies on a price source that can be temporarily skewed by a large trade — an attacker can borrow heavily via a flash loan, manipulate that vulnerable mechanism within the same transaction, and repay the loan from the proceeds.

The important nuance is that the flash loan is not itself the vulnerability. It is an amplifier: it removes the capital barrier that would otherwise limit who could attempt such an exploit. The underlying weakness is usually a flawed price oracle or economic-design flaw in the targeted protocol. The defensive lesson, which reputable protocols apply, is to use manipulation-resistant price sources (such as time-weighted averages or independent oracle feeds) and to design mechanisms that do not break when a single transaction wields a large, temporary balance. This is described so readers understand the risk, not as operational guidance.

Fees, limits and availability

Flash loans are not free, and they are not available everywhere or for everything. A few practical points shape how they work in real protocols:

  • There is a fee. Lending protocols charge a small percentage fee on the borrowed amount, which must be repaid along with the principal inside the transaction. If the intended operation cannot cover both the principal and the fee, the transaction reverts, so the fee is part of the break-even calculation for any legitimate use.
  • Liquidity sets the ceiling. The most you can borrow is bounded by the funds available in the pool at that moment. A flash loan cannot conjure liquidity that is not there; it can only borrow what the protocol currently holds.
  • Not every protocol or asset supports them. Flash loans are a specific feature that a lending protocol must implement, and support varies by asset and by network. Where they exist, the protocol’s own documentation defines the exact fee, function calls, and constraints.

These details are why flash loans, despite sounding like free money, are a precise engineering tool with real costs and boundaries rather than an open-ended source of capital.

Flash loans vs ordinary loans

Feature Flash loan Ordinary crypto loan
Collateral None required Usually over-collateralised
Duration One transaction Open-ended, until repaid
Default risk to lender Effectively none (reverts) Managed via collateral and liquidation
Who can use it Anyone who can meet repayment in-transaction Anyone who can post collateral

The contrast highlights how unusual the flash loan is: it is a loan whose safety comes entirely from the structure of the transaction rather than from anything the borrower puts up. Where ordinary lending manages default with collateral and, if needed, liquidation, a flash loan manages it by simply erasing failed attempts.

The bottom line

A flash loan is an uncollateralised loan that lives and dies inside one blockchain transaction: borrow, use, and repay atomically, or the whole transaction reverts. That atomic guarantee is what removes the need for collateral. Flash loans power legitimate DeFi actions like arbitrage, collateral swaps and refinancing, but the same access to instant, large-scale capital can amplify attacks against protocols with weak price oracles or economic designs. Understanding flash loans means understanding atomic transactions — the mechanism that makes an uncollateralised loan safe for the lender in the first place.

Sources

  1. Ethereum.org: Flash loans
  2. Aave developer docs: Flash Loans

Frequently asked questions

How can a flash loan be uncollateralised?

Because it must be repaid within the same transaction that issues it. If repayment fails, the entire transaction reverts as if it never happened, so the lender cannot lose the funds.

What are flash loans legitimately used for?

Common uses include arbitrage across venues, swapping the collateral behind a loan, and refinancing or cleanly closing debt positions — any case where a large sum is needed for only one transaction.

Are flash loans themselves a security flaw?

No. A flash loan amplifies attacks by removing the capital barrier, but the actual weakness lies in a targeted protocol, often a manipulable price oracle or economic-design flaw, not in the loan itself.

Last reviewed: 26 Aug 2026 Next review: 26 Feb 2027 Section: Markets
Marcus Reed
Market structure writer · Order books, liquidity, derivatives mechanics

Marcus Reed explains how crypto markets function mechanically — order books, liquidity, spreads and exchange mechanics. He describes how markets work, never what to trade.

More by Marcus Reed

Related

Markets

What market makers do

Market makers continuously quote both a buy and a sell price and earn the spread for providing instant liquidity. Here…

Marcus Reed · Aug 26, 2026 · 6 min
Markets

What is a candlestick chart?

A candlestick chart shows the open, high, low and close for each period. Learn how to read a candle's body,…

Marcus Reed · Aug 26, 2026 · 6 min