Stock Profit & Loss Calculator

Calculate your stock trading profit or loss including commissions and dividends. Enter buy and sell prices to see your total P&L and return percentage.

SC
Written by Sarah Chen, CFP
Certified Financial Planner
JW
Fact-checked by Dr. James Wilson, PhD
Options Strategy Researcher
Profit & LossFact-Checked

Input Values

$

Purchase price per share.

$

Sale price per share (or current price for unrealized P&L).

Total shares bought.

$

Total dividends received during holding period.

$

Commission paid to purchase shares.

$

Commission paid to sell shares.

Results

Total Profit / Loss
$0.00
Return (%)
13.60%
Capital Gain / Loss$0.00
Total Amount Invested$0.00
Total Sale Proceeds$0.00
Results update automatically as you change input values.

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.

Stock Profit Formula
P&L = (Sell Price - Buy Price) × Shares + Dividends - Commissions
Where:
Sell Price = Price per share at sale
Buy Price = Price per share at purchase
Shares = Number of shares
Dividends = Total dividends received
Commissions = Total buy + sell commissions
Total Return Percentage
Return (%) = (P&L / Total Invested) × 100
Where:
P&L = Total profit or loss in dollars
Total Invested = Buy Price × Shares + Buy Commission
Stock P&L Calculation Example
Given
Buy Price
$125.00
Sell Price
$142.00
Shares
100
Dividends
$0
Commissions
$0
Calculation Steps
  1. 1Total Invested = $125 × 100 = $12,500
  2. 2Total Proceeds = $142 × 100 = $14,200
  3. 3Capital Gain = ($142 - $125) × 100 = $1,700
  4. 4Total P&L = $1,700 + $0 - $0 = $1,700
  5. 5Return = $1,700 / $12,500 = 13.6%
Result
Buying 100 shares at $125 and selling at $142 generates a $1,700 profit, a 13.6% return on the $12,500 investment.

Understanding Realized vs. Unrealized P&L

Realized vs. Unrealized Profit and Loss
TypeDefinitionTax ImpactWhen It Matters
Realized P&LProfit/loss on closed positions (shares sold)Taxable in the year of saleTax planning, actual returns
Unrealized P&LPaper gain/loss on open positions (shares still held)Not taxable until soldPortfolio value, margin requirements
Total P&LRealized + Unrealized combinedOnly realized portion is taxedOverall portfolio performance

Common Mistakes in Stock P&L Calculation

  1. Forgetting commissions and fees: Even with commission-free brokers, SEC fees and exchange fees can apply to large trades.
  2. Ignoring dividends: Dividends are part of your total return. A stock that drops 5% but paid 6% in dividends still made you 1%.
  3. Not tracking cost basis properly: If you bought shares at different prices, your cost basis is the weighted average of all purchase prices.
  4. Overlooking wash sale rules: Selling at a loss and rebuying within 30 days disallows the tax deduction on the loss.
  5. 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

1
Record Each Purchase
Track the date, number of shares, and price for every buy transaction. This creates your lot-by-lot cost basis record.
2
Calculate Weighted Average Cost
Weighted Average = Total Cost / Total Shares. If you bought 50 at $120 and 50 at $130: ($6,000 + $6,500) / 100 = $125 per share.
3
Choose a Cost Basis Method
You can use average cost, FIFO (first in, first out), or specific lot identification. Each method can produce different P&L and tax outcomes. FIFO is the default for stocks.
4
Calculate P&L per Lot or Average
Using the average cost: P&L = (Sell Price - $125) × shares sold. Using FIFO: sell the $120 shares first, then the $130 shares.

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.

i
Tax-Loss Harvesting

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.

Frequently Asked Questions

Profit = (Sell Price - Buy Price) × Shares - Commissions + Dividends. For example: bought 100 shares at $125, sold at $142. Profit = ($142 - $125) × 100 = $1,700. With commission-free trading and no dividends, total profit is $1,700 (13.6% return).

Sources & References

  • U.S. Securities and Exchange Commission (SEC) - Investor Education
  • Options Clearing Corporation (OCC) - Options Education
  • Chicago Board Options Exchange (CBOE) - Options Strategies
  • Hull, J.C. "Options, Futures, and Other Derivatives" (11th Edition, 2021)

Embed This Calculator on Your Website

Free to use with attribution

Copy the code below to add this calculator to your website, blog, or article. A link back to CoveredCallCalculator.net is included automatically.

<iframe src="https://coveredcallcalculator.net/embed/stock-profit-loss-calculator" width="100%" height="500" frameborder="0" title="Stock Profit & Loss Calculator" style="border:1px solid #e2e8f0;border-radius:12px;max-width:600px;"></iframe>
<p style="font-size:12px;color:#64748b;margin-top:8px;">Calculator by <a href="https://coveredcallcalculator.net" target="_blank" rel="noopener">CoveredCallCalculator.net</a></p>