Quick answer
How do you calculate the number of shares to sell?
Choose Find shares to sell, enter the expected Sell price per share, select Net proceeds, Net profit or loss, or Shares remaining, and enter the target. The result is the smallest eligible quantity that follows the selected fractional- or whole-share policy.
For a simple Net proceeds target with a flat fee and no dividend, divide the target plus the Sell commission by the Sell price per share.

- 1
Shares to sell. The exact fractional-share result is 41.75 shares.
- 2
Target reached. Selling that quantity at the entered price produces $5,000.00 in Net proceeds.
- 3
Profit at that quantity. The same sale assigns proportional cost basis and produces $820.82 in realized profit.
Calculator walkthrough
Set the price, target, and share policy
Open the stock profit calculator and start with the value you already know: the expected selling price.
Find shares to sell
Select the inverse workflow for a known sell price and target amount.
Choose the outcome
Target Net proceeds, Net profit or loss, or the number of Shares remaining.
Choose share precision
Use an exact fractional result, whole shares that meet the target, or the closest whole-share result.
Select the lots
For multiple purchases, use FIFO, LIFO, or explicit Specific-lot limits.
Read the sale plan
Check shares sold, proceeds, realized profit, shares left, and remaining cost basis together.
Review FIFO and LIFO
Compare both methods without rebuilding the position when more than one lot remains.
Worked proceeds example
Sell 41.75 shares for $5,000 in net proceeds
Assume an expected sell price of $120 per share, a $10 flat Sell commission, no dividend, and a $5,000 Net proceeds target.
The exact calculation is ($5,000 + $10) / $120 = 41.75 shares. Selling 41.75 shares produces $5,010 in Gross sale value and $5,000 in Net proceeds after the fee.
Exact and whole-share result
41.75 exact shares or 42 whole shares
A meet-target whole-share policy rounds up to 42 shares. That sale produces $5,030 in Net proceeds, which is $30 above the target.
- Sell price
- $120.00
- Target net proceeds
- $5,000.00
- Exact shares
- 41.75
- Meet-target whole shares
- 42
- Whole-share proceeds
- $5,030.00
| Policy | Shares sold | Net proceeds | Difference from target |
|---|---|---|---|
| Exact fractional | 41.75 | $5,000.00 | $0.00 |
| Whole shares: meet target | 42 | $5,030.00 | +$30.00 |
| Whole shares: closest | 42 | $5,030.00 | +$30.00 |
Cost-basis-aware target
A profit target depends on the shares selected for sale
Net profit is not determined by sale proceeds alone. The calculator must also assign the correct purchase value and Buy commission to the shares being sold.
For one purchase of 100 shares at $100 with a $10 Buy commission, each share carries $100.10 of basis. At a $120 Sell price and a $10 flat Sell commission, the exact quantity for $1,000 of Net profit is ($1,000 + $10) / ($120 - $100.10) = 50.7538 shares. A meet-target whole-share result is 51 shares and produces $1,004.90 of profit.
With multiple lots, the contribution per additional share changes when one lot is exhausted. The solver therefore allocates shares in order instead of dividing the target by a single position-wide average.
One purchase
Each sold share receives the same proportional share of purchase value and Buy commission.
FIFO
The oldest remaining purchase entries supply shares first, so their basis drives the target calculation.
LIFO
The newest remaining purchase entries supply shares first and can produce a different realized profit.
Specific lots
The calculator follows the explicit per-lot limits and purchase order entered by the user; it does not infer a preferred tax lot.
| Allocation | First lot used | Exact shares needed | Why |
|---|---|---|---|
| FIFO | 50 shares at $80 | 20.24 | Lower basis contributes about $49.90 per share after allocated fees |
| LIFO | 50 shares at $120 | 60.32 | The first 50 shares contribute less profit before the solver reaches the $80 lot |
For the underlying allocation rules, read FIFO vs LIFO Stock Sale Profit and the partial-sale guide.
Validation
When a shares-to-sell target cannot be reached
A useful solver must reject an impossible target instead of suggesting more shares than the position contains.
Not enough shares
The maximum eligible sale cannot produce the requested proceeds or profit at the entered price.
Specific-lot limit
The entered lot limits provide fewer eligible shares than the target requires.
Whole-share gap
A closest-result policy can miss the target because no whole number of shares reproduces an exact fractional answer.
Fee effect
A flat Sell commission has a larger proportional effect on a small sale, while a percentage fee scales with Gross sale value.
Methodology and references
Treat the result as a sale plan, not an execution promise
The calculator uses the price, fees, dividends, shares, and lots entered by the user. A modeled selling price does not guarantee an order will execute at that price.
Ready to calculate how many shares to sell?
Use the Stock Profit Calculator