Calculating your stock profit is only half the picture. The other half — the part many investors ignore until tax season — is figuring out how much of that profit actually belongs to you after the government takes its share. Capital gains tax on stock profits is real, significant, and heavily influenced by one simple variable you control entirely: how long you held the stock before selling.
What Is Capital Gains Tax on Stocks?
Capital gains tax is a tax levied on the profit you make from selling a capital asset — including stocks — for more than you paid for it. The key word is profit. If you sell a stock at a loss, there is no capital gains tax on that transaction. In fact, capital losses can be used to offset capital gains in the same tax year, and up to $3,000 of net losses can be deducted against ordinary income annually in the US, with excess losses carried forward to future years.
The amount of capital gains tax you owe depends on two primary factors:
- The size of your gain — your net profit after commissions
- How long you held the stock — the holding period determines whether short-term or long-term tax rates apply
Short-Term vs Long-Term Capital Gains: The Crucial Distinction
This is the most important concept in stock tax planning, and it is beautifully simple: hold your stock for one year or less and your profit is taxed as ordinary income (short-term capital gains). Hold your stock for more than one year and your profit qualifies for the lower long-term capital gains tax rates.
Short-Term Capital Gains Tax Rates (2025)
Short-term capital gains are taxed at your ordinary income tax rate — the same rate as your salary, wages, and self-employment income. The 2025 federal ordinary income tax brackets for single filers are approximately:
- 10% on income up to $11,925
- 12% on income from $11,925 to $48,475
- 22% on income from $48,475 to $103,350
- 24% on income from $103,350 to $197,300
- 32% on income from $197,300 to $250,525
- 35% on income from $250,525 to $626,350
- 37% on income above $626,350
Your short-term capital gain is added to your other income for the year and taxed at whatever bracket rate applies. A high-income earner could owe 37 cents in federal tax for every dollar of short-term capital gain.
Long-Term Capital Gains Tax Rates (2025)
Long-term capital gains — from stocks held more than one year — qualify for significantly lower preferential tax rates. The 2025 federal long-term capital gains rates for single filers are approximately:
- 0% on long-term gains if your total taxable income is up to approximately $47,025
- 15% on long-term gains if your total taxable income is between approximately $47,025 and $518,900
- 20% on long-term gains if your total taxable income exceeds approximately $518,900
Most middle-income investors pay 15% on long-term capital gains. Compare this to a 22% or 24% short-term rate for the same income level — holding a stock for just over one year instead of just under one year can reduce the tax on your profit by a third or more. This tax difference is a powerful argument for long-term investing, as we discuss in our comparison: Long-Term vs Short-Term Stock Investing: Which One Is Right for You in 2025.
Step-by-Step: How to Calculate Your Capital Gains Tax
Step 1: Calculate Your Net Capital Gain
Your taxable capital gain is your net profit from the sale — after broker commissions on both buying and selling. This is not the gross price difference; it is the actual net profit after all transaction costs.
Net Capital Gain = Net Sell Proceeds − Total Buy Cost Basis
Where: Net Sell Proceeds = (Sell Price × Shares) − Selling Commission
And: Total Buy Cost Basis = (Buy Price × Shares) + Buying Commission
Example: You buy 100 shares at $30.00 with $10 commission and sell at $42.00 with $10 commission:
- Total Buy Cost = (100 × $30) + $10 = $3,010
- Net Sell Proceeds = (100 × $42) − $10 = $4,190
- Net Capital Gain = $4,190 − $3,010 = $1,180
For the complete framework of net profit calculation with worked examples, see our guide: How to Calculate Stock Profit and Loss Like a Pro. Note that commissions paid on both sides of the trade reduce your taxable gain — they are not ignored for tax purposes.
Step 2: Determine Your Holding Period
Count the number of days between your purchase date and your sale date. Hold for 366 days or more (one year plus one day) and the gain qualifies as long-term. Hold for 365 days or fewer and it is short-term. The holding period rule is applied strictly — selling one day too early converts a long-term gain into a short-term gain at a potentially much higher rate.
Step 3: Identify Your Tax Rate
Based on your holding period from Step 2 and your total annual taxable income, identify the applicable tax rate:
- Short-term gain → find your marginal ordinary income tax bracket rate
- Long-term gain → apply the 0%, 15%, or 20% rate based on your total income
Step 4: Calculate the Tax Amount
Capital Gains Tax = Net Capital Gain × Applicable Tax Rate
Using the $1,180 gain from our example:
- If short-term (22% bracket): Tax = $1,180 × 0.22 = $259.60
- If long-term (15% rate): Tax = $1,180 × 0.15 = $177.00
- Difference in tax: $259.60 − $177.00 = $82.60 saved by holding long-term
Step 5: Calculate Your After-Tax Net Return
After-Tax Net Profit = Net Capital Gain − Capital Gains Tax
- Short-term: $1,180 − $259.60 = $920.40 after-tax profit
- Long-term: $1,180 − $177.00 = $1,003.00 after-tax profit
The after-tax profit is your true take-home return. For your ROI calculation, use the after-tax profit rather than the pre-tax profit for the most accurate picture of real investment performance: What Is ROI in Stocks and How to Use It to Compare Investments.
How Cost Basis Method Affects Your Taxable Gain
When you have bought shares of the same stock at multiple different prices — through averaging down, dollar cost averaging, or regular contributions — the cost basis method you use determines which shares are considered sold and therefore what your taxable gain is.
The IRS allows several cost basis methods:
- FIFO (First In, First Out): The default method. Your earliest purchased shares are treated as sold first.
- LIFO (Last In, First Out): Your most recently purchased shares are treated as sold first. Can be advantageous when recent purchases have higher cost basis.
- Specific Identification: You specify exactly which lot of shares you are selling, giving you the most control over which gain or loss you recognize.
- Average Cost: Used primarily for mutual funds; averages all your purchase prices for tax purposes.
The cost basis method you choose can meaningfully change your tax liability in any given year. Specific identification gives the most flexibility — you can choose to sell your highest-cost shares first to minimize taxable gains, or your lowest-cost shares if you want to realize losses for tax-loss harvesting purposes.
For a thorough explanation of how average cost is calculated across multiple purchases — which is the foundation of understanding which lots have which cost basis: How to Calculate Average Stock Price When You Buy at Different Prices.
Tax-Loss Harvesting: Using Losses to Reduce Your Tax Bill
Capital losses from stocks sold at a loss can directly offset capital gains from stocks sold at a profit in the same tax year, reducing your total taxable gain dollar for dollar. This strategy — called tax-loss harvesting — is used by savvy investors to reduce their tax bill without reducing their overall market exposure.
For example: You realize a $3,000 capital gain from one stock and a $1,200 capital loss from another. Your net taxable capital gain is $3,000 − $1,200 = $1,800 — and you only pay tax on the $1,800 net gain.
If your total capital losses exceed your capital gains for the year, up to $3,000 of the excess loss can be deducted against ordinary income, with any remaining excess carried forward to future tax years. This makes tracking losing positions and their cost basis just as important as tracking winning ones.
How Break-Even and Tax Interact in Exit Planning
Your pre-commission break-even price and your after-tax break-even price are two different numbers. The break-even calculator gives you the price at which your gross profit covers all transaction costs. But if you sell above that price and generate a taxable gain, you need the price to be even higher to achieve zero after-tax profit.
For complete exit strategy planning that integrates both the commission-based break-even and the tax implications of each exit scenario, use our break-even calculator guide alongside this tax guide: How to Use a Break-Even Calculator to Plan Your Stock Exit Strategy.
State Capital Gains Taxes
The rates above are federal-only. Most US states also tax capital gains — some at the same rates as ordinary state income, others at preferential rates, and a few (like Florida and Texas) with no state income tax at all. Your total tax liability is the sum of federal capital gains tax plus applicable state tax. Always factor state taxes into your total calculation for your actual jurisdiction.
Using a Capital Gains Tax Calculator
Rather than manually working through all these steps, a capital gains tax calculator accepts your gain amount, holding period, and estimated income bracket and instantly outputs the estimated federal tax owed and after-tax profit. This is significantly faster than manual calculation, especially when modeling multiple exit scenarios at different potential sell prices.
Combined with the profit calculator, break-even calculator, and ROI calculator — all available at StockCalculator.us — you have a complete set of free tools for every financial calculation any stock investor needs. See the full guide to all five essential tools: Top 5 Free Stock Calculators Every Trader Needs in 2025.