What is Tax on Stock Profit?

Tax on stock profit — formally known as capital gains tax (CGT) — is a tax levied on the profit you make when you sell a stock, ETF, or other investment asset for more than you paid for it. It is charged on the gain, not on your total proceeds.

The tax applies at the moment of realisation — when you actually sell the asset and lock in the profit. An investment that has risen 50% in value generates no tax liability until you sell. This distinction between unrealised and realised gains is fundamental to tax planning in investing.

Capital gains tax applies to profits from a wide range of financial assets:

  • Individual stocks — the most common source of capital gains for retail investors
  • ETFs and index funds — taxed the same way as stocks when sold
  • Mutual funds — can generate taxable distributions even if you did not sell
  • Bonds — gains taxed as capital gains; interest taxed as ordinary income
  • Cryptocurrency — treated as property in most jurisdictions; same CGT rules apply
  • Options and derivatives — complex rules; gains may be split between short and long-term

The size of your tax bill depends on three factors: the size of your gain, how long you held the asset, and your total income for the year. Our calculator handles all three automatically.

Key Concepts — Terminology You Must Know

Capital gains tax has its own vocabulary. Understanding these terms before you calculate your tax bill prevents costly errors.

Cost Basis

Your cost basis is what you paid for the investment — the starting point for calculating your gain. It includes the purchase price plus any commissions or fees paid at the time of buying. If you bought 100 shares at $50 and paid a $5 commission, your cost basis is $5,005, not $5,000. A higher cost basis means a smaller taxable gain.

Capital Gain Calculation Capital Gain = Sale Proceeds − Cost Basis Sale Proceeds = (Sell Price × Shares) − Selling Fees Cost Basis = (Buy Price × Shares) + Buying Fees Example: Bought 200 shares @ $45.00 + $10 commission → Cost Basis = $9,010 Sold 200 shares @ $68.00 − $10 commission → Proceeds = $13,590 Capital Gain = $13,590 − $9,010 = $4,580 (taxable amount)

Realised vs Unrealised Gains

An unrealised gain (also called a "paper gain") is when your investment has increased in value but you have not yet sold. No tax is owed on unrealised gains — they exist only on paper. A realised gain occurs when you sell and lock in the profit. This triggers the tax event.

This distinction gives investors a powerful tool: you control when you pay the tax by controlling when you sell. Deferring realisation to a lower-income year, or to the 12-month threshold for long-term rates, can dramatically reduce the tax owed.

Capital Losses

When you sell an investment for less than you paid, the result is a capital loss. Capital losses offset capital gains dollar-for-dollar. If you have $8,000 in capital gains and $3,000 in capital losses from other sales in the same tax year, you are taxed on only $5,000 of net gains. In the US, up to $3,000 in net capital losses can also offset ordinary income annually, with any excess carried forward to future years.

Holding Period

The holding period is the length of time between buying and selling an investment. It is the single most important variable determining your tax rate. In most countries — including the US, UK, and Australia — gains on assets held for longer periods qualify for significantly lower tax rates than short-term gains. In the US, the threshold is exactly one year and one day.

Wash Sale Rule

In the US, the wash sale rule prevents investors from claiming a capital loss on a security and then immediately repurchasing the same or a "substantially identical" security within 30 days before or after the sale. If you trigger a wash sale, the loss is disallowed and added back to the cost basis of the repurchased shares. This rule is critical to understand when implementing tax-loss harvesting strategies.

Net Investment Income Tax (NIIT)

In the US, higher-income investors pay an additional 3.8% NIIT on top of regular capital gains tax. This applies to single filers with modified adjusted gross income (MAGI) above $200,000, and married filing jointly above $250,000. Our US Tax Brackets tab applies this automatically when your income exceeds the threshold.

Effective Tax Rate vs Marginal Rate

Your marginal rate is the tax rate on the last dollar of income — the rate that applies to your highest-earning bracket. Your effective rate is the average rate across all your income, which is always lower. When our calculator shows your "effective tax rate on the gain," it expresses total tax paid as a percentage of gross profit — the real cost of the gain in tax terms.

Short-Term vs Long-Term Capital Gains

The most impactful tax decision an investor can make is often simply when to sell. The difference in tax rate between selling a few days before the one-year mark versus a few days after can be enormous.

Holding PeriodClassificationUS Tax RateExample
≤ 1 year Short-Term 10% – 37% (ordinary income) Sell after 6 months → taxed like salary
> 1 year Long-Term 0%, 15%, or 20% Sell after 13 months → preferential rate

The real-world impact of this distinction is dramatic. Here is the same $10,000 gain taxed at both rates for a middle-income investor:

ScenarioGainTax RateTax PaidNet Profit
Sell after 11 months (short-term) $10,000 22% $2,200 $7,800
Sell after 13 months (long-term) $10,000 15% $1,500 $8,500
Waiting 2 extra months saves: −7% $700 +8.97% more net profit

Waiting two months to cross the one-year threshold saved $700 on a $10,000 gain — a nearly 9% improvement in after-tax profit. For larger positions, the dollar savings scale proportionally. This is the single highest-return "trade" many investors never think to make.

US 2024 Capital Gains Tax Brackets

The US applies three long-term capital gains rates depending on your total taxable income and filing status. Here are the 2024 thresholds:

Long-Term Capital Gains Rates (2024)

RateSingle Filer IncomeMarried Filing JointlyHead of Household
0% Up to $47,025 Up to $94,050 Up to $63,000
15% $47,025 – $518,900 $94,050 – $583,750 $63,000 – $551,350
20% Above $518,900 Above $583,750 Above $551,350

Note that your capital gain is "stacked on top of" your ordinary income when determining which bracket applies. If you earn $40,000 in salary (single filer) and realise a $20,000 long-term gain, the first $7,025 of the gain falls in the 0% bracket, and the remaining $12,975 is taxed at 15%.

Short-Term Capital Gains — Ordinary Income Rates (2024)

Short-term gains are taxed as ordinary income at the same graduated brackets as your salary:

RateSingle Filer IncomeMarried Filing Jointly
10%$0 – $11,600$0 – $23,200
12%$11,600 – $47,150$23,200 – $94,300
22%$47,150 – $100,525$94,300 – $201,050
24%$100,525 – $191,950$201,050 – $383,900
32%$191,950 – $243,725$383,900 – $487,450
35%$243,725 – $609,350$487,450 – $731,200
37%Above $609,350Above $731,200

The NIIT Surcharge for High Earners

Investors with MAGI above $200,000 (single) or $250,000 (married jointly) pay an additional 3.8% Net Investment Income Tax on their investment income, including capital gains. This means the effective maximum federal rate on long-term gains for high earners is 20% + 3.8% = 23.8% — before any state tax.

What Reduces Your Taxable Gain

Transaction fees and commissions

Any commission or fee paid to buy or sell a stock directly reduces your taxable gain. Buy-side commissions increase your cost basis; sell-side commissions reduce your net proceeds. In the era of commission-free brokers, this matters less than it once did — but platform fees, transfer fees, and advisory charges may still apply and should always be included in your tax calculation.

Fee Impact on Taxable Gain Without fees: Gain = ($70 − $50) × 100 shares = $2,000 taxable With fees: Cost Basis = $50 × 100 + $10 = $5,010 Proceeds = $70 × 100 − $10 = $6,990 Taxable = $6,990 − $5,010 = $1,980 taxable Fee saving at 22% rate: $20 × 22% = $4.40 in tax saved

Capital losses from other positions

Capital losses are the most powerful legal tool for reducing your tax bill. Every dollar of realised loss from one position directly offsets a dollar of gain from another. Investors who actively manage their tax position — a practice called tax-loss harvesting — can substantially reduce or even eliminate their capital gains tax liability in a given year.

The annual loss carryforward

In the US, if your net capital losses exceed your gains in a given year, you can deduct up to $3,000 against ordinary income (salary, business income). Any remaining losses carry forward indefinitely to offset future gains. A significant loss year is not just painful — it creates a "tax asset" that reduces future tax bills for years.

Specific identification of shares

If you bought shares of the same stock at different prices over time, you can choose which shares to sell — a method called specific identification. Selling the highest-cost shares first (highest-cost-first, or HIFO) minimises the realised gain. Selling the lowest-cost shares first (FIFO — first in, first out, the default method at many brokers) maximises it. Always verify which accounting method your broker applies by default.

Capital Gains Tax Around the World

Tax rules on stock profits vary enormously between countries. Some tax capital gains at high ordinary income rates; others offer flat preferential rates; and a notable group of countries have no capital gains tax at all.

CountryLong-Term CGT RateNotes
🇭🇰 Hong Kong0%No capital gains tax on shares
🇸🇬 Singapore0%No capital gains tax (non-traders)
🇨🇭 Switzerland0%No CGT on private capital assets
🇳🇿 New Zealand0%No CGT generally (non-traders)
🇺🇸 United States0% / 15% / 20%Plus NIIT 3.8% and state tax
🇬🇧 United Kingdom10% / 20%Basic / higher rate taxpayers
🇯🇵 Japan20.315%Flat including local tax
🇫🇷 France30%PFU flat tax rate
🇩🇪 Germany26.375%Abgeltungsteuer flat rate
🇨🇦 Canada~27%50% inclusion at marginal rate
🇦🇺 Australia~22.5%50% discount after 12 months

These rate differences have a dramatic impact on after-tax returns for international investors. On a $50,000 capital gain, an investor in Singapore pays $0 in CGT while an investor in France pays $15,000. The Global Compare tab in our calculator shows this difference for any gain amount across 12 countries simultaneously.

Legal Tax Minimisation Strategies

1. Hold for at least one year

The simplest and most impactful strategy is simply to hold investments for more than 12 months before selling. In the US, this converts a short-term gain taxed at ordinary income rates (up to 37%) into a long-term gain taxed at 0%, 15%, or 20%. For a middle-income investor in the 22% bracket, this single action reduces the tax rate on gains by 7 percentage points — a 31.8% reduction in tax paid.

2. Tax-loss harvesting

Deliberately realise losses in losing positions to offset gains in profitable ones. The key rules: losses offset gains of the same character first (short-term losses offset short-term gains, then long-term gains). Be mindful of the wash-sale rule — you cannot repurchase the same or substantially identical security within 30 days if you want to claim the loss.

Tax-Loss Harvest Example
  • Gain from Stock A: +$12,000
  • Loss from Stock B: −$4,500 (sold to harvest)
  • Net Taxable Gain: $7,500 (reduced from $12,000)

→ At 15% LT rate: Tax saved = $675 vs no harvesting

3. Sell in a lower-income year

Since capital gains are stacked on top of ordinary income, realising gains during a year with lower income — retirement year, career break, part-time year — can push the gain into a lower bracket or even the 0% long-term bracket. For early retirees in the US with limited ordinary income, it is possible to realise tens of thousands of dollars in long-term capital gains completely tax-free.

4. Use tax-advantaged accounts

Gains realised inside a Traditional IRA or 401(k) are not taxed immediately — they are deferred until withdrawal and taxed as ordinary income. Gains inside a Roth IRA are never taxed, making it the most tax-efficient account for long-term stock investing. Prioritising high-growth stocks in Roth accounts and dividend stocks (taxed annually) in traditional accounts is a powerful asset location strategy.

5. Gift appreciated stock

Gifting appreciated stock directly to a charity allows you to deduct the full fair market value while paying zero capital gains tax on the appreciation. Gifting to a family member in a lower tax bracket (within annual gift limits) transfers the asset to someone who may owe less tax on the gain when sold.

6. Specific share identification (HIFO)

If you have purchased shares in multiple lots at different prices, sell the highest-cost shares first to minimise the realised gain. This requires your broker to support specific share identification and you must make the selection before or at the time of sale — not after. The difference between HIFO and FIFO can be significant for long-held positions built up over years of contributions.

How to Use Our Tax on Stock Profit Calculator Pro — Tab by Tab

Our Tax on Stock Profit Calculator Pro has four tabs covering every dimension of stock tax calculation — from a quick estimate with any custom rate to a full US bracket analysis, 12-country global comparison, and three-strategy tax optimisation.

Tab 1: Quick Tax — Calculate with any custom rate

The fastest way to estimate your tax bill. Enter buy price, sell price, shares, holding period (short or long-term), your federal tax rate, optional state tax rate, and any transaction fees. The calculator instantly shows:

  • Gross profit and taxable gain (after fees)
  • Federal tax, state tax and total tax separately
  • Effective tax rate on the gross profit
  • After-tax net profit — what you actually keep
  • A smart tip if you are short-term: how much you save by holding to long-term
  • Donut chart splitting after-tax profit, federal tax, state tax and fees
Example — Quick Tax tab
  • Buy: $42.00 | Sell: $67.50 | Shares: 300
  • Holding: Long-term | Federal: 15% | State: 5% | Fees: $25

→ Gross Profit: $7,650  |  Taxable Gain: $7,625  |  Federal Tax: −$1,144  |  State Tax: −$381  |  Net Profit: $6,100  |  Eff. Rate: 20.3%

Tab 2: US Tax Brackets — Find your exact federal rate

For US investors, this tab automatically applies the correct 2024 federal bracket — no manual rate lookup required. Enter buy price, sell price, shares, your filing status (Single / Married Filing Jointly / Married Filing Separately / Head of Household), your annual ordinary income, holding period and state tax rate. The calculator applies:

  • The correct long-term bracket (0%, 15%, 20%) based on your total income including the gain
  • Or the correct short-term ordinary income bracket (10% – 37%)
  • Net Investment Income Tax (NIIT 3.8%) automatically when income exceeds threshold
  • State tax on top of the federal calculation
  • An interactive bracket table highlighting exactly which bracket you fall into
Example — US Tax Brackets tab
  • Buy: $30.00 | Sell: $78.00 | Shares: 500 | Long-term
  • Filing: Single | Ordinary Income: $85,000 | State: 9.3% (CA)

→ Gain: $24,000  |  Federal Rate: 15%  |  Federal Tax: −$3,600  |  CA State: −$2,232  |  NIIT: $0  |  Net: $18,168

Tab 3: Global Compare — See how your country ranks

Enter your capital gain and holding period. The calculator displays after-tax profit for 12 major countries ranked from most to least tax-efficient — with flags, rates, and country-specific notes. The best and worst countries are automatically highlighted with badges. A bar chart shows after-tax profit vs tax paid for every country simultaneously.

Example — Global Compare tab ($20,000 long-term gain)
  • 🇭🇰 Hong Kong: $20,000 (0% — no CGT)
  • 🇸🇬 Singapore: $20,000 (0% — no CGT)
  • 🇺🇸 United States: $17,000 (15% federal only)
  • 🇬🇧 United Kingdom: $16,000 (20% higher rate)
  • 🇩🇪 Germany: $14,725 (26.375% flat)
  • 🇫🇷 France: $14,000 (30% PFU)

Tab 4: Tax Optimizer — Find the best strategy

The most actionable tab. Enter buy price, current price, shares, your short-term and long-term tax rates, any realised losses available for offset, and the expected annual return if you hold. The calculator compares three strategies side by side:

  • ⚡ Sell Now (Short-Term) — your tax at the higher rate today
  • 📅 Hold to Long-Term — tax at the preferential rate after 12 months
  • 🌾 After Loss Harvest — tax after offsetting with realised losses

The hero metric shows exactly how much you save by choosing the best strategy over the worst — the dollar amount of avoidable tax on your current position.

Example — Tax Optimizer tab
  • Buy: $55.00 | Current: $92.00 | Shares: 400
  • ST Rate: 24% | LT Rate: 15% | Losses: $2,800

→ Gross Gain: $14,800  |  Sell Now Tax: $3,552 · Net: $11,248  |  Hold LT Tax: $2,220 · Net: $12,580  |  After Harvest Tax: $2,880 · Net: $11,920  |  Best Strategy Saves: $1,332

Common Tax Mistakes Investors Make

Selling just before the one-year mark

This is the costliest timing error in stock investing. Selling on day 364 instead of day 366 converts a long-term gain into a short-term gain. For a $20,000 gain, that is the difference between paying 15% ($3,000) and 22% ($4,400) — a $1,400 mistake that takes two minutes to avoid. Always check your holding period before selling.

Not tracking cost basis across multiple purchases

Many investors who buy shares in multiple lots lose track of their average cost basis. Without accurate tracking, you cannot choose the optimal shares to sell (HIFO vs FIFO), may over- or underestimate your tax liability, and risk errors on your tax return. Most major brokers now track cost basis automatically — but always verify, especially for older positions or shares transferred between brokers.

Forgetting about state capital gains tax

Federal tax is only part of the story. California taxes capital gains as ordinary income up to 13.3%, New York up to 10.9%, and Oregon up to 9.9%. These rates are applied on top of the federal rate. An investor in California realising a $50,000 short-term gain at the 35% federal rate could face a combined rate above 48%. Always include your state rate when estimating your true tax bill.

Violating the wash-sale rule

Selling a stock to harvest a loss and immediately buying it back within 30 days triggers the wash-sale rule — the loss is disallowed. Many investors make this error accidentally when they sell from one account and buy in another (including an IRA), not realising the rule applies across all accounts. If you want to maintain market exposure after a loss harvest, buy a similar but not substantially identical ETF during the 30-day window.

Assuming all dividends are taxed the same

Qualified dividends from US companies (and certain foreign companies) are taxed at the lower long-term capital gains rates. Ordinary dividends are taxed at regular income rates. REITs, foreign stocks, and short-holding-period dividends often pay ordinary (non-qualified) dividends. Misclassifying dividend income leads to underpayment — and potential penalties.

Not using available losses before year-end

Capital losses expire at year-end — unused losses cannot be applied retroactively to earlier gains in the same year. If you have unrealised losses in your portfolio and realised gains elsewhere, reviewing your positions before December 31 and harvesting available losses can meaningfully reduce your tax bill before the calendar resets.

Frequently Asked Questions

How is tax on stock profit calculated?

Tax = (Sell Price − Buy Price) × Shares − Fees) × Tax Rate. The taxable amount is your capital gain (profit after subtracting your cost basis and any allowable fees). The rate depends on your holding period: long-term (over 1 year) rates are 0%, 15%, or 20% in the US; short-term gains are taxed as ordinary income at rates up to 37%.

Do I pay tax on stocks if I don't sell?

No. In virtually all jurisdictions, capital gains tax is only triggered when you actually sell an asset and realise the gain. An investment that has doubled in value but that you still hold generates no tax liability. Dividends are the exception — they are taxed as income in the year they are received, regardless of whether you sell the underlying stock.

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

Short-term capital gains apply to assets sold within one year of purchase and are taxed at ordinary income rates (10% to 37% in the US). 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 total income. Holding for more than 12 months is the single most impactful legal strategy for reducing stock profit tax.

How does tax-loss harvesting work?

Tax-loss harvesting means selling investments that are currently worth less than you paid for them, deliberately realising a capital loss. That loss offsets capital gains from profitable trades dollar-for-dollar, reducing your taxable income. The key rule to follow is the wash-sale rule: you cannot repurchase the same or a substantially identical security within 30 days before or after the sale if you want the loss to count.

Which US states have no capital gains tax?

States with no income tax (and therefore no capital gains tax) include Texas, Florida, Nevada, Washington (has a 7% CGT on long-term gains above $250,000 since 2023), Wyoming, South Dakota, Alaska, and Tennessee (for investment income). If you live in a high-tax state like California (13.3%) or New York (10.9%), this can add significantly to your total tax burden on stock profits.

What is the Net Investment Income Tax (NIIT)?

The NIIT is an additional 3.8% federal tax applied to investment income — including capital gains — for single filers with modified adjusted gross income above $200,000, or married filing jointly above $250,000. This means the maximum combined federal rate on long-term gains for high earners is 23.8% (20% + 3.8%). Our US Tax Brackets tab adds NIIT automatically when your income exceeds the threshold.

Can I avoid capital gains tax on stocks legally?

Yes — several legal strategies can reduce or eliminate CGT. Holding for more than 1 year qualifies for the lower long-term rate. Investing through a Roth IRA means gains are never taxed. Offsetting gains with losses (tax-loss harvesting) reduces taxable income. Donating appreciated stock to charity avoids CGT entirely while providing a deduction. Realising gains in a low-income year can push gains into the 0% bracket. None of these constitute tax evasion — they are legitimate planning strategies available to all investors.

Is this tax calculator free?

Yes. The Tax on Stock Profit Calculator Pro on StockToolHub is completely free with no registration or account required. This calculator is for estimation and educational purposes only and does not constitute tax advice. Always consult a qualified tax professional for your specific situation.

Calculate your stock profit tax now

Free, instant, no sign-up required.

Open Tax Calculator →