MrDeFi
DeFi Protocols2026-07-164 min read

How Do Flash Loans Work? Uncollateralized Borrowing Explained

How flash loans let users borrow without collateral by requiring repayment within a single atomic transaction, and their legitimate uses.

A flash loan is a form of uncollateralized borrowing unique to DeFi, made possible by the atomic nature of blockchain transactions: a user can borrow any amount of available liquidity from a lending pool with zero upfront collateral, as long as the entire loan — principal plus a fee — is repaid within the same transaction, or the whole transaction, including the loan itself, is automatically reversed as if it never happened.

This has no direct equivalent in traditional finance, where a loan and its repayment are necessarily separated in time, creating default risk that lenders manage through collateral, credit checks, or legal recourse. Flash loans sidestep all of that by exploiting a specific technical property of blockchains: a transaction either fully executes, start to finish, or fully fails and reverts, with no in-between state possible.

Why atomicity makes this safe for lenders

Because a blockchain transaction is all-or-nothing, a smart contract can safely lend out funds mid-transaction on the condition that, by the time that same transaction finishes executing, the funds (plus a fee) have been returned. If the borrower's code fails to repay — whatever the reason, whether the planned strategy didn't work out or something else went wrong — the entire transaction, including the initial loan disbursement, is automatically undone by the blockchain itself. The lending pool's funds are never actually at risk of not coming back, because there's no scenario where the transaction "half completes." This is what allows flash loans to skip collateral entirely — the lender's protection isn't collateral, it's the atomicity guarantee of the underlying blockchain.

What a flash loan actually looks like in practice

A flash loan is executed through custom smart contract code (not a manual wallet transaction) that, within one atomic sequence, typically:

  1. Borrows a large amount of an asset from a lending pool that offers flash loans.
  2. Uses that borrowed amount to execute some strategy — a swap, a series of swaps, a collateral swap on a lending position, or another action requiring temporary access to capital.
  3. Repays the loan plus the required fee, still within the same transaction.
  4. If steps 2–3 don't result in the loan being fully repaid, the entire transaction reverts, and it's as if nothing happened at all (aside from the gas fee paid for the attempted, reverted transaction).

Legitimate use cases

  • Arbitrage. A price discrepancy for the same asset across two different venues can be captured without needing to hold the capital yourself — borrow the funds, execute both sides of the trade, repay the loan, and keep the difference, all within one transaction.
  • Collateral swaps. A borrower on a lending protocol who wants to switch their posted collateral from one asset to another, without first having to repay and re-borrow using separate capital, can use a flash loan to execute the swap atomically.
  • Self-liquidation or liquidation avoidance. A borrower close to being liquidated can use a flash loan to repay part of their debt and rebalance their position, potentially avoiding a costlier third-party liquidation.
  • Third-party liquidations. Liquidators use flash loans to acquire the capital needed to repay a borrower's debt and claim the discounted collateral, without needing to hold that capital themselves in advance — see the liquidation glossary entry for how that process generally works.

The reputation problem: flash loan attacks

Flash loans have also been a component of numerous DeFi exploits, which is why the term carries a negative connotation for many people outside DeFi. It's important to be precise about what actually happened in most of these cases: the flash loan itself is rarely the vulnerability — it's simply a tool that gives an attacker access to a large amount of temporary capital, which they then use to manipulate some other, separately flawed mechanism (commonly a manipulable price oracle, or a governance vote exploited using temporarily-borrowed voting power) within the same transaction. See our DeFi oracles explainer for why oracle manipulation specifically has been such a common target, and our common DeFi scams piece for how exploits like this fit into the broader risk landscape.

Aspect Traditional loan Flash loan
Collateral required Yes, typically None
Repayment window Extended, over time Same transaction (seconds)
Lender protection Collateral, credit checks Transaction atomicity (auto-reversal)
Common legitimate use General borrowing Arbitrage, collateral swaps, liquidations

What this means for protocol designers and users

For protocol designers, flash loans are a reminder that any mechanism relying on a user having a "normal," time-limited amount of capital or voting power needs to be robust against an attacker temporarily wielding an arbitrarily large amount within a single transaction — this has driven improvements like time-weighted average price oracles and governance designs resistant to flash-loan-based vote manipulation. For everyday users, flash loans themselves aren't something you need to worry about being a victim of directly — they're a tool used by developers and sophisticated actors, not something applied to a typical user's own funds without their own code initiating it.

Bottom line

Flash loans are a genuinely novel financial primitive made possible by blockchain transaction atomicity, enabling legitimate uses like arbitrage, collateral swaps, and efficient liquidations without requiring upfront capital — but the same capital-without-collateral property has also made them a common tool in exploits targeting other, separately vulnerable mechanisms like manipulable oracles. Understanding flash loans mostly matters for evaluating why a specific protocol exploit happened, not as a risk to manage in your own everyday DeFi use.

Related articles

This article is for educational purposes only and is not financial advice. DeFi involves significant risk, including total loss of funds. Always do your own research.