What is the Scale In / Scale Out Calculator?
Scaling in and scaling out are the two halves of managing a position over its life. You scale in by buying across several lots at different prices — blending them into one quantity-weighted average entry — and you scale out by selling part of the position to lock in profit (or cap a loss) while keeping the rest open. This calculator does both: it computes your blended entry, the realized P&L on the shares you sell, the shares and cost basis you still hold, and — if you supply a current price — the unrealized P&L on what remains.
It builds on the buy-side math of the Average Price Calculator and adds the partial-exit leg that a pure cost-basis tool doesn't model.
How it works
avgEntry = Σ(priceᵢ × qtyᵢ) / Σ(qtyᵢ); realizedPnL = sellQty × (sellPrice − avgEntry)
The blended average entry is quantity-weighted across your buy lots. Realized P&L values each sold share at that average, so selling above the average is a profit and below it a loss — the sign is always preserved. Remaining shares = total bought − shares sold (never below zero), and remaining cost basis = remaining shares × the unchanged average entry.
The key insight
Worked example
Two buys of 100 shares at $10 and $12 blend to an $11 average. Selling 100 at $15 locks in $400, leaving 100 shares open:
| Step | Value |
|---|---|
| Buy lot 1 | 100 @ $10 |
| Buy lot 2 | 100 @ $12 |
| Average entry | $11 |
| Scale out | 100 @ $15 |
| Realized P&L | $400 |
| Remaining shares | 100 |
| Remaining cost basis | $1100 |
| Unrealized P&L (at $14) | $300 |
How the sell price changes realized P&L
With the same $23 blended entry, the scale-out flips from profit to loss as the sell price falls through the average. This table is computed by the same engine:
| Sell price | Shares sold | Avg entry | Realized P&L |
|---|---|---|---|
| $30 | 80 | $23 | $560 |
| $25 | 80 | $23 | $160 |
| $23 | 80 | $23 | $0 |
| $20 | 80 | $23 | $-240 |
Interpreting your results
A positive realized P&L is profit you have banked; a negative one is a loss you have crystallised to reduce exposure. Remaining cost basis is the capital still at risk in the open position — useful for both tax planning and re-sizing. Pair this with the Position Size Calculator to check the remaining position still fits your risk budget, and the Trading Expectancy Calculator to judge whether your scale-out rules add or subtract edge over many trades.
Professional tips
- Scale out in planned tranches — re-run the tool with the residual position each time.
- Remember the average entry is fixed by your buys; selling never moves it.
- Compare realized P&L across candidate sell prices before you place the order.
- Add fees and taxes yourself — the tool is deliberately fee-free and pre-tax.
Common mistakes
- Assuming a partial sale lowers (or raises) the average entry on the shares you keep.
- Treating realized P&L here as your taxable capital gain — the lot method differs.
- Entering a sell quantity larger than you hold (the tool caps it and warns you).
- Ignoring that scaling out at a loss is sometimes the right risk decision.
Assumptions and limitations
- Realized P&L is against the blended average — not FIFO/LIFO lot accounting.
- A single scale-out event; model multiple exits by re-running with the residual position.
- Long positions only; short-selling and corporate actions are not modelled.
- Fee-free and pre-tax — brokerage, STT/GST and capital-gains taxes are excluded.
Frequently asked questions
What does 'scale in' mean in trading?+
Scaling in means building a position incrementally across multiple buy orders at different prices instead of buying all shares at once. By spreading purchases, a trader blends their average entry price — buying more at lower prices lowers the blended average, and the position only needs the market to recover to that average (not to the first purchase price) to break even. This calculator computes the quantity-weighted average entry across all buy lots.
What does 'scale out' mean in trading?+
Scaling out means selling a portion of your position to lock in realized profit (or cap a loss) while leaving remaining shares open to capture further price movement. For example, if you hold 200 shares at an average entry of $11 and the price rises to $15, selling 100 shares locks in $400 of realized P&L while the remaining 100 shares stay in the trade.
Does selling some shares change my average entry price?+
No. A partial sale (scale out) does not change your average entry (cost basis per share) for the remaining position. The average entry per share remains exactly what it was before the sale. Only the total remaining cost basis shrinks, because you now hold fewer shares. This is a key concept: avgEntry is a buy-side calculation and is unaffected by sell events.
How is realized P&L calculated when scaling out?+
Realized P&L = sellQty × (sellPrice − avgEntry). Each share sold is assumed to have cost you avgEntry (your blended average), and the profit or loss per share is the difference between the sell price and that average. The result can be positive (you sold above your average — a profit) or negative (you sold below your average — a realized loss). The sign is always preserved.
What is remaining cost basis and why does it matter?+
Remaining cost basis = remainingShares × avgEntry. It is the total capital still at risk in your open position after the scale-out. It matters for tax purposes (capital gains will be computed against this cost basis when you eventually close the full position) and for position-risk sizing (it tells you how much money is committed to the remaining trade).
Why would a trader scale out at a loss?+
Sometimes a position moves against the trader before they can exit fully. Scaling out at a loss reduces position size and total exposure, limiting further downside if the stock continues to fall. The realized P&L will be negative in this case, but it frees capital and lowers the risk of a larger loss if the trade does not recover. This calculator correctly preserves the negative sign on realizedPnL.
What is the difference between this calculator and the average price calculator?+
The average price calculator computes the blended cost basis across buy lots and marks unrealized P&L against a current price — it models a fully open position with no sales. The scale-in/out calculator adds a partial exit (scale-out) leg: it computes realized P&L on the sold shares, tracks the remaining open position, and optionally marks unrealized P&L on what remains. Use the average-price calculator for pure cost-basis questions; use this one when you also need to model a partial exit.
What is the difference between scale-in/out and pyramiding?+
Pyramiding adds to a winning position in progressively smaller tranches as the price moves in your favor — it focuses on building into a trend and managing the total risk of adding to a winner. Scale-in/out is a more general concept: scaling in may happen at lower prices (averaging down) or at higher prices (building a position), and scaling out is the partial exit that this calculator specifically models. Pyramiding focuses on tranche sizing and a total-risk stop; this calculator focuses on realized P&L, remaining shares, and remaining cost basis.
How many buy lots can I enter?+
Up to 30 buy lots. You can represent any number of historical purchases by combining older lots manually: compute their weighted average price and enter it as a single lot with the combined quantity.
Does this calculator work for ETFs, mutual funds, or crypto?+
Yes. The scale-in/out math is identical for any asset where you make multiple purchases at different prices and later sell a portion. For mutual funds, use the NAV as the price and units as the quantity. For crypto, use the coin price and coin quantity. The calculator is currency-agnostic and works for USD, INR, EUR, GBP, and JPY denominated positions.
Is realized P&L the same as taxable capital gain?+
Not exactly. Realized P&L here is the fee-free, pre-tax gain or loss computed against your average entry. Taxable capital gain depends on the actual proceeds net of transaction costs, the specific lot method your tax authority requires (FIFO, average cost, or specific identification), and applicable rates (short-term vs long-term holding period). Consult a tax adviser or your broker's tax statement for the correct taxable amount.
What happens if I sell more shares than I bought?+
The calculator clamps sellQty to totalBought. It does not model short-selling. If you enter a sellQty larger than totalBought, the remaining shares are set to zero and realizedPnL is computed on the full totalBought position. A warning appears in the UI so you can correct the input.
Disclaimer
Sources
- Fidelity — What is cost basis: average cost divides total cost by shares; FIFO for stock, average cost for mutual fund shares
- IRS Publication 550 — Investment Income and Expenses: cost basis and average-basis method for shares bought at different prices
- Investopedia — Scale Out: selling portions of a position to lock in partial profits while keeping exposure; each sale is measured against the average cost basis
- FINRA — Concentration Risk: cost basis and remaining exposure after partial exits are essential to managing portfolio risk
Formula and data last reviewed by the TheCalculatorVault team on 4 July 2026. Figures are for general information, not professional advice.
Related calculators
Calculate your quantity-weighted average price per share across multiple buy lots. Add each purchase (price and quantity) to get your blended cost basis, total investment, fee-free break-even and unrealized P&L — the right way to model averaging down a stock, ETF or fund position.
PyramidingCalculate your blended average entry, total capital, total risk and constant-risk stop when scaling into a winning position across multiple tranches.
Position SizeWork out exactly how many shares to buy or short on a trade so a stopped-out loss stays within 1–2% of your account. Enter account size, risk %, entry and stop-loss to get the share count, max loss, capital required and dollar risk — for a long or short, in any currency.