Capital Gains Tax Calculator

Calculate your tax liability on investment profits quickly and accurately

$
$
$
Capital Gain Amount
Net Capital Gain (after losses)
Federal Tax Rate Applied
Federal Capital Gains Tax
State Income Tax
Total Tax Owed
Effective Tax Rate
Net Proceeds (after tax)

What is Capital Gains Tax?

Capital gains tax is a tax on the profit you make when you sell an investment asset for more than you paid for it. Whether you sell stocks, real estate, cryptocurrency, or other valuable assets, the difference between your selling price and your original purchase price (known as your cost basis) is considered a capital gain. The U.S. Internal Revenue Service (IRS) taxes these profits, and the amount you owe depends on several factors including how long you held the asset and your income level.

Capital gains are divided into two categories: short-term and long-term. Short-term capital gains are profits from assets held for one year or less, while long-term capital gains come from assets held for more than one year. This distinction is crucial because long-term capital gains typically receive preferential tax treatment with lower tax rates compared to short-term gains.

How Capital Gains Tax Works

The calculation of capital gains tax involves several steps. First, you determine your capital gain by subtracting your cost basis from the sale price. Your cost basis includes not only the original purchase price but can also include commissions, fees, and improvements you made to the asset. Next, you can offset your capital gains with any capital losses from other investment sales during the same year. This loss harvesting strategy can significantly reduce your tax liability.

After calculating your net capital gain, the tax rate applied depends on whether your gains are short-term or long-term. Short-term gains are taxed as ordinary income at your regular tax bracket rates, which can be as high as 37% for high earners. Long-term capital gains, however, benefit from preferential rates: 0% for lower-income taxpayers, 15% for most middle and upper-middle-income taxpayers, and 20% for the highest earners. Additionally, high-income earners may be subject to a 3.8% Net Investment Income Tax (NIIT) on capital gains.

Formula Breakdown with Real Numbers

Let's work through a practical example. Suppose you purchased 100 shares of a technology stock at $500 per share ($50,000 total) two years ago. You recently sold all shares at $750 per share for a total of $75,000. Your capital gain is $75,000 - $50,000 = $25,000.

Since you held the stock for more than one year, this qualifies as a long-term capital gain. If you're in the 24% ordinary tax bracket, your long-term capital gains tax rate is 15%. Your federal tax on this $25,000 gain would be $25,000 × 0.15 = $3,750. If you live in California, you'd also owe state income tax on the capital gain. California taxes capital gains as ordinary income, so at a 9.3% state rate, you'd owe $25,000 × 0.093 = $2,325 in state tax. Your total tax would be $3,750 + $2,325 = $6,075, leaving you with $75,000 - $6,075 = $68,925 in net proceeds.

Alternatively, consider a short-term scenario. If you had sold the same stock after holding it for only 6 months instead of 2 years, your gain would still be $25,000, but the tax treatment would be different. Short-term gains are taxed as ordinary income, so at the 24% bracket, you'd owe $25,000 × 0.24 = $6,000 in federal tax alone, plus the same California state tax of $2,325, totaling $8,325. This demonstrates how the holding period significantly impacts your total tax liability.

Short-Term vs. Long-Term Capital Gains

The distinction between short-term and long-term capital gains is one of the most important concepts in tax planning. The IRS defines assets held for one year or less as generating short-term capital gains, which are taxed at your marginal tax rate—the same rate applied to your ordinary income. For someone in the 37% tax bracket, a short-term capital gain could be taxed at 37%, which is substantially higher than the 20% long-term rate they'd pay if they waited just a few more days to sell.

Long-term capital gains receive preferential treatment for a reason: the government incentivizes long-term investment to encourage economic growth and capital formation. The long-term rates—0%, 15%, or 20% depending on income level—are significantly lower than ordinary income tax rates. For most people, this means a long-term capital gain is taxed at roughly half the rate of a short-term gain.

Understanding Your Tax Bracket Impact

Your tax bracket plays a dual role in capital gains taxation. For short-term gains, your bracket determines the rate directly—the same bracket used for your salary and other ordinary income. For long-term gains, your bracket determines which preferential rate you qualify for. If your ordinary income plus your long-term capital gain would push you into a higher bracket, you may pay the higher long-term rate on part of your gain.

For example, if you're single with $45,000 in ordinary income (putting you in the 22% bracket) and you realize a $30,000 long-term capital gain, your total income would be $75,000. In 2024, this would push $15,000 of your gain into the 24% bracket's long-term rate (15% for long-term), while the remaining $15,000 stays in the 22% bracket's long-term rate (also 15% in this case). Understanding these nuances helps in timing asset sales and managing your annual income.

Capital Loss Offsets and Harvesting

One powerful tax strategy is capital loss harvesting. If you have investment losses from other sales during the year, you can use those losses to offset your capital gains dollar-for-dollar. This means if you have a $25,000 long-term gain and a $10,000 long-term loss, your net capital gain is only $15,000. This strategy alone could save you $1,500 in federal taxes at the 15% long-term rate.

If your capital losses exceed your capital gains in a given year, you can deduct up to $3,000 of net capital loss against your ordinary income, with any remaining losses carried forward to future years indefinitely. This makes tax-loss harvesting particularly valuable for investors with significant losses, as it can offset other income and reduce your overall tax burden.

State and Local Taxes

Don't forget that federal taxes are only part of your capital gains tax picture. Many states impose additional income tax on capital gains. Some states, like Texas, Florida, and Washington, have no state income tax at all, making them particularly attractive for investors. Others, like California, treat capital gains as ordinary income and tax them at rates up to 13.3%. New York taxes long-term capital gains at rates up to 8.82%. These state taxes can substantially increase your total tax bill and should factor into your investment and location decisions.

Net Investment Income Tax (NIIT)

High-income earners should be aware of the 3.8% Net Investment Income Tax (NIIT), which applies to the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds certain thresholds ($250,000 for married filing jointly, $200,000 for single filers). This tax applies to long-term capital gains, dividends, interest, and other passive investment income. For a high-income investor, the combined federal long-term capital gains rate plus NIIT could reach 23.8%.

Common Mistakes to Avoid

A frequent mistake is failing to keep accurate records of cost basis, particularly when you've reinvested dividends or received stock from inheritance, gifts, or mergers. The IRS requires documentation of your original purchase price and any adjustments. Another error is selling appreciated assets in a way that triggers short-term gains when a slight delay would have qualified them as long-term. Some investors also forget to account for state taxes, leading to unpleasant surprises when tax time arrives.

Many people overlook the opportunity to harvest losses to offset gains. Additionally, some don't realize that inherited assets receive a stepped-up basis, meaning if someone inherits stock worth $100,000 that was originally purchased for $20,000, the heirs' cost basis is $100,000, and they owe no capital gains tax if they sell immediately. Finally, failing to distinguish between active trading (which generates ordinary income) and investment (which generates capital gains) can result in paying higher taxes than necessary.

Planning Tips for Capital Gains Tax Efficiency

To minimize your capital gains tax liability, consider timing your asset sales strategically. If you're near the end of the year and have both gains and losses, selling losers can offset your winners. Consider your current and anticipated income—if you expect lower income next year, postponing capital gains until then might save you money. For long-term holdings, waiting that crucial extra day to reach the one-year mark can cut your federal tax rate roughly in half.

Diversify your tax liability across multiple years when possible. If you have a large gain and flexibility in timing, splitting the sale across two tax years might keep you in a lower tax bracket overall. Consider the impact on other tax benefits—large capital gains can affect your eligibility for education credits, healthcare subsidies, and other income-based deductions. Finally, work with a tax professional to understand strategies like opportunity zones, which defer and potentially eliminate capital gains taxes for certain investments.

Frequently Asked Questions

What's the difference between short-term and long-term capital gains?
Short-term capital gains are profits from assets held one year or less and are taxed as ordinary income at your tax bracket rate (up to 37%). Long-term capital gains are from assets held over one year and receive preferential rates: 0%, 15%, or 20% depending on your income. This difference can mean saving significantly on taxes by holding investments slightly longer.
Can I use capital losses to offset my capital gains?
Yes, capital losses offset capital gains dollar-for-dollar. If you have losses exceeding gains, you can deduct up to $3,000 against ordinary income annually, with excess losses carried forward indefinitely. This strategy, called tax-loss harvesting, is an effective way to reduce your overall tax liability while rebalancing your portfolio.
Do I owe capital gains tax if I inherited stock or real estate?
No, you don't owe capital gains tax on inherited assets immediately. Inherited assets receive a stepped-up basis, meaning your cost basis is the asset's fair market value on the date of death. If you sell immediately after inheriting, you typically owe no capital gains tax on the inherited value.
Are cryptocurrency gains taxed the same way as stock gains?
Yes, the IRS treats cryptocurrency gains the same as stock gains: short-term gains are taxed as ordinary income, and long-term gains (assets held over one year) receive preferential long-term rates. Each crypto transaction, including exchanges between cryptocurrencies, is a taxable event. It's important to track all transactions carefully for accurate reporting.
What is the Net Investment Income Tax (NIIT)?
The NIIT is an additional 3.8% tax on capital gains and other investment income for high earners with modified adjusted gross income over $200,000 (single) or $250,000 (married filing jointly). This tax can push combined federal capital gains tax rates to 23.8% for the highest earners, so it's crucial to factor into tax planning.