How to Calculate Stock Profit and Loss
Calculating stock profit and loss is straightforward but requires accounting for all costs. The basic calculation is the difference between your sell price and buy price, multiplied by the number of shares. However, a complete P&L should also include commissions, fees, and any dividends received during the holding period.
Whether you are a day trader making dozens of trades per week or a long-term investor evaluating your portfolio performance, accurately tracking your stock P&L is essential for making informed decisions about your strategy and portfolio allocation.
- 1Total Invested = $125 × 100 = $12,500
- 2Total Proceeds = $142 × 100 = $14,200
- 3Capital Gain = ($142 - $125) × 100 = $1,700
- 4Total P&L = $1,700 + $0 - $0 = $1,700
- 5Return = $1,700 / $12,500 = 13.6%
Understanding Realized vs. Unrealized P&L
| Type | Definition | Tax Impact | When It Matters |
|---|---|---|---|
| Realized P&L | Profit/loss on closed positions (shares sold) | Taxable in the year of sale | Tax planning, actual returns |
| Unrealized P&L | Paper gain/loss on open positions (shares still held) | Not taxable until sold | Portfolio value, margin requirements |
| Total P&L | Realized + Unrealized combined | Only realized portion is taxed | Overall portfolio performance |
Common Mistakes in Stock P&L Calculation
- Forgetting commissions and fees: Even with commission-free brokers, SEC fees and exchange fees can apply to large trades.
- Ignoring dividends: Dividends are part of your total return. A stock that drops 5% but paid 6% in dividends still made you 1%.
- Not tracking cost basis properly: If you bought shares at different prices, your cost basis is the weighted average of all purchase prices.
- Overlooking wash sale rules: Selling at a loss and rebuying within 30 days disallows the tax deduction on the loss.
- Comparing raw returns without time adjustment: A 10% return in 1 month is much better than 10% in 2 years. Always annualize for comparison.
Stock P&L with Multiple Purchases
When you buy shares at different prices (dollar-cost averaging or adding to a position), your cost basis is the weighted average price. For example, if you buy 50 shares at $120 and 50 shares at $130, your average cost basis is $125 per share. Your P&L is then calculated against this average cost.
Calculating P&L with Multiple Lots
Tax Implications of Stock Profits and Losses
In the US, stock profits are subject to capital gains tax. Short-term gains (held under 1 year) are taxed at ordinary income rates up to 37%. Long-term gains (held over 1 year) receive preferential rates of 0%, 15%, or 20% depending on your income. Capital losses can offset capital gains dollar for dollar, and up to $3,000 in net losses can offset ordinary income annually.
Strategically selling losing positions to offset gains can significantly reduce your tax bill. Sell losers before year-end to realize losses, then use those losses to offset realized gains. Be careful of the wash sale rule: do not rebuy the same stock within 30 days.