Capital Gains Tax Calculator
Calculate your potential capital gains tax liability based on your asset type, holding period, and income level.
Comprehensive Guide to Calculating Capital Gains Tax (With Real Examples)
Understanding Capital Gains Tax Basics
Capital gains tax is a tax on the profit you make from selling an asset that has increased in value. The tax applies to the gain (the difference between the purchase price and selling price), not the total sale amount. This tax system encourages long-term investing by offering lower tax rates for assets held longer than one year.
Key Terms to Know
- Cost Basis: The original purchase price of the asset, plus any additional investments or improvements
- Capital Gain: The profit made from selling the asset (Selling Price – Cost Basis – Expenses)
- Holding Period: How long you owned the asset before selling (determines short-term vs. long-term tax rates)
- Capital Loss: When you sell an asset for less than your cost basis (can offset capital gains)
Short-Term vs. Long-Term Capital Gains
The most critical factor in determining your capital gains tax rate is how long you’ve held the asset before selling:
| Holding Period | Tax Rate Type | 2023 Tax Rates (Federal) | Key Considerations |
|---|---|---|---|
| ≤ 1 year (Short-term) | Ordinary income tax rates | 10% – 37% (based on income bracket) | Same as your regular income tax rate |
| > 1 year (Long-term) | Preferential rates |
0% (income ≤ $44,625 single/$94,050 married) 15% (income $44,626-$492,300 single/$94,051-$553,850 married) 20% (income > $492,300 single/> $553,850 married) |
Significantly lower than short-term rates |
Example: If you’re single with $60,000 annual income and sell stocks:
- Held for 6 months (short-term): Taxed at your ordinary rate (likely 22%)
- Held for 18 months (long-term): Taxed at 15% rate
Step-by-Step Calculation Process
-
Determine Your Cost Basis
This includes:
- Original purchase price
- Commissions and fees paid at purchase
- Improvements (for real estate)
- Reinvested dividends (for stocks)
Example: You bought 100 shares at $50/share ($5,000 total) with a $50 commission. Your cost basis is $5,050.
-
Calculate Your Selling Price
This is the amount you receive from the sale, minus:
- Commissions and fees
- Selling expenses
Example: You sell the 100 shares for $75/share ($7,500) with a $75 commission. Your net selling price is $7,425.
-
Compute the Capital Gain
Formula:
Capital Gain = Net Selling Price - Cost BasisContinuing our example: $7,425 – $5,050 = $2,375 capital gain
-
Determine Your Tax Rate
Based on:
- Holding period (short vs. long-term)
- Your taxable income
- Filing status (single, married, etc.)
-
Calculate the Tax Owed
Multiply your capital gain by your determined tax rate.
-
Consider State Taxes
Most states tax capital gains as regular income. Some states (like California) have particularly high rates.
Real-World Calculation Examples
Example 1: Stock Investment (Long-Term)
Scenario: Sarah is single with $80,000 annual income. She bought 200 shares of XYZ stock at $25/share ($5,000 total) in January 2020. She sells them in March 2023 for $45/share ($9,000 total) with $100 in total fees.
| Cost Basis: | $5,000 (purchase) + $50 (original commission) = $5,050 |
| Net Selling Price: | $9,000 (sale) – $100 (fees) = $8,900 |
| Capital Gain: | $8,900 – $5,050 = $3,850 |
| Holding Period: | 3 years 2 months (long-term) |
| Federal Tax Rate: | 15% (since income is between $44,626-$492,300) |
| Federal Tax Owed: | $3,850 × 15% = $577.50 |
| State Tax (CA): | $3,850 × 9.3% = $358.05 |
| Total Tax: | $577.50 + $358.05 = $935.55 |
| Net Proceeds: | $8,900 – $935.55 = $7,964.45 |
Example 2: Real Estate Sale (Primary Home)
Scenario: Mark and Lisa (married filing jointly, $120,000 income) sell their primary home. They bought it for $300,000 and sell for $550,000 after 5 years. They spent $50,000 on improvements and have $20,000 in selling expenses.
| Cost Basis: | $300,000 (purchase) + $50,000 (improvements) = $350,000 |
| Net Selling Price: | $550,000 (sale) – $20,000 (expenses) = $530,000 |
| Capital Gain: | $530,000 – $350,000 = $180,000 |
| Primary Home Exclusion: | $250,000 (single) or $500,000 (married) exclusion applies |
| Taxable Gain: | $180,000 – $500,000 = $0 (no tax due) |
Note: The IRS allows you to exclude up to $250,000 ($500,000 for married couples) of capital gains on the sale of your primary home if you’ve lived there for at least 2 of the last 5 years.
Example 3: Cryptocurrency Sale (Short-Term)
Scenario: Alex (single, $90,000 income) buys 2 Bitcoin at $30,000 each ($60,000 total) in April 2023. He sells them for $35,000 each ($70,000 total) in September 2023 with $500 in fees.
| Cost Basis: | $60,000 |
| Net Selling Price: | $70,000 – $500 = $69,500 |
| Capital Gain: | $69,500 – $60,000 = $9,500 |
| Holding Period: | 5 months (short-term) |
| Tax Rate: | 24% (ordinary income rate for $90,000 income) |
| Federal Tax: | $9,500 × 24% = $2,280 |
| State Tax (NY): | $9,500 × 6.85% = $650.75 |
| Total Tax: | $2,280 + $650.75 = $2,930.75 |
Special Cases and Exceptions
1. Inherited Assets
When you inherit an asset, your cost basis is typically the fair market value at the time of the original owner’s death (called “stepped-up basis”). This can significantly reduce capital gains tax.
Example: You inherit stocks worth $100,000 at time of death (original purchase was $20,000). Your cost basis is $100,000. If you sell for $120,000, your taxable gain is only $20,000.
2. Gifted Assets
For gifted assets, you typically take the original owner’s cost basis. If you sell at a loss, special rules apply.
3. Wash Sale Rule
If you sell an investment at a loss and buy the same or a “substantially identical” investment within 30 days before or after, you cannot claim the loss for tax purposes.
4. Collectibles
Art, coins, stamps, and other collectibles have a maximum long-term capital gains rate of 28%, regardless of your income.
5. Small Business Stock (Section 1202)
Qualified small business stock may be eligible for a 50-100% exclusion of capital gains (up to $10 million or 10× your basis).
Strategies to Minimize Capital Gains Tax
-
Hold Investments Long-Term
The difference between short-term (up to 37%) and long-term (0-20%) rates is substantial. Holding investments for at least a year and a day qualifies for long-term rates.
-
Use Tax-Loss Harvesting
Sell losing investments to offset gains. You can deduct up to $3,000 in net capital losses against ordinary income per year, with excess losses carrying forward.
-
Maximize Retirement Accounts
Investments in 401(k)s, IRAs, and other retirement accounts grow tax-deferred or tax-free, avoiding capital gains tax.
-
Consider Opportunity Zones
Investing capital gains in qualified opportunity funds can defer and potentially reduce capital gains tax.
-
Donate Appreciated Assets
Donating appreciated stock to charity avoids capital gains tax and may provide a charitable deduction.
-
Move to a Tax-Friendly State
States like Texas, Florida, and Washington have no state income tax (including no capital gains tax).
-
Use Installment Sales
Spreading the recognition of gain over multiple years may keep you in lower tax brackets.
Common Mistakes to Avoid
- Forgetting to include all costs in your basis: Many taxpayers overlook commissions, fees, and improvement costs that could reduce their taxable gain.
- Misclassifying short-term vs. long-term: The holding period is determined by the trade date, not the settlement date. Selling exactly one year after purchase is still short-term.
- Ignoring state taxes: While federal taxes get most attention, state taxes (especially in high-tax states) can significantly increase your total tax burden.
- Not tracking cost basis properly: For investments made over time (like dollar-cost averaging), you need to track each purchase’s basis separately.
- Overlooking the net investment income tax: High earners (single >$200k, married >$250k) may owe an additional 3.8% tax on net investment income, including capital gains.
- Assuming all capital gains are taxed the same: Different assets (collectibles, small business stock, real estate) have different tax treatments.
- Not considering the alternative minimum tax (AMT): Exercise of incentive stock options can trigger AMT, which may increase your tax liability.
Capital Gains Tax Rates by Income (2023)
| Filing Status | Income Range | Long-Term Capital Gains Rate | Short-Term Capital Gains Rate |
|---|---|---|---|
| Single | $0 – $44,625 | 0% | 10% – 12% |
| $44,626 – $492,300 | 15% | 22% – 32% | |
| $492,301+ | 20% | 35% – 37% | |
| Married Filing Jointly | $0 – $94,050 | 0% | 10% – 12% |
| $94,051 – $553,850 | 15% | 22% – 32% | |
| $553,851+ | 20% | 35% – 37% | |
| Married Filing Separately | $0 – $47,025 | 0% | 10% – 12% |
| $47,026 – $276,900 | 15% | 22% – 32% | |
| $276,901+ | 20% | 35% – 37% | |
| Head of Household | $0 – $59,750 | 0% | 10% – 12% |
| $59,751 – $523,050 | 15% | 22% – 32% | |
| $523,051+ | 20% | 35% – 37% |
Note: These rates don’t include the 3.8% net investment income tax that may apply to high earners.
Frequently Asked Questions
How do I report capital gains on my tax return?
Capital gains are reported on Schedule D (Form 1040) and Form 8949. Your broker should provide you with a Form 1099-B showing your proceeds from sales.
What if I sell at a loss?
Capital losses can offset capital gains. If your losses exceed your gains, you can deduct up to $3,000 against ordinary income ($1,500 if married filing separately). Excess losses carry forward to future years.
Do I pay capital gains tax on my primary home?
Generally no, thanks to the primary home exclusion. Single filers can exclude up to $250,000 of gain, and married couples can exclude up to $500,000, if you’ve lived in the home for at least 2 of the last 5 years.
How are dividends taxed compared to capital gains?
Qualified dividends are taxed at the same rates as long-term capital gains. Non-qualified dividends are taxed as ordinary income (like short-term capital gains).
What’s the difference between realized and unrealized gains?
Unrealized gains are increases in value for assets you still own (not taxed). Realized gains occur when you sell the asset (taxable in that year).
Can I avoid capital gains tax by reinvesting?
Generally no – the “like-kind exchange” (1031 exchange) rules that allowed deferral for real estate were significantly limited by the 2017 tax reform. The only remaining 1031 exchanges are for real property (not personal property).
Authoritative Resources
For official information and updates on capital gains tax rules:
- IRS Topic No. 409 Capital Gains and Losses – Official IRS guidance on capital gains taxation
- IRS Publication 551: Basis of Assets – Detailed rules on determining cost basis
- Tax Policy Center: Capital Gains and Dividends – Analysis from the Urban Institute and Brookings Institution