How is the liquidation price calculated?

Hyperliquid publishes the exact formula, and it has four inputs. Here it is term by term, with a worked example and the reasons an estimate can differ from the price that triggers.

Last updated: Oct 5, 2026

The short answer

Hyperliquid computes it as liq_price = price - side * margin_available / position_size / (1 - l * side), where side is 1 for a long and -1 for a short, l is one over the maintenance leverage, and margin_available is the account value less the maintenance margin required for a cross position, or the isolated margin less that same requirement for an isolated one. The maintenance margin is half the initial margin at the asset's maximum leverage, which puts it between 1.25% of the notional on a 40x asset and 16.7% on a 3x one.

In words: take the price the position is valued at, and move it by the margin you can still lose, spread over the size, with a small correction because the maintenance requirement itself shrinks as the price goes against you.

The four inputs

  • price: the mark price the position is valued at.
  • position_size: the size in units of the asset, not in dollars.
  • side: 1 for a long, -1 for a short.
  • margin_available: the account value minus the maintenance margin required, for a cross position; the isolated margin minus that same requirement, for an isolated one.
  • l: one over the maintenance leverage, which is twice the asset's maximum leverage. On an asset with margin tiers, the maintenance leverage is the one of the tier the position's value falls in at the liquidation price.

A worked example

Take a market whose maximum leverage is 20. The initial margin at that leverage is 5% of the notional, so the maintenance margin is 2.5%, the maintenance leverage is 40, and l is 0.025.

Open a long of 0.1 units at a mark price of 100,000, isolated, at ten times leverage.

StepFigure
Notional0.1 x 100,000 = 10,000
Isolated margin, at 10x10,000 / 10 = 1,000
Maintenance margin required, 2.5%0.025 x 10,000 = 250
Margin available1,000 - 250 = 750
Liquidation price, long100,000 - 750 / 0.1 / 0.975 = 92,307.69

The long is liquidated at 92,307.69, about 7.7% under the entry. The same position as a short, with side at -1, gives 100,000 + 750 / 0.1 / 1.025, so 107,317.07, about 7.3% over the entry. That asymmetry is the correction term, not a fee.

Held cross instead, in an account whose value is 1,000 with no other position, the figures are identical. With 2,000 of account value, margin_available becomes 1,750 and the liquidation price falls to 82,051.28. This is what the documentation means when it says the liquidation price of a cross position does not depend on the leverage set: only the collateral standing behind it moves the price.

Why an estimate is not the trigger

  • Before you open, the estimate shown depends on the liquidity on the book at that instant, and the documentation says it may be inaccurate.
  • Once the position is open, funding payments move your account value every hour, and so does the unrealized result of your other cross positions.
  • Short of margin, the estimate assumes the account is topped up to the initial margin requirement.
  • Margin tiers make the maintenance leverage depend on the position's value at the liquidation price, so a large position is judged on a stricter tier than a small one.
  • Fees and funding are nowhere in the formula. They leave the account anyway, and in doing so they move the price that triggers.
Watch the mark price

Liquidations use the mark price, which combines outside exchange prices with Hyperliquid's own book state. On a volatile day it can sit well away from the last trade, so a liquidation can trigger at a price your chart never printed. The documentation recommends following the exact formula rather than a level on a chart.

What this site computes, and what it leaves out

The ladder calculator places the steps of a position built by steps and reports the room left before liquidation with the whole ladder filled, on the same arithmetic as the agent's code. It does not count the fees, the funding over the hold or the slippage; the position cost calculator counts the first two.

The agent's own estimate follows the formula above, with the asset's maintenance leverage read from the venue. It remains an estimate, which is why the pilot sizes a position so that, with every step filled, the price may still move 100% against it before any liquidation. The margin is the point, not the last decimal.