> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jup.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# Liquidation

> How liquidation works on Jupiter Perps: what triggers it, how the liquidation price is calculated, how it changes over time, and how to avoid it.

This page explains the liquidation mechanism on Jupiter Perps: what triggers it, how the liquidation price is calculated for long and short positions, how it drifts over time, and how to manage your risk.

## What Is Liquidation?

Liquidation is the automatic closure of a position by the protocol when the trader's collateral is no longer sufficient to cover the outstanding losses and fees. It is triggered when the oracle price reaches the position's **liquidation price**.

<Warning>
  When a position is liquidated, **all remaining collateral is forfeited** to the JLP as a liquidation fee. You will not receive any portion of your collateral back. Only deposit collateral that is within your risk tolerance.
</Warning>

***

## Liquidation Trigger

| Position | Liquidation occurs when                            |
| -------- | -------------------------------------------------- |
| Long     | Oracle price **falls below** the liquidation price |
| Short    | Oracle price **rises above** the liquidation price |

***

## Liquidation Price Formula

The liquidation price is the oracle price at which the position's effective collateral (after fees) equals the minimum margin required by the protocol.

### Long Position

```math theme={null}
Liquidation Price (Long) = price - (|collateral_size - close_fee - borrow_fee - (size / max_lev)| * price) / size
```

### Short Position

```math theme={null}
Liquidation Price (Short) = price + (|collateral_size - close_fee - borrow_fee - (size / max_lev)| * price) / size
```

### Variable Definitions

| Variable          | Definition                                              |
| ----------------- | ------------------------------------------------------- |
| `price`           | Average entry price (USD) of the position               |
| `collateral_size` | Current collateral value (USD)                          |
| `close_fee`       | Estimated close fee (USD) — base fee + price impact fee |
| `borrow_fee`      | Accumulated borrow fees (USD) to date                   |
| `size`            | Position size (USD)                                     |
| `max_lev`         | Protocol-level maximum leverage: **500**                |

<Note>
  `max_lev` in the formula refers to the **protocol limit of 500x**, which is used to define the minimum maintenance margin. This is distinct from the **250x trading maximum** available when opening a position.
</Note>

***

## How the Liquidation Price Changes Over Time

The liquidation price is **not static**. It moves as fees accumulate:

* **Borrow fees** are deducted from collateral hourly. As collateral decreases, the liquidation price drifts toward the current market price.
* The effect is most significant at **leverage above 10x** and for positions held over extended periods.

<Warning>
  A position that appears safely distant from liquidation when opened can approach its liquidation price over time due to borrow fee accumulation — even without any price movement.
</Warning>

***

## Liquidation Example

**Setup:** \$10,000 collateral long position approaching liquidation

| Item                                   | Value                                             |
| -------------------------------------- | ------------------------------------------------- |
| Position collateral                    | \$10,000                                          |
| Remaining collateral after loss + fees | \$1,000                                           |
| Liquidation penalty                    | \$1,000 (entire remaining collateral goes to JLP) |
| Returned to trader                     | \$0                                               |

***

## How to Avoid Liquidation

<CardGroup cols={2}>
  <Card title="Monitor your liquidation price" icon="eye">
    Check the Positions tab regularly, especially during volatile market conditions or for long-duration positions.
  </Card>

  <Card title="Deposit additional collateral" icon="plus">
    Adding collateral reduces leverage and moves the liquidation price further from the current market price. Use the **Edit** button on any open position.
  </Card>

  <Card title="Use Stop Loss orders" icon="shield">
    A stop loss closes the position before it reaches the liquidation price, preserving a portion of your collateral.
  </Card>

  <Card title="Reduce leverage" icon="sliders">
    Lower leverage means a larger price movement is required before liquidation is triggered.
  </Card>
</CardGroup>
