Guide

How a liquidation price is calculated on a perpetual

I think the easiest way to explain this is with Hyperliquid's rule (Functor's chain copies it exactly): a long is liquidated at (entry price − margin ÷ size) ÷ (1 − m), where m is the maintenance rate and works out as one over twice the biggest multiple that the market will let you use. So if you put $1,000 behind 0.2 BTC that you bought at $50,000 you'd be closed out at about $45,570, which is a fall of only 8.86% when I suspect most people trading at 10x would expect to have the whole 10% to play with.

The formula

The exchange won't wait until your margin is gone. It takes the position over as soon as your account value drops to the maintenance margin, and on Hyperliquid that's the notional value of the position divided by twice the market's top multiple. BTC goes up to 40x, so maintenance there is 1.25% of the position (ETH allows 25x, which gives 2%, and SOL allows 20x, which gives 2.5%). I use exactly these three limits on Functor's testnet, and the clearinghouse works maintenance out the same way, in integers, so every validator gets the same answer.

Take a single position with margin C, size q, entry price P₀ and maintenance rate m. You set the account value equal to the maintenance margin and solve for the price:

long:  C + q(P − P₀) = m·q·P  ⇒  P_liq = (P₀ − C/q) / (1 − m)
short: C + q(P₀ − P) = m·q·P  ⇒  P_liq = (P₀ + C/q) / (1 + m)

Hyperliquid's own documentation puts it as liq_price = price − side × margin_available / position_size / (1 − l × side), where margin_available means whatever margin you have above the maintenance requirement when you open. If you expand that out, you end up with the two lines above (I checked both against our worked example below).

A worked example

Let's say you deposit $1,000 and buy 0.2 BTC at $50,000, which gives you $10,000 of exposure and puts you at 10x. With m at 1.25% the sum looks like this:

P_liq = (50,000 − 1,000/0.2) / (1 − 0.0125) = 45,000 / 0.9875 = $45,569.62

So the price only needs to fall 8.86% before you lose the position. By the time it gets to $45,570 you've lost about $886 and you've still got roughly $114 sitting in the account, which happens to be exactly 1.25% of what the position is worth at that price. That leftover $114 is the whole reason the exchange steps in early, because it means you're closed out before your account can go negative and leave other traders to cover the loss for you.

If you'd shorted the same 0.2 BTC at $50,000 with the same $1,000 you'd be liquidated at $54,320.99, which is a rise of 8.64%. I found it slightly odd at first that a short gets a little less room than a long, but it makes sense once you notice that a short's maintenance requirement grows as the price climbs against it.

How far the price can move, by market

I worked these out from the two formulas above, on the assumption that your whole deposit is margin and that you're only holding the one position. I've left fees and funding out of the table, because they depend on how long you hold and how you trade, but I come back to both of them further down the page.

Market (top multiple)MaintenanceLong at 10xShort at 10xLong at the topShort at the top
BTC (40x)1.25%−8.86%+8.64%−1.27%+1.23%
ETH (25x)2.00%−8.16%+7.84%−2.04%+1.96%
SOL (20x)2.50%−7.69%+7.32%−2.56%+2.44%

What surprised me when I first ran these numbers is how thin the last column gets. At 40x, a BTC long only survives a fall of about 1.3%, and BTC moves that much within an ordinary hour more often than you might think, so personally I'd keep the top multiple for trades you plan to close within minutes and use something far lower for anything you want to hold overnight.

Liquidation price calculator

You can pick the market and the side, then put in your entry price, the size of the position in coins and how much margin you're putting up, and the answer updates as you type. It uses the testnet's limits and the first margin tier, which I'd expect to be all you need, because that tier covers every position under $150M on BTC, under $100M on ETH and under $70M on SOL. If the margin you enter is too small for the market's top multiple, it tells you the order would be refused instead of showing a price that could never happen.

You're at 10.0x. Liquidation price $45,570, a fall of 8.86%. At that price the account still holds $114 (the maintenance margin, 1.25% of the position).

What moves your liquidation price after you open

The formula tells you the price at the moment you open, but there are three things I'd keep an eye on because they shift it while you're holding the position.

The first one is funding. When a perpetual trades above the index, longs pay shorts every hour and that money comes straight out of your margin, so every dollar you pay moves your liquidation price a little closer to where the market is now. There's a funding section on the tech page that goes through what it actually costs in dollars, and I'd say it's worth reading before you hold a long for more than a day or two.

The second is the taker fee you pay when you open, since that comes out of your margin as well and makes the real figure a touch nearer than the one the formula gives you.

The third is cross margin. In a cross account all your positions share one balance, so if one of them is in profit the others' liquidation prices move further away and a loss on one pulls the rest closer. That's why I'd say the formula is exact for an isolated position or for a cross account holding a single position, and only a rough guide otherwise.

Also, really big positions move up into a higher margin tier where the top multiple is lower. Hyperliquid adds a deduction at that point so that maintenance doesn't suddenly jump as the size grows, and Functor's chain does exactly the same thing.

What happens at the liquidation price on Functor

First the chain tries to close the whole position on the order book with market orders. If the book can't take it, the position goes to the liquidity vault, and auto-deleveraging only comes in as a last resort when the vault can't take it either (I've written a separate guide on who gets auto-deleveraged). After a book liquidation, anything left above the maintenance requirement stays yours. The tech page has the full order, and you'll find each market's limits in the API docs.

If you'd like to see it for yourself with mock funds, grab some test USDC from the faucet, open a small position at a multiple in the app, and compare the liquidation price it shows with the one on this page.

Questions

Why is the liquidation price closer than one over the multiple?

It's because you're closed out when your account value reaches the maintenance margin, not when it reaches zero. At 10x on BTC that cushion is 1.25% of the position, so I'd think of the 8.86% as your real room and the 10% as the number you'd get if the exchange let you lose everything, which it won't.

Does adding margin move the liquidation price?

Yes, and it's the most direct way to buy yourself room. More margin (C in the formula) pushes a long's liquidation price down and a short's up, so if you added $500 to the $1,000 in the example, the long's liquidation price would drop from $45,570 to $43,038, which I worked out with the same formula as before.

Is the maintenance margin the same on every exchange?

I'm afraid not. Hyperliquid (and Functor, since it follows Hyperliquid) uses half the initial margin at the market's top multiple, but other venues set their own tables and some of them change by size much sooner, so I'd always check the venue's own margin page before you trust a liquidation price from anywhere else, including this one.

Sources

I took the maintenance rule, the liquidation price formula and the order of what happens at liquidation (the book first, then the backstop vault) from Hyperliquid's page on liquidations. The maintenance rate and the deduction for bigger positions come from their page on margin tiers, and the testnet's markets with the top multiple for each one are listed in our own API docs, which are generated from the node's code so they can't drift away from what the chain actually does.

Every figure on this page comes from those three pages and the two formulas, and I ran each example through the calculator above before publishing it. If you spot a number that doesn't match what you see in the app, I'd really like to hear about it on Telegram, since that would mean either the page or the chain has a bug that we'd want to fix quickly.