DeFi13 min read

DeFi Lending Guide: How to Calculate Liquidation Risk & Optimize Borrowing Positions

Complete guide to DeFi lending on Aave, Compound, and MakerDAO. Learn to calculate health factors, liquidation prices, and optimize your borrowing positions safely.

Web3Calc Team
DeFi Lending Guide: How to Calculate Liquidation Risk & Optimize Borrowing Positions

DeFi Lending Guide: How to Calculate Liquidation Risk & Optimize Borrowing Positions

Last Updated: December 10, 2025

DeFi lending has revolutionized how we access liquidity and earn yield on crypto assets. With over $20 billion locked in protocols like Aave, Compound, and MakerDAO, understanding how to calculate and manage your lending positions is crucial for success.

This comprehensive guide will teach you everything you need to know about DeFi lending calculations, from health factors to liquidation prices.

Table of Contents

  1. What is DeFi Lending?
  2. Key Metrics Explained
  3. How to Calculate Health Factor
  4. Understanding Liquidation Risk
  5. Protocol Comparison
  6. Risk Management Strategies
  7. Common Use Cases
  8. Step-by-Step Examples

What is DeFi Lending? {#what-is-defi-lending}

DeFi (Decentralized Finance) lending protocols allow users to:

  • Supply assets to earn interest (lending/supplying)
  • Borrow assets against collateral

Unlike traditional finance:

  • Permissionless - Anyone with a wallet can participate
  • Non-custodial - You control your funds
  • Transparent - All transactions on-chain
  • Automated - Smart contracts handle everything
  • Over-collateralized - Must provide collateral worth more than the loan

How It Works

Lending (Supply Side):

  1. Deposit crypto (ETH, USDC, etc.)
  2. Receive interest-bearing tokens (aTokens on Aave, cTokens on Compound)
  3. Earn APY on deposits
  4. Withdraw anytime (subject to available liquidity)

Borrowing:

  1. Supply collateral (e.g., 10 ETH worth $35,000)
  2. Borrow up to max Loan-to-Value ratio (e.g., 75% = $26,250)
  3. Pay interest on borrowed amount
  4. Must maintain health factor above 1.0 to avoid liquidation

Key Metrics Explained {#key-metrics-explained}

1. Health Factor (HF)

The health factor is the most critical metric for borrowers. It indicates how safe your position is from liquidation.

Formula:

Health Factor = (Collateral Value × Liquidation Threshold) / Borrowed Value

Interpretation:

  • HF > 3.0 - Very safe position
  • HF 2.0 - 3.0 - Safe position
  • HF 1.5 - 2.0 - Moderate risk
  • HF 1.0 - 1.5 - High risk (monitor closely)
  • HF < 1.0 - Position is liquidated ⚠️

Example:

  • Collateral: 10 ETH at $3,500 = $35,000
  • Liquidation Threshold: 80%
  • Borrowed: $20,000 USDC
  • HF = ($35,000 × 0.80) / $20,000 = 1.40
  • Status: High risk - needs monitoring

2. Loan-to-Value (LTV)

LTV determines how much you can borrow against your collateral.

Formula:

LTV = Borrowed Value / Collateral Value × 100%

Typical LTV Ratios:

  • Stablecoins (USDC, DAI): 85% - Low volatility
  • Blue Chips (ETH, WBTC): 75-80% - Moderate volatility
  • Altcoins (LINK, AAVE): 60-70% - Higher volatility

Example:

  • Collateral: $35,000
  • Borrowed: $20,000
  • LTV = $20,000 / $35,000 = 57.14%

3. Liquidation Threshold

The liquidation threshold is the LTV at which your position becomes eligible for liquidation. It's always higher than max LTV to provide a buffer.

Example (ETH on Aave):

  • Max LTV: 75%
  • Liquidation Threshold: 80%
  • Buffer: 5%

This means you can borrow up to 75% of collateral value, but liquidation happens at 80% LTV.

4. Liquidation Price

The collateral price at which your position will be liquidated.

Formula:

Liquidation Price = Borrowed Value / (Collateral Amount × Liquidation Threshold)

Example:

  • Collateral: 10 ETH
  • Borrowed: $20,000
  • Liquidation Threshold: 80%
  • Liquidation Price = $20,000 / (10 × 0.80) = $2,500

If ETH drops to $2,500, you get liquidated. Current price is $3,500, so that's a -28.6% drop before liquidation.

5. Liquidation Penalty

When liquidated, you pay a penalty (typically 5-10%) to incentivize liquidators.

Example:

  • Collateral value at liquidation: $25,000
  • Debt: $20,000
  • Liquidation penalty: 5%
  • You lose: $20,000 × 1.05 = $21,000 worth of collateral
  • You keep: $25,000 - $21,000 = $4,000

How to Calculate Health Factor {#health-factor-calculation}

Let's walk through a complete calculation:

Scenario:

  • You deposit 10 ETH as collateral
  • ETH price: $3,500
  • You borrow 20,000 USDC
  • Protocol: Aave V3
  • ETH Liquidation Threshold: 80%

Step 1: Calculate Collateral Value

Collateral Value = 10 ETH × $3,500 = $35,000

Step 2: Calculate Borrow Value

Borrow Value = 20,000 USDC × $1 = $20,000

Step 3: Apply Liquidation Threshold

Weighted Collateral = $35,000 × 0.80 = $28,000

Step 4: Calculate Health Factor

Health Factor = $28,000 / $20,000 = 1.40

Result: HF = 1.40 (High Risk ⚠️)

Action Required: Add more collateral or repay debt to reach HF > 2.0 for safety.


Understanding Liquidation Risk {#liquidation-risk}

What Happens During Liquidation?

  1. Health factor drops below 1.0
  2. Liquidators repay part/all of your debt
  3. They receive your collateral + liquidation bonus
  4. You lose collateral (but debt is cleared)

Real-World Example: The May 2021 Crash

On May 19, 2021, crypto crashed 50% in hours:

User Position Before:

  • Collateral: 100 ETH at $4,000 = $400,000
  • Borrowed: $250,000 USDC
  • LTV: 62.5%
  • Health Factor: 2.05 ✅

After Crash (ETH drops to $2,000):

  • Collateral: 100 ETH at $2,000 = $200,000
  • Borrowed: $250,000 USDC
  • LTV: 125% (impossible!)
  • Health Factor: 0.64 ⚠️ LIQUIDATED

Result:

  • Lost all 100 ETH (worth $200K)
  • Debt cleared
  • Total loss: $150,000 (initial $400K - $250K debt)

How to Avoid Liquidation

  1. Maintain high health factor (>2.0)
  2. Borrow conservatively (50-60% of max LTV)
  3. Set price alerts for your liquidation price
  4. Keep reserves to add collateral quickly
  5. Monitor during volatility
  6. Use stablecoins as collateral for lower risk

Protocol Comparison {#protocol-comparison}

Aave V3 (Recommended)

Pros:

  • ✅ Largest TVL ($10B+)
  • ✅ Multi-chain (Ethereum, Polygon, Arbitrum, Base, etc.)
  • ✅ Best liquidity
  • ✅ E-mode for correlated assets (stablecoins, ETH derivatives)
  • ✅ Isolation mode for risky assets
  • ✅ Flash loans available

Cons:

  • ❌ More complex interface
  • ❌ Higher gas costs on Ethereum

Best For: Most users, especially multi-chain

Example Rates (December 2025):

  • ETH Supply: 2.5% APY
  • ETH Borrow: 3.8% APY
  • USDC Supply: 4.2% APY
  • USDC Borrow: 5.5% APY

Compound V3

Pros:

  • ✅ Battle-tested (since 2018)
  • ✅ Simple, clean interface
  • ✅ Lower liquidation penalty (8% vs 5%)
  • ✅ COMP token rewards

Cons:

  • ❌ Ethereum only (V2)
  • ❌ Less liquidity than Aave
  • ❌ Fewer supported assets

Best For: Ethereum users, beginners

Example Rates:

  • ETH Supply: 2.2% APY
  • ETH Borrow: 3.5% APY
  • USDC Supply: 3.8% APY
  • USDC Borrow: 5.2% APY

Spark Protocol (MakerDAO)

Pros:

  • ✅ Backed by MakerDAO (DAI issuer)
  • ✅ Competitive DAI rates
  • ✅ Higher max LTV on some assets
  • ✅ Integration with DeFi ecosystem

Cons:

  • ❌ Smaller user base
  • ❌ Less liquidity
  • ❌ Primarily DAI-focused

Best For: DAI users, MakerDAO ecosystem participants

Example Rates:

  • ETH Supply: 3.5% APY
  • ETH Borrow: 4.0% APY
  • DAI Supply: 5.0% APY
  • DAI Borrow: 3.5% APY

Risk Management Strategies {#risk-management}

Strategy 1: Conservative Borrowing

Target: Health Factor > 2.5

Approach:

  • Borrow only 40-50% of max LTV
  • Use stable collateral (USDC, DAI)
  • Monitor weekly

Example:

  • Deposit: $100,000 USDC
  • Max borrow at 85% LTV: $85,000
  • Conservative borrow: $42,500 (50% of max)
  • Health Factor: 3.4 ✅

Strategy 2: Moderate Risk

Target: Health Factor 1.8-2.2

Approach:

  • Borrow 60-70% of max LTV
  • Use blue chip collateral (ETH, WBTC)
  • Monitor daily during volatility

Example:

  • Deposit: 10 ETH at $3,500 = $35,000
  • Max borrow at 75% LTV: $26,250
  • Moderate borrow: $21,000 (60% of max = 80% LTV)
  • Health Factor: 1.90 ⚠️

Strategy 3: Recursive Lending (Advanced)

⚠️ High Risk - Not recommended for beginners

How it works:

  1. Deposit 10 ETH ($35,000)
  2. Borrow 7.5 ETH ($26,250) - 75% LTV
  3. Re-deposit borrowed 7.5 ETH
  4. Borrow 5.6 ETH more
  5. Repeat...

Result:

  • Effective leverage: 3-4x
  • Higher yields but extreme liquidation risk
  • Not recommended unless you're experienced

Common Use Cases {#use-cases}

1. Leverage Long Position (Bullish)

Goal: Amplify gains if you're bullish on ETH

Steps:

  1. Deposit 10 ETH ($35,000)
  2. Borrow $20,000 USDC
  3. Buy 5.7 more ETH with USDC
  4. Now you have 15.7 ETH exposure (vs 10)

Scenario Analysis:

If ETH +20% ($3,500 → $4,200):

  • Without leverage: 10 ETH × $4,200 = $42,000 (profit: $7,000)
  • With leverage: 15.7 ETH × $4,200 = $65,940 - $20,000 debt = $45,940 (profit: $10,940)
  • Extra profit: $3,940 (56% more)

If ETH -20% ($3,500 → $2,800):

  • Without leverage: 10 ETH × $2,800 = $28,000 (loss: $7,000)
  • With leverage: 15.7 ETH × $2,800 = $43,960 - $20,000 debt = $23,960 (loss: $11,040)
  • Extra loss: $4,040 (57% worse)
  • Health Factor drops to 1.1 ⚠️ Risk of liquidation!

2. Tax-Efficient Liquidity

Goal: Get cash without triggering capital gains tax

Scenario:

  • You bought ETH at $1,000, now worth $3,500
  • Need $50,000 for house down payment
  • Don't want to sell and pay 20-37% capital gains tax

Solution:

  1. Supply 15 ETH ($52,500)
  2. Borrow $40,000 USDC
  3. Cash out USDC
  4. Pay ~4% interest ($1,600/year)
  5. Repay when convenient (or never, just pay interest)

Tax Savings:

  • Capital gains on $50K: ~$10,000-$18,500
  • Interest cost per year: $1,600
  • Net savings: $8,400-$16,900 first year

3. Yield Farming (Market Neutral)

Goal: Earn net positive yield

Setup:

  1. Deposit stablecoins earning 5% APY
  2. Borrow assets at 3% APY
  3. Net yield: 2% APY

Example:

  • Supply: $100,000 USDC at 5% APY = $5,000/year
  • Borrow: $75,000 ETH at 3% APY = $2,250/year
  • Net yield: $2,750/year (2.75%)

Plus potential upside if borrowed ETH appreciates!

4. Short Selling (Bearish)

Goal: Profit from price decline

Steps:

  1. Deposit $50,000 USDC as collateral
  2. Borrow 10 ETH at $3,500
  3. Sell 10 ETH for $35,000 USDC
  4. Wait for ETH to drop
  5. Buy back 10 ETH at $3,000 for $30,000
  6. Repay 10 ETH loan
  7. Profit: $5,000 (minus interest)

Risk: If ETH goes up, you still owe 10 ETH + interest!


Step-by-Step Examples {#examples}

Example 1: Safe Lending Position

Goal: Earn yield with minimal liquidation risk

Setup:

  • Deposit: 20,000 USDC
  • Borrow: 8,000 DAI (40% LTV)
  • Protocol: Aave V3

Calculations:

  1. Collateral Value: $20,000
  2. Borrow Value: $8,000
  3. LTV: 40%
  4. Liquidation Threshold (USDC): 90%
  5. Health Factor: ($20,000 × 0.90) / $8,000 = 2.25 ✅

Annual Costs/Revenue:

  • USDC Supply APY: 4.5% = $900/year
  • DAI Borrow APY: 3.5% = $280/year
  • Net: +$620/year profit 🎉

Liquidation Risk: Virtually zero (stablecoin collateral)

Example 2: Moderate Risk Position

Goal: Get liquidity while maintaining reasonable safety

Setup:

  • Deposit: 10 ETH at $3,500 = $35,000
  • Borrow: 20,000 USDC (57% LTV)
  • Protocol: Aave V3
  • Target HF: 2.0

Calculations:

  1. Collateral Value: $35,000
  2. Borrow Value: $20,000
  3. LTV: 57.14%
  4. Liquidation Threshold (ETH): 80%
  5. Health Factor: ($35,000 × 0.80) / $20,000 = 1.40 ⚠️

Problem: HF too low!

Solution - Add Collateral:

  • Target HF: 2.0
  • Required collateral: (2.0 × $20,000) / 0.80 = $50,000
  • Need to add: 4.3 ETH ($15,000)

New Position:

  • Collateral: 14.3 ETH = $50,000
  • Borrow: $20,000
  • New HF: 2.0 ✅

Liquidation Price:

  • Liq Price = $20,000 / (14.3 × 0.80) = $1,748
  • Current: $3,500
  • Buffer: -50% before liquidation

Annual Cost:

  • ETH Supply: 2.5% on $50K = $1,250
  • USDC Borrow: 3.8% on $20K = $760
  • Net cost: $760 - $1,250 = +$490 profit

Example 3: High-Risk Leverage

⚠️ Advanced traders only!

Goal: 2x leveraged long on ETH

Setup:

  • Deposit: 10 ETH at $3,500 = $35,000
  • Borrow: $26,250 USDC (75% LTV = max)
  • Buy: 7.5 more ETH
  • Total exposure: 17.5 ETH

Calculations:

  1. Collateral: 17.5 ETH = $61,250
  2. Debt: $26,250
  3. Effective leverage: 1.75x
  4. LTV: 75% (at max!)
  5. Health Factor: ($35,000 × 0.80) / $26,250 = 1.07 ⚠️⚠️

Liquidation Price:

  • Liq Price = $26,250 / (10 × 0.80) = $3,281
  • Current: $3,500
  • Buffer: Only -6.3% before liquidation! 🚨

Scenario Analysis:

If ETH +10% → $3,850:

  • Collateral: 10 ETH × $3,850 = $38,500
  • Debt: $26,250
  • Profit: $3,500 vs $3,500 unlevered = Same!
  • (Need bigger move to profit after interest)

If ETH -7% → $3,255:

  • LIQUIDATED! 💀
  • Lose most of your ETH

Verdict: Extremely risky. Not recommended.


Using the Calculator

Our DeFi Lending Calculator helps you:

  1. Calculate health factor instantly
  2. Find liquidation price for any position
  3. Compare protocols (Aave, Compound, MakerDAO)
  4. Simulate price scenarios (-50% to +50%)
  5. Optimize borrowing for target health factor
  6. Calculate costs over any timeframe

Example Use:

  1. Enter your collateral (10 ETH at $3,500)
  2. Enter borrow amount (20,000 USDC)
  3. Select protocol (Aave V3)
  4. Instantly see:
    • Health factor: 1.40 ⚠️
    • Liquidation price: $2,500
    • Daily cost: $1.50
    • Risk level: High
    • Recommended action: Add collateral

Best Practices Summary

✅ DO:

  • Maintain health factor above 2.0
  • Set price alerts for liquidation prices
  • Start with small positions
  • Use stablecoins for low risk
  • Monitor positions daily during volatility
  • Keep extra funds to add collateral
  • Calculate costs before opening positions

❌ DON'T:

  • Borrow at max LTV (no buffer)
  • Ignore health factor warnings
  • Use recursive lending without experience
  • Forget about interest costs
  • Panic sell during dips (add collateral instead)
  • Underestimate volatility risk

Frequently Asked Questions

Q: Can I lose more than my collateral? A: No. DeFi lending is over-collateralized. Worst case is losing collateral to liquidation.

Q: What's a safe health factor? A: 2.0+ is safe. 2.5+ is very safe. 3.0+ is conservative.

Q: How often do rates change? A: Every block (~12 seconds) based on protocol utilization.

Q: Which protocol is best? A: Aave V3 for most users (best liquidity, multi-chain). Compound for simplicity.

Q: Are liquidations instant? A: Yes. Liquidators monitor positions 24/7 with bots.

Q: Can I repay partially? A: Yes. Repaying any amount improves your health factor.


Conclusion

DeFi lending is powerful but requires careful risk management. The most important lesson:

Always maintain a healthy position (HF > 2.0) and never borrow more than 60% of max LTV.

Use our calculator to:

  • Simulate positions before opening
  • Monitor existing positions
  • Calculate optimal strategies
  • Compare protocols

Ready to start? Try the calculator: DeFi Lending Calculator →


Related Tools


Disclaimer: This guide is for educational purposes only. DeFi lending involves significant risk. Never invest more than you can afford to lose. Always do your own research. Not financial advice.

Share this article:

Related Articles