How Do You Calculate Capital Gains Tax in 2027?
Capital gains tax rates for 2027 are 0%, 15%, and 20% for long-term holdings, plus a 3.8% NIIT surcharge. Learn the 2027 brackets, the home sale exclusion, and how to calculate your tax bill.

You bought 200 shares of Apple at $75 in 2021. In 2027 they sit at $240. You want to sell. The gain looks like $33,000. But how much of that do you actually keep after taxes? That depends on how long you held the shares, your income, your filing status, and whether the Net Investment Income Tax applies to you.
Capital gains tax is one of the few taxes you can partially control. The timing of your sale, the assets you choose to sell, and the deductions you stack against the gain all change the final number. This guide walks through the 2027 federal capital gains brackets, the formulas, and real scenarios so you can estimate your bill before you sell.
What Capital Gains Tax Is and Why It Matters
A capital gain is the profit from selling a capital asset: stocks, bonds, real estate, crypto, mutual funds, art, or business property. The IRS splits gains into two categories based on holding period.
Short-term gains come from assets held one year or less. They are taxed as ordinary income, meaning they fall into the same brackets as your salary. The top federal rate is 37% in 2027.
Long-term gains come from assets held more than one year. They qualify for preferential rates of 0%, 15%, or 20%, depending on your taxable income. This is why holding period matters so much. A one-day difference in sale date can move a gain from the 37% short-term bracket to the 15% long-term bracket.
Use our Capital Gains Tax Calculator to estimate your liability before you sell.
The 2027 Long-Term Capital Gains Brackets
The IRS released the 2027 inflation-adjusted brackets in Revenue Procedure 2026-35. These apply to tax year 2027, for returns filed in early 2028.
| Filing status | 0% rate up to | 15% rate band | 20% rate above |
|---|---|---|---|
| Single | $51,050 | $51,051 to $563,200 | $563,200 |
| Married filing jointly | $102,100 | $102,101 to $633,600 | $633,600 |
| Head of household | $68,350 | $68,351 to $598,400 | $598,400 |
Capital gains stack on top of your ordinary income. If your salary puts you at $40,000 of taxable income as a single filer and you realize a $20,000 long-term gain, the first $11,050 of the gain fills the 0% bracket and the remaining $8,950 falls into the 15% bracket.
The 3.8% Net Investment Income Tax
High earners pay an additional 3.8% on investment income, including capital gains. The NIIT applies to the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds the threshold.
| Filing status | 2027 MAGI threshold |
|---|---|
| Single | $200,000 |
| Married filing jointly | $250,000 |
| Married filing separately | $125,000 |
These thresholds are not indexed for inflation. They have stayed the same since 2013, which means more people get caught by the NIIT each year as incomes rise with inflation.
How to Calculate Your Capital Gains Tax
The formula for a capital gain is straightforward:
Gain = Sale price minus Cost basis
Cost basis is what you paid for the asset plus any commissions or fees. If you reinvested dividends, those increase your basis. If you made improvements to a property, those increase basis too.
To calculate the tax:
- Determine your holding period (short or long term).
- Add the gain to your other taxable income.
- Find which bracket the gain falls into based on your filing status.
- Apply the rate to the portion of gain in each bracket.
- Add the 3.8% NIIT if your MAGI exceeds the threshold.
Our Capital Gains Tax Calculator handles all of this automatically. You can also use the Income Tax Calculator to see your total tax picture.
Example 1: Selling Stock as a Single Filer
Marcus is 34, single, and earns $52,000 in salary in 2027. He sells 150 shares of an index fund he bought in 2022 for $8,000. He sells them for $19,500. His cost basis is $8,000.
Gain: $19,500 minus $8,000 = $11,500 (long-term, held over one year)
His 2027 standard deduction as a single filer is $16,600. His taxable income from salary after the standard deduction is $52,000 minus $16,600 = $35,400.
Now the $11,500 long-term gain stacks on top of $35,400, giving $46,900 in taxable income. The 0% bracket covers up to $51,050 for single filers. Since $46,900 is below $51,050, the entire gain falls in the 0% bracket.
Marcus pays $0 in federal long-term capital gains tax on this sale. This is the power of understanding brackets. If his salary had been $60,000 instead, his taxable income would be $43,400 plus $11,500 = $54,900. The first $7,650 of the gain would still be in the 0% bracket (up to $51,050), and the remaining $3,850 would be taxed at 15%, costing $577.50.
Example 2: Selling a Rental Property as a Married Couple
Sarah and James are married filing jointly. Their combined salary is $180,000. They sell a rental condo they bought in 2018 for $210,000. They sell it for $365,000. They made $25,000 in capital improvements over the years, so their adjusted cost basis is $235,000.
Gain: $365,000 minus $235,000 = $130,000 (long-term)
Their 2027 standard deduction is $33,200. Taxable income from salary: $180,000 minus $33,200 = $146,800.
The gain stacks on top: $146,800 plus $130,000 = $276,800. The 0% bracket covers up to $102,100 for MFJ, so $0 of the gain is taxed at 0% (their income already exceeds that threshold). The 15% bracket covers $102,101 to $633,600, so the entire $130,000 gain falls in the 15% bracket.
Tax on the gain: $130,000 x 0.15 = $19,500
Now check the NIIT. Their MAGI including the gain is $310,000, which exceeds the $250,000 MFJ threshold. The NIIT applies to the lesser of net investment income ($130,000) or the excess over the threshold ($60,000). So the NIIT is $60,000 x 0.038 = $2,280.
Total federal tax on the sale: $19,500 plus $2,280 = $21,780.
The Home Sale Exclusion
If you sell your primary residence, you may exclude up to $250,000 of gain as a single filer or $500,000 as a married couple filing jointly. The requirements are:
- You owned and used the home as your principal residence for 2 of the 5 years before the sale.
- You have not used the exclusion on another home sale in the prior 2 years.
These dollar amounts have not changed since 1997. There is a bill in Congress (the More Homes on the Market Act) that would double them to $500,000 and $1,000,000 and index them for inflation, but as of late 2026 it has not passed.
If your gain exceeds the exclusion, the excess is taxed as a long-term capital gain. Use our Mortgage Calculator and Closing Cost Calculator when planning a home sale.
Common Mistakes to Avoid
1. Not tracking cost basis accurately. Reinvested dividends increase your basis. If you forget them, you overpay. Brokerages are now required to report basis, but old holdings may still be on your records at the original purchase price without dividend adjustments.
2. Selling one day too early. If you buy on March 15 and sell on March 14 of the following year, that is 364 days. Short-term. Wait one more day and the same gain drops from ordinary income rates to long-term rates. The difference on a $50,000 gain can be thousands of dollars.
3. Forgetting state taxes. This guide covers federal rates only. Most states also tax capital gains, and a few like California do not offer preferential long-term rates. Check your state rules separately.
4. Ignoring the NIIT. If your income is near $200,000 single or $250,000 MFJ, a large capital gain can push you over the threshold and trigger the 3.8% surcharge on top of the regular capital gains rate.
External Research and Resources
- IRS Revenue Procedure 2026-35 provides the official 2027 tax year inflation adjustments, including capital gains brackets and standard deduction amounts.
- IRS Publication 523: Selling Your Home explains the Section 121 exclusion rules, eligibility, and how to report the sale on your tax return.
- IRS Topic No. 559: Net Investment Income Tax covers who owes the 3.8% NIIT and how to calculate it using Form 8960.
People Also Ask
What is the capital gains tax rate for 2027?
The 2027 long-term capital gains rates are 0%, 15%, and 20%, depending on your taxable income and filing status. Short-term gains (assets held one year or less) are taxed as ordinary income at rates up to 37%.
How do I avoid capital gains tax on stocks?
You can reduce capital gains tax by holding assets over one year for long-term rates, harvesting losses to offset gains, donating appreciated stock to charity, or keeping your taxable income low enough to qualify for the 0% bracket ($51,050 single or $102,100 MFJ in 2027).
How much is the capital gains tax on a home sale?
If you lived in the home for 2 of the past 5 years, you can exclude up to $250,000 of gain (single) or $500,000 (married filing jointly). Any gain above the exclusion is taxed at long-term capital gains rates.
What is the Net Investment Income Tax?
The NIIT is a 3.8% surcharge on investment income, including capital gains, that applies to high earners. It kicks in when your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). These thresholds are not adjusted for inflation.
Do I pay capital gains tax if I reinvest?
Yes. Selling an asset triggers a taxable event even if you immediately reinvest the proceeds. The only exception is a 1031 exchange for investment real estate, which lets you defer the gain by rolling it into another property.
Related Calculators
- Capital Gains Tax Calculator - Estimate your capital gains tax liability
- Income Tax Calculator - Calculate your federal income tax
- Tax Bracket Calculator - Find your 2027 tax bracket
- Property Tax Calculator - Estimate property taxes
- Estate Tax Calculator - Calculate estate tax liability
- Mortgage Calculator - Plan your home purchase
- Closing Cost Calculator - Estimate closing costs
- Investment Calculator - Project investment growth
- ROI Calculator - Calculate return on investment
- Dividend Calculator - Calculate dividend income
Related Articles

What Is the Self-Employment Tax Rate in 2027?
The 2027 self-employment tax rate is 15.3%: 12.4% for Social Security on the first $192,300 and 2.9% for Medicare, plus 0.9% over $200,000. See the real math with examples.

What Is a Good Cap Rate for a Rental Property?
A good cap rate is typically 4% to 10% depending on market and risk. Learn the cap rate formula, how it differs from cash-on-cash return, and the expenses investors forget.

Student Loan Payoff Guide 2027: New Repayment Plans, Forgiveness, and Strategy
The student loan landscape changed dramatically in July 2026. SAVE is gone, RAP replaces it, and IBR is the only legacy IDR plan surviving. Here is how to navigate it.