How to Calculate Stock Profit: Formulas, Tax & Complete Guide
Learn how to calculate stock profit with the exact formula, capital gains tax rates (short-term vs long-term), commission impact, break-even analysis, ROI calculation, and Excel methods. Includes worked examples.
The Stock Profit Formula
Calculating stock profit is straightforward once you know the formula. At its core, you are comparing what you received from selling shares to what you paid to buy them, minus any costs along the way.
Basic formula:
Net Profit = (Sell Price x Shares Sold - Sell Commission) - (Buy Price x Shares Sold + Buy Commission)
This single equation captures the three components that determine your actual profit: the price difference between buying and selling, the number of shares involved, and the transaction costs on both sides.
Let us break it into pieces:
- Gross Profit = (Sell Price - Buy Price) x Shares Sold
- Total Investment = Buy Price x Shares + Buy Commission
- Total Sale Proceeds = Sell Price x Shares - Sell Commission
- Net Profit = Total Sale Proceeds - Total Investment
Gross profit ignores commissions entirely. Net profit is what actually hits your brokerage account. After-tax profit, which we cover below, is what you get to keep.
Worked Example: Basic Stock Profit Calculation
You buy 200 shares of XYZ at $45 per share. Six months later, you sell all 200 shares at $58 per share. Your broker charges $9.99 per trade (flat fee).
Step 1: Calculate Total Investment
- Share cost: 200 x $45 = $9,000
- Buy commission: $9.99
- Total Investment: $9,009.99
Step 2: Calculate Total Sale Proceeds
- Sale revenue: 200 x $58 = $11,600
- Sell commission: $9.99
- Total Sale: $11,590.01
Step 3: Calculate Net Profit
- Net Profit: $11,590.01 - $9,009.99 = $2,580.02
- Gross Profit (ignoring commissions): $2,600.00
- Commissions cost you $19.98 on this trade
Use our Stock Profit Calculator to run this calculation instantly with any values.
Gross Profit vs Net Profit vs After-Tax Profit
These three numbers represent progressively more realistic views of what you earn from a trade:
| Metric | What It Includes | Formula |
|---|---|---|
| Gross Profit | Price difference only | (Sell - Buy) x Shares |
| Net Profit | + Commissions | Gross Profit - All Commissions |
| After-Tax Profit | + Capital gains tax | Net Profit - Tax on Gains |
Most beginners focus only on gross profit. Experienced investors always calculate after-tax profit because that is the money they actually keep.
How Brokerage Commissions Affect Your Profit
Commissions come in two common structures:
Percentage-Based Commissions
The broker charges a percentage of the total trade value. Common in international markets and for large institutional trades.
Formula: Commission = Trade Value x Rate / 100
Example: Buying $10,000 worth of stock at 0.1% commission = $10 commission.
Flat-Fee Commissions
The broker charges a fixed dollar amount per trade, regardless of trade size. This was the standard model before the zero-commission revolution.
Example: $4.95 per trade whether you buy $500 or $50,000 worth of stock.
Zero-Commission Trading
Most major US brokers (Fidelity, Charles Schwab, Robinhood, Webull) now offer zero-commission stock trades. However, zero commission does not mean zero cost. You still pay:
- SEC fees: A tiny fee on sell transactions (currently $27.80 per million dollars)
- TAF fees: $0.000166 per share on sales
- Bid-ask spread: The difference between the buying and selling price of a stock, which is an implicit cost
For most retail investors with major brokers, these hidden costs are negligible. But for day traders making dozens of trades daily, they add up.
Commission Impact on Small Trades
Commissions hurt small trades disproportionately. If you pay $10 per trade on a $500 investment, your round-trip cost is $20 — that is 4% of your investment eaten by fees before the stock even moves. On a $50,000 trade, the same $20 is just 0.04%.
This is why commission-free trading has been transformative for small investors. Use our Stock Profit Calculator to see exactly how commissions affect your specific trade.
Capital Gains Tax on Stock Profits
This is where many investors make costly mistakes. The US tax code treats stock profits differently based on how long you held the shares.
Short-Term Capital Gains (Held 1 Year or Less)
If you sell a stock within one year of buying it, any profit is taxed as ordinary income. That means it is taxed at the same rate as your salary, wages, and other income. For 2026, the federal rates range from 10% to 37% depending on your total taxable income.
| Tax Rate | Single Filer Income | Married Filing Jointly |
|---|---|---|
| 10% | Up to $11,925 | Up to $23,850 |
| 12% | $11,926 - $48,475 | $23,851 - $96,950 |
| 22% | $48,476 - $103,350 | $96,951 - $206,700 |
| 24% | $103,351 - $197,300 | $206,701 - $394,600 |
| 32% | $197,301 - $250,525 | $394,601 - $501,050 |
| 35% | $250,526 - $626,350 | $501,051 - $751,600 |
| 37% | Over $626,350 | Over $751,600 |
A day trader in the 32% bracket who makes $10,000 in short-term gains owes $3,200 in federal tax on those gains alone, plus any applicable state income tax.
Long-Term Capital Gains (Held More Than 1 Year)
If you hold a stock for more than one year before selling, you qualify for long-term capital gains rates, which are significantly lower:
| Tax Rate | Single Filer Income | Married Filing Jointly |
|---|---|---|
| 0% | Up to $48,350 | Up to $96,700 |
| 15% | $48,351 - $533,400 | $96,701 - $600,050 |
| 20% | Over $533,400 | Over $600,050 |
The difference is dramatic. A single filer earning $100,000 would pay 22-24% on short-term gains but only 15% on long-term gains. On a $10,000 profit, that is $2,200-$2,400 vs $1,500 — a difference of $700-$900.
The Net Investment Income Tax (NIIT)
High earners face an additional 3.8% tax on net investment income. This applies to single filers with modified adjusted gross income (MAGI) over $200,000 or married couples over $250,000. The NIIT is on top of the regular capital gains rate, so a high-earning investor could pay 23.8% on long-term gains (20% + 3.8%).
Tax-Loss Harvesting
If you sell stocks at a loss, those losses can offset your capital gains dollar for dollar. If your losses exceed your gains, you can deduct up to $3,000 of net capital losses against ordinary income per year, with the remainder carried forward to future years.
Example: You realize $5,000 in gains and $3,000 in losses in the same year. You only owe tax on $2,000 of net gains. This strategy, called tax-loss harvesting, is a legitimate and widely used tax planning tool.
After-Tax Profit Calculation
After-Tax Profit = Net Profit - (Net Profit x Tax Rate)
Note: Tax applies only when net profit is positive. If you have a net loss, no capital gains tax is owed.
Example: $5,000 net profit, held 2 years (long-term), 15% bracket:
- Tax: $5,000 x 0.15 = $750
- After-tax profit: $5,000 - $750 = $4,250
Break-Even Price: The Price You Need to Profit
Your break-even price is the minimum sell price at which you neither make nor lose money after all costs. Knowing this number before you trade helps you set realistic targets.
Break-Even Formula
With flat sell commission:
Break-Even = (Total Investment + Sell Commission) / Shares Sold
With percentage sell commission:
Break-Even = Total Investment / (Shares x (1 - Sell Rate / 100))
Worked Example
You buy 500 shares at $30 with a $9.99 flat commission.
- Total Investment: (500 x $30) + $9.99 = $15,009.99
- Sell commission: $9.99 flat
- Break-Even: ($15,009.99 + $9.99) / 500 = $30.04
The stock only needs to rise $0.04 above your buy price to break even. With zero-commission trading, your break-even would be exactly $30.00.
If you also want to cover a 15% capital gains tax, you need to sell high enough that after-tax profit is zero. The break-even after tax is higher, but the calculator handles this math for you.
Calculating Return on Investment (ROI)
ROI expresses your profit as a percentage of what you invested, making it easy to compare trades of different sizes.
ROI = (Net Profit / Total Investment) x 100
Example Comparison
| Trade | Investment | Net Profit | ROI |
|---|---|---|---|
| Trade A | $2,000 | $400 | 20% |
| Trade B | $10,000 | $1,500 | 15% |
| Trade C | $500 | $150 | 30% |
Trade C had the smallest dollar profit but the highest ROI. Trade B had the largest dollar profit but the lowest ROI. ROI helps you see which trade used your capital most efficiently.
Annualized ROI
If you held a stock for 3 years and earned 50% total ROI, what was your annual return?
Annualized ROI = ((1 + Total ROI)^(1/years) - 1) x 100
Annualized ROI = ((1.50)^(1/3) - 1) x 100 = 14.47% per year
This is useful for comparing a stock you held for 6 months to one you held for 5 years. Without annualizing, the comparison is apples to oranges.
Partial Share Sales
You do not always sell your entire position. When selling a portion, the key is correctly allocating costs to the shares being sold.
For percentage commissions, this happens naturally: the commission is based on the value of the shares you are actually selling.
For flat commissions, the full fee applies to each transaction. If you sell in two batches, you pay two sell commissions instead of one.
Example: Selling Half Your Position
You own 400 shares of ABC bought at $25 (total cost: $10,000, no buy commission). You sell 200 shares at $35.
- Cost of 200 shares sold: 200 x $25 = $5,000
- Sale of 200 shares: 200 x $35 = $7,000
- Net Profit on the partial sale: $7,000 - $5,000 = $2,000 (before commissions and tax)
- You still hold 200 shares at a cost basis of $25 each
Use the Stock Average Cost Calculator to track your cost basis across multiple purchases.
Real-World Examples
Example 1: Long-Term Investment in a Tech Stock
- Buy: 50 shares at $150 in January 2024
- Sell: 50 shares at $220 in March 2026 (held >1 year, long-term)
- Commission: $0 (zero-commission broker)
- Tax bracket: 15% long-term rate
Calculation:
- Gross Profit: ($220 - $150) x 50 = $3,500
- Net Profit (before tax): $3,500
- Tax: $3,500 x 0.15 = $525
- After-Tax Profit: $2,975
- ROI: 46.67% (before tax), 39.67% (after tax)
Example 2: Short-Term Day Trade
- Buy: 1,000 shares at $12.50 at 9 AM
- Sell: 1,000 shares at $13.20 at 2 PM (same day)
- Commission: 0.1% each way
- Tax bracket: 24% short-term (ordinary income)
Calculation:
- Buy commission: $12,500 x 0.001 = $12.50
- Sell commission: $13,200 x 0.001 = $13.20
- Total Investment: $12,500 + $12.50 = $12,512.50
- Total Sale: $13,200 - $13.20 = $13,186.80
- Net Profit: $674.30
- Tax: $674.30 x 0.24 = $161.83
- After-Tax Profit: $512.47
Example 3: A Losing Trade
- Buy: 100 shares at $85
- Sell: 100 shares at $62 (cut losses after bad earnings report)
- Commission: $0
- No tax on losses
Calculation:
- Net Profit: ($62 - $85) x 100 = -$2,300
- This loss can offset $2,300 of capital gains from other trades
How to Calculate Stock Profit in Excel
If you prefer spreadsheets, here is a simple setup:
| Cell | Label | Formula |
|---|---|---|
| B1 | Buy Price | (enter value) |
| B2 | Sell Price | (enter value) |
| B3 | Shares | (enter value) |
| B4 | Buy Commission | (enter value) |
| B5 | Sell Commission | (enter value) |
| B6 | Tax Rate | (enter value, e.g., 0.15) |
| B7 | Total Investment | =B1*B3+B4 |
| B8 | Total Sale | =B2*B3-B5 |
| B9 | Gross Profit | =(B2-B1)*B3 |
| B10 | Net Profit | =B8-B7 |
| B11 | Tax | =MAX(0,B10)*B6 |
| B12 | After-Tax Profit | =B10-B11 |
| B13 | ROI (%) | =B10/B7*100 |
| B14 | Break-Even | =(B7+B5)/B3 |
This gives you a reusable template. For a faster experience without setting up a spreadsheet, use our Stock Profit Calculator which does the same calculations with a cleaner interface and instant results.
How to Calculate Profit on a Short Sale
Short selling flips the normal buy-sell order. You borrow shares from your broker, sell them at the current price, and later buy them back (hopefully at a lower price) to return to the lender.
Short Sale Profit = (Short Sale Price - Cover Price) x Shares - Commissions - Borrowing Fees
Example
- Short sell 200 shares at $80 (receive $16,000)
- Buy to cover at $65 (cost $13,000)
- Gross profit: ($80 - $65) x 200 = $3,000
- Commission: $0
- Stock borrow fee: $50 (charged by broker for lending the shares)
- Net Profit: $3,000 - $50 = $2,950
Important: Short selling carries theoretically unlimited risk because a stock price can rise indefinitely. If the stock rises to $120 instead of falling, your loss would be ($120 - $80) x 200 = $8,000 plus fees.
How Dividends Affect Stock Profit
Dividends are cash payments made by companies to shareholders, typically on a quarterly basis. They add to your total return but are separate from capital gains.
Total Return = Capital Gain + Dividends Received
Example:
- Buy 100 shares at $50 ($5,000 total)
- Receive $200 in dividends over 2 years
- Sell at $60 ($6,000 total)
- Capital Gain: $1,000
- Total Return: $1,000 + $200 = $1,200 (24% total return)
Dividends are taxed differently from capital gains:
- Qualified dividends (most US company dividends): taxed at long-term capital gains rates
- Ordinary dividends (some REITs, foreign companies): taxed at ordinary income rates
Stock Return Benchmarks
How do you know if your return is good? Compare it to historical benchmarks:
- S&P 500 average annual return: ~10% (nominal), ~7% (after inflation)
- Strong individual stock return: 15-20% annually
- Typical swing trade target: 5-10% per position
- Warren Buffett's Berkshire Hathaway: ~20% annually over 50+ years (exceptional)
Any return that consistently beats the S&P 500 after fees and taxes is outstanding. Most professional fund managers fail to do this over long periods.
Use our Compound Interest Calculator to see how your returns compound over time. A 10% annual return turns $10,000 into $67,275 over 20 years.
Frequently Asked Questions
How do you calculate stock profit?
Net Profit = (Sell Price x Shares - Sell Commission) - (Buy Price x Shares + Buy Commission). For after-tax profit, subtract capital gains tax from the net profit. Use our Stock Profit Calculator for instant results.
What is a good profit percentage for stocks?
The S&P 500 has averaged about 10% per year historically. A stock returning 15-20% annually is considered strong. For individual trades, many traders target 5-10% per position.
Do I pay tax on stock profits?
Yes. Short-term gains (held under 1 year) are taxed at ordinary income rates (10-37%). Long-term gains (held over 1 year) are taxed at 0%, 15%, or 20%. High earners may also owe the 3.8% NIIT.
What is the difference between gross and net profit on stocks?
Gross profit only considers the price difference. Net profit also subtracts commissions. After-tax profit further subtracts capital gains tax. Always focus on after-tax profit for real-world decision making.
How do I calculate break-even price?
Break-Even = (Total Investment + Sell Commission) / Shares. This tells you the minimum price you need to sell at to avoid a loss.
Can stock losses reduce my tax bill?
Yes. Capital losses offset capital gains dollar for dollar. If losses exceed gains, you can deduct up to $3,000 against ordinary income per year, with excess carried forward.