Finance

Stock Profit Calculator Guide: How to Calculate Trading Gains

By The hakaru Team·Last updated March 2026

Stock profitis the difference between what you sell a stock for and what you paid for it, minus any commissions and fees. The formula is: (Sell Price - Buy Price) x Shares - Fees. Your after-tax profit depends on your holding period: stocks held over one year qualify for long-term capital gains rates of 0%, 15%, or 20%, while stocks held one year or less are taxed at ordinary income rates up to 37%. The S&P 500 has returned an average of approximately 10% per year historically.

Quick Answer

  • 1. Profit = (Sell Price - Buy Price) x Shares - Fees.
  • 2. Long-term gains (held >1 year): taxed at 0%, 15%, or 20% (NerdWallet).
  • 3. Short-term gains (held <=1 year): taxed at ordinary income rates (10-37%).
  • 4. S&P 500 average annual return: ~10% historically; 23% in 2024 (NerdWallet).
Financial Disclaimer: This guide is for educational purposes only and does not constitute investment advice. Tax laws change frequently. Consult a qualified tax professional or financial advisor for guidance specific to your situation.

Calculate your stock profit

Enter buy price, sell price, shares, and fees to see your gross and after-tax profit instantly.

Calculate Stock Profit Free

The Stock Profit Formula

The basic formula for calculating stock profit is straightforward:

Gross Profit = (Sell Price per Share - Buy Price per Share) x Number of Shares

Net Profit = Gross Profit - Buy Commission - Sell Commission - Any Other Fees

After-Tax Profit = Net Profit - Capital Gains Tax

Worked Example

You bought 200 shares of a stock at $25.00 per share and sold them at $38.50 per share. Your broker charges $0 commissions (common at major brokerages in 2026), but you paid a $0.02 per share SEC fee on the sale.

  • Total cost: 200 x $25.00 = $5,000.00
  • Total proceeds: 200 x $38.50 = $7,700.00
  • SEC fee: 200 x $0.02 = $4.00
  • Gross profit: $7,700 - $5,000 = $2,700.00
  • Net profit: $2,700 - $4 = $2,696.00

Capital Gains Tax Rates for 2026

How much tax you owe on stock profits depends on how long you held the investment.

Long-Term Capital Gains (Held > 1 Year)

Tax RateSingle Filer IncomeMarried Filing Jointly
0%Up to ~$48,350Up to ~$96,700
15%$48,350 - $533,400$96,700 - $600,050
20%Over $533,400Over $600,050

High earners may also owe the 3.8% Net Investment Income Tax (NIIT), bringing the top effective rate to 23.8%.

Short-Term Capital Gains (Held <= 1 Year)

Short-term gains are taxed at your ordinary income tax rate: 10%, 12%, 22%, 24%, 32%, 35%, or 37%. For a single filer earning $90,000 in taxable income, short-term gains fall in the 22% bracket.

Tax Impact Example

Using our $2,696 profit example, held for 8 months (short-term) by someone in the 22% bracket:

  • Tax: $2,696 x 0.22 = $593.12
  • After-tax profit: $2,696 - $593.12 = $2,102.88

If the same shares were held for 14 months (long-term) by the same filer qualifying for the 15% rate:

  • Tax: $2,696 x 0.15 = $404.40
  • After-tax profit: $2,696 - $404.40 = $2,291.60

The difference: holding 6 months longer saved $188.72 in taxes on this trade.

How to Calculate Percentage Return

Percentage return (ROI) tells you how much your investment grew relative to your cost:

Return % = (Net Profit / Total Cost) x 100

For our example: ($2,696 / $5,000) x 100 = 53.9% return. To annualize this, divide by the holding period in years: if held for 1.5 years, the annualized return is 53.9% / 1.5 = about 35.9% per year.

Average Stock Market Returns

To put your returns in perspective, here are the historical S&P 500 average returns:

Time PeriodAverage Annual Return
All-time (~100 years)~10%
Last 30 years~9%
Last 10 years~11.3%
Last 5 years~13.6%
2024~23%
2025~17.9%

These figures include dividends but not inflation. After inflation (about 3% historically), the real average return is closer to 7% per year.

Tax-Loss Harvesting: Offsetting Gains with Losses

If you have losing positions, you can sell them to offset gains through tax-loss harvesting:

  • Capital losses first offset capital gains dollar for dollar.
  • Net losses up to $3,000 per year ($1,500 if married filing separately) can offset ordinary income.
  • Unused losses carry forward indefinitely to future tax years.

Be aware of the wash-sale rule:if you buy a “substantially identical” security within 30 days before or after selling at a loss, the loss is disallowed for tax purposes.

Understanding Cost Basis Methods

If you bought the same stock multiple times at different prices, the cost basis method determines which shares are “sold” for tax purposes:

  • FIFO (First In, First Out): The default method. Oldest shares are sold first. If the stock has risen over time, this produces the highest gain and the most tax.
  • Specific Identification: You choose which lot to sell. This gives you control over the tax impact of each sale.
  • Average Cost: Used primarily for mutual funds. Your cost basis is the average price of all shares held.

Strategies to Reduce Taxes on Stock Profits

  • Hold for more than one year to qualify for long-term capital gains rates (0-20% vs. 10-37%).
  • Use tax-advantaged accounts (401k, IRA, Roth IRA) where gains are tax-deferred or tax-free.
  • Harvest losses to offset gains in the same tax year.
  • Donate appreciated stock to charity to avoid capital gains entirely and claim a deduction for the full market value.
  • Choose specific identification as your cost basis method to sell higher-cost lots first.

The Bottom Line

Calculating stock profit is simple math: sell proceeds minus cost minus fees. The tax implications add complexity, with the critical factor being your holding period. Holding investments for over one year can cut your tax rate roughly in half compared to short-term trading. The S&P 500 has returned approximately 10% annually over the long term, making patience one of the most powerful tools in investing.

Our free stock profit calculator computes your gross profit, net profit after fees, and estimated capital gains tax. Enter your buy and sell details to see the results instantly.

Frequently Asked Questions

How do I calculate profit from selling stock?

Stock profit equals the total sale proceeds minus the total cost basis. The formula is: Profit = (Sell Price x Shares) - (Buy Price x Shares) - Total Fees. For example, if you bought 50 shares at $40 ($2,000) and sold them at $55 ($2,750) with $10 in commissions each way: Profit = $2,750 - $2,000 - $20 = $730. This is your gross profit before taxes. Your after-tax profit depends on whether the gain is short-term or long-term and your tax bracket.

What is the difference between short-term and long-term capital gains?

Short-term capital gains apply to assets held for one year or less and are taxed at your ordinary income tax rate (10% to 37% depending on your bracket). Long-term capital gains apply to assets held for more than one year and are taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income. For a single filer in 2026, long-term gains are taxed at 0% up to approximately $48,350, 15% from $48,350 to $533,400, and 20% above $533,400. High earners may also owe the 3.8% Net Investment Income Tax, bringing the maximum rate to 23.8%.

Do I owe taxes on stocks I haven't sold?

No. You only owe capital gains tax when you sell a stock (or other investment) at a profit. Unrealized gains, where your stocks have increased in value but you have not sold them, are not taxable. This is why 'buy and hold' is tax-efficient: you defer taxes until you sell. However, dividends received from stocks you hold are taxable in the year they are paid, regardless of whether you sell the stock. Qualified dividends are taxed at the long-term capital gains rate, while ordinary dividends are taxed as ordinary income.

Can I offset stock losses against gains?

Yes. Tax-loss harvesting allows you to offset capital gains with capital losses. If you sold Stock A for a $5,000 profit and Stock B for a $3,000 loss in the same year, you only owe taxes on $2,000 of net gain. If your losses exceed your gains, you can deduct up to $3,000 of net capital losses against ordinary income per year ($1,500 if married filing separately). Any remaining losses carry forward to future tax years indefinitely. Be aware of the wash-sale rule: you cannot claim a loss if you buy the same or a 'substantially identical' security within 30 days before or after the sale.

How does cost basis work with multiple purchases?

If you bought shares of the same stock at different prices, your cost basis depends on which shares you sell. The default method for most brokers is FIFO (first in, first out), meaning the oldest shares are assumed to be sold first. You can also use specific identification, where you choose which lots to sell. This matters for tax planning: selling higher-cost lots first reduces your taxable gain. For example, if you bought 100 shares at $30 and later 100 shares at $50, selling 100 shares at $55 gives you a $2,500 gain under FIFO (sold the $30 shares) but only a $500 gain using specific identification (sold the $50 shares).

Calculate your stock profit

Enter buy price, sell price, shares, and fees to see gross, net, and after-tax profit.

Calculate Stock Profit Free