Stock Tax Calculator

Estimate your capital gains tax on stock sales, compare short-term vs. long-term rates, and plan tax-efficient investment strategies.

SC
Written by Sarah Chen, CFP
Certified Financial Planner
JW
Fact-checked by Dr. James Wilson, PhD
Options Strategy Researcher
Trading ToolsFact-Checked

Input Values

$

Price paid per share.

$

Price received per share.

Shares sold.

Determines tax rate applied.

%

Your marginal federal income tax rate.

%

State income tax rate (0% for states with no income tax).

Your federal tax filing status.

Results

Total Capital Gain
$0.00
Federal Tax
$0.00
State Tax$0.00
Net Investment Income Tax (3.8%)$0.00
Total Estimated Tax
$0.00
After-Tax Profit$0.00
Results update automatically as you change input values.

How Stock Gains Are Taxed in the United States

When you sell stock for a profit, the gain is subject to capital gains tax. The tax rate depends primarily on how long you held the stock. Short-term capital gains (held less than one year) are taxed at your ordinary income tax rate, which can be as high as 37%. Long-term capital gains (held more than one year) are taxed at preferential rates of 0%, 15%, or 20% depending on your income level. This difference can save you thousands of dollars per year in taxes.

In addition to federal taxes, many states impose their own capital gains tax. States like California (13.3%), New York (10.9%), and New Jersey (10.75%) have high state income tax rates that apply to investment gains. Some states like Florida, Texas, Nevada, and Washington have no state income tax. High-income investors may also owe the 3.8% Net Investment Income Tax (NIIT) on investment income exceeding $200,000 (single) or $250,000 (married filing jointly).

Capital Gains Tax Formulas

Capital Gain
Capital Gain = (Sale Price - Purchase Price) x Shares - Commissions
Where:
Sale Price = Price per share at sale
Purchase Price = Price per share at purchase (cost basis)
Shares = Number of shares sold
Commissions = Total trading fees
Tax Owed
Tax = Capital Gain x (Federal Rate + State Rate + NIIT if applicable)
Where:
Federal Rate = Short-term: ordinary rate. Long-term: 0%, 15%, or 20%
State Rate = Your state's income tax rate
NIIT = 3.8% if income > $200K single / $250K married
Stock Tax Calculation Example
Given
Purchase
$50/share
Sale
$80/share
Shares
100
Holding
Long-term
Federal Bracket
24%
State Rate
5%
Calculation Steps
  1. 1Capital gain = ($80 - $50) x 100 = $3,000
  2. 2Long-term federal rate (24% bracket) = 15%
  3. 3Federal tax = $3,000 x 15% = $450
  4. 4State tax = $3,000 x 5% = $150
  5. 5NIIT (assume under threshold) = $0
  6. 6Total tax = $450 + $150 = $600
  7. 7After-tax profit = $3,000 - $600 = $2,400
Result
Your $3,000 long-term gain results in $600 total tax (20% effective rate), leaving $2,400 after tax. If this were a short-term gain, tax would be $870 (29% effective), leaving only $2,130.

Long-Term Capital Gains Tax Rates (2026)

Federal Long-Term Capital Gains Rates by Income
Filing Status0% Rate15% Rate20% Rate
SingleUp to $47,025$47,026 - $518,900Over $518,900
Married JointUp to $94,050$94,051 - $583,750Over $583,750
Head of HouseholdUp to $63,000$63,001 - $551,350Over $551,350

Tax-Loss Harvesting Strategy

Tax-loss harvesting is the practice of selling losing investments to offset capital gains from winning investments, reducing your overall tax bill. If your capital losses exceed your capital gains, you can deduct up to $3,000 of excess losses against ordinary income per year ($1,500 if married filing separately). Unused losses carry forward indefinitely. Be aware of the wash sale rule, which prevents you from claiming a loss if you repurchase the same or substantially identical security within 30 days.

!
Wash Sale Rule

The IRS wash sale rule disallows a capital loss deduction if you buy the same stock (or substantially identical security) within 30 days before or after the sale at a loss. The disallowed loss is added to the cost basis of the replacement shares. This rule applies across all accounts (brokerage, IRA, spouse's accounts). Violating wash sale rules can result in unexpected tax consequences.

  • Sell losing positions to generate capital losses before year-end to offset gains.
  • Wait 31 days before repurchasing to avoid the wash sale rule, or buy a similar but not identical ETF or stock.
  • Carry forward unused losses to future years with no expiration.
  • Consider donating appreciated stock to charity to avoid capital gains tax entirely while getting a deduction.
  • If you are in a 0% long-term capital gains bracket, consider selling appreciated stock and immediately repurchasing to reset your cost basis higher (tax-gain harvesting).

Capital Gains Tax in Canada

In Canada, capital gains are taxed differently than in the US. Only 50% of capital gains are included in taxable income (the inclusion rate). For example, a $10,000 capital gain results in $5,000 of taxable income, which is then taxed at your marginal tax rate. Canada does not distinguish between short-term and long-term holding periods for capital gains purposes. Capital gains are reported on Schedule 3 of the T1 tax return. The capital gains inclusion rate may be changing in future tax years, so consult a Canadian tax professional for current rules.

Frequently Asked Questions

In the US, short-term gains (stocks held < 1 year) are taxed at your ordinary income rate (10-37%). Long-term gains (> 1 year) are taxed at 0%, 15%, or 20% depending on your income. State taxes add 0-13.3% depending on your state. High earners may also owe 3.8% NIIT. Total effective rate ranges from 0% to over 50% for high-income Californians with short-term gains.

Sources & References

  • U.S. Securities and Exchange Commission (SEC) - Investor Education
  • Options Clearing Corporation (OCC) - Options Education
  • Chicago Board Options Exchange (CBOE) - Options Strategies
  • Hull, J.C. "Options, Futures, and Other Derivatives" (11th Edition, 2021)

Embed This Calculator on Your Website

Free to use with attribution

Copy the code below to add this calculator to your website, blog, or article. A link back to CoveredCallCalculator.net is included automatically.

<iframe src="https://coveredcallcalculator.net/embed/stock-tax-calculator" width="100%" height="500" frameborder="0" title="Stock Tax Calculator" style="border:1px solid #e2e8f0;border-radius:12px;max-width:600px;"></iframe>
<p style="font-size:12px;color:#64748b;margin-top:8px;">Calculator by <a href="https://coveredcallcalculator.net" target="_blank" rel="noopener">CoveredCallCalculator.net</a></p>