Liquidation price math, step by step
Hyperliquid's liquidation formula with worked long and short examples you can check by hand, plus a five-line script.

Every leveraged position has a price where it stops being yours. Knowing that number before you open the trade, and knowing where it comes from, is the difference between a stop you chose and one the exchange chose for you.
Three numbers you need
Initial margin is what you put up to open the position.
initial margin = notional / leverageA $100,000 position at 10x needs $10,000.
Maintenance margin is the minimum equity the position must keep. On Hyperliquid it is half the initial margin at the asset's maximum leverage. If an asset allows up to 40x, initial margin at max leverage is 1/40 = 2.5% of notional, so maintenance margin is 1.25%.
maintenance margin rate l = 1 / (2 × max leverage)| Max leverage | Maintenance rate |
|---|---|
| 40x | 1.25% |
| 20x | 2.50% |
| 10x | 5.00% |
| 3x | 16.7% |
Note that maintenance depends on the asset's max leverage, not the leverage you picked. Using 5x on a 40x asset still gives a 1.25% maintenance rate.
Margin available is the cushion between what you have and what you must keep.
- Isolated:
isolated margin − maintenance margin required - Cross:
account value − maintenance margin required
The formula
Hyperliquid's liquidation price is:
liq price = entry − side × margin available / size / (1 − l × side)where side is 1 for a long and −1 for a short, size is the position size in coins, and l is the maintenance rate above.
The (1 − l × side) term is there because maintenance margin is measured at the liquidation price, not at entry. As price moves against you, the maintenance requirement moves too.
Worked example: isolated long
You go long 1 BTC at $100,000 with 10x isolated leverage. BTC's max leverage is 40x, so l = 1/80 = 0.0125.
isolated margin = 100,000 / 10 = 10,000
maintenance required = 100,000 × 0.0125 = 1,250
margin available = 10,000 − 1,250 = 8,750
liq = 100,000 − 1 × 8,750 / 1 / (1 − 0.0125)
= 100,000 − 8,860.76
= 91,139.24Check it from first principles. At price P your equity is 10,000 + (P − 100,000), and maintenance is 0.0125 × P. They are equal when P − 90,000 = 0.0125P, so P = 90,000 / 0.9875 = 91,139.24. Same answer.
So a 10x long on a 40x asset liquidates about 8.86% below entry, a bit less than the 10% you might guess from "10x".
Worked example: isolated short
Same numbers, but short.
liq = 100,000 − (−1) × 8,750 / 1 / (1 + 0.0125)
= 100,000 + 8,641.98
= 108,641.98Check: equity is 10,000 − (P − 100,000) = 110,000 − P, maintenance is 0.0125P, equal at P = 110,000 / 1.0125 = 108,641.98.
The short has about 8.64% of room. Longs and shorts are not perfectly symmetric because maintenance grows with price.
Cross margin
On cross, margin available is your whole account value minus the maintenance required for all positions. That means:
- Free collateral in your account pushes every cross position's liquidation price further away.
- A losing position elsewhere in the account pulls it closer.
- Your liquidation price moves even when the market you are looking at does not.
This is the main reason a cross position's liquidation price changes while you watch it.
A script you can run
def liq_price(entry, size, margin, max_lev, side):
l = 1 / (2 * max_lev)
available = margin - abs(size) * entry * l
return entry - side * available / abs(size) / (1 - l * side)
liq_price(100_000, 1, 10_000, 40, 1) # 91139.24
liq_price(100_000, 1, 10_000, 40, -1) # 108641.98What moves it after you open
- Funding. Funding paid comes out of margin, so on isolated positions it slowly walks your liquidation price toward the market. Funding received does the opposite.
- Adding or removing margin on an isolated position.
- Other positions on cross, as above.
- Margin tiers. For large positions on some assets, Hyperliquid uses tiered margin with higher maintenance requirements. The simple formula above is for a single tier.
Liquidation is triggered on the mark price, not the last trade, which protects you from a single wick on one venue.
Use it as a ceiling, not a stop
Your liquidation price is the worst case, not a plan. A good habit is to place your stop well before it, sized so the loss at the stop fits your risk budget. The position sizing note(/research/position-sizing-risk-percent) shows how.
The Leverra terminal shows Hyperliquid's own liquidation price for every open position, and the order ticket shows your margin before you sign. Nothing here is financial advice.
Sources
- Hyperliquid docs: Liquidations
- Hyperliquid docs: Margining
- Hyperliquid docs: Margin tiers
- Hyperliquid docs: Funding
Research note, for information only. Not financial advice. Leverra is a permissionless on-chain prop firm for perps: capital stays with partner pools, and Leverra never holds it or guarantees payouts.


