Every brokerage app shows you a profit number. You bought shares at $50, they are now at $65, your profit is $15 per share. Simple. Except that number is almost always incomplete, and the missing pieces are where real money hides.
What your brokerage does not show you
The headline profit number typically ignores several factors that significantly change your actual return.
Transaction costs. If you paid a commission (less common now, but still relevant for certain brokers and instruments), that comes out of your profit. On a $1,000 trade with a $5 commission each way, that is 1% gone before anything happens.
Taxes. If you held the stock for less than a year, your profit is taxed as ordinary income. In a high bracket, that could be 32-37%. Hold for over a year and you qualify for long-term capital gains, which maxes out at 20% for most people. The difference between a 37% and 15% tax rate on a $10,000 gain is $2,200. That is not a rounding error.
Opportunity cost. Your money was tied up for the holding period. If you made 30% in a stock over 3 years, that is roughly 9.1% annualized. If a broad index fund returned 10% annualized over the same period, your "winning" trade actually underperformed.
Dividend reinvestment. If you received dividends and reinvested them, your cost basis changes. Your per-share profit calculation needs to account for the additional shares purchased at various prices.
How to actually calculate stock profit
The basic formula is straightforward:
Profit = (Sell Price - Buy Price) * Shares - Fees
But for a complete picture, you need:
Net Profit = Gross Profit - Taxes - Fees
Annualized Return = ((End Value / Start Value) ^ (1 / Years)) - 1
Total Return = (End Value - Start Value + Dividends) / Start Value
The annualized return is the most important number because it lets you compare investments with different holding periods. A 50% gain over 5 years (8.4% annualized) is worse than a 30% gain over 2 years (14.0% annualized), even though the headline number looks better.
Dollar-cost averaging makes this harder
Most people do not buy all their shares at once. They buy $500 per month, or they add to positions at different prices. Now your cost basis is a weighted average:
Avg Cost Basis = Total Amount Invested / Total Shares Owned
If you bought 10 shares at $50 and 10 shares at $70, your average cost basis is $60, not $50 and not $70. Your profit per share is relative to $60.
This gets even more complex with partial sales. If you sell 10 of your 20 shares, which 10 did you sell? FIFO (first in, first out) means you sold the $50 shares, giving you a $20/share profit. LIFO (last in, first out) means you sold the $70 shares, giving you a $0/share profit. Specific identification lets you choose. The method matters for tax purposes.
A real example
You bought 50 shares of a stock at $120 in January 2024. You bought another 30 shares at $95 in June 2024. In March 2025, you sell all 80 shares at $140.
Cost basis: (50 * 120 + 30 * 95) / 80 = $110.63
Gross profit per share: $140 - $110.63 = $29.37
Total gross profit: $29.37 * 80 = $2,350
The first lot (50 shares held over 14 months) qualifies for long-term capital gains. The second lot (30 shares held 9 months) does not. At a 15% long-term rate and 24% short-term rate:
Tax on lot 1: (140 - 120) * 50 * 0.15 = $150
Tax on lot 2: (140 - 95) * 30 * 0.24 = $324
Total tax: $474. Net profit: $1,876. That is 80% of the gross profit, not 100%.
Making the math instant
I got tired of doing this on spreadsheets, so I built a stock profit calculator at zovo.one/free-tools/stock-profit-calculator that handles all of this: multiple purchase lots, fee deductions, tax estimates by holding period, and annualized return calculations. Plug in your trades and see what you actually made, not what the headline number says.
I'm Michael Lip. I build free developer tools at zovo.one. 500+ tools, all private, all free.
Top comments (0)