You bought Apple stock for $3,000 five years ago and just sold it for $8,500. You're excited about the $5,500 profit-until you realize the IRS wants a cut. A capital gains tax calculator shows exactly how much tax you owe on that gain, depending on whether it's short-term or long-term holding.
What This Calculator Does
A capital gains tax calculator computes the federal tax you owe on the profit from selling stocks, real estate, or other investments. It distinguishes between short-term gains (assets held less than one year, taxed as ordinary income) and long-term gains (assets held more than one year, taxed at preferential rates of 0%, 15%, or 20%). You input your purchase price, sale price, holding period, and income level. The calculator shows your gain, applicable tax rate, and total tax liability.
How to Use This Calculator
Step 1: Enter your purchase price (basis). This is what you originally paid for the asset, including any commissions or fees that are part of your cost basis.
Step 2: Enter your sale price. This is the gross proceeds before any fees or taxes. If you sold 100 shares for $85 each, that's $8,500.
Step 3: Specify your holding period. Did you own the asset for more or less than one year? This determines whether gains are short-term or long-term. Short-term is taxed as regular income. Long-term gets preferential rates.
Step 4: Enter your filing status and total income. Long-term capital gains rates depend on your tax bracket and total income. A married person in the 22% bracket might qualify for the 15% long-term rate, while someone in the 37% bracket might face the 20% rate.
Step 5: Calculate. The calculator shows your gain, applicable tax rate, and total federal tax owed.
The Formula Behind the Math
Capital gains tax calculation depends on holding period and tax bracket.
Gain calculation (simple):
Gain = Sale Price - Purchase Price (Basis)
Short-term capital gains tax:
Tax = Gain × Your Marginal Tax Rate
Short-term gains are taxed as ordinary income at your marginal rate (10%, 12%, 22%, 24%, 32%, 35%, or 37%).
Long-term capital gains tax (2024):
Worked example: You bought 100 shares of stock for $3,000 (basis) and sold for $8,500 (sale price) after holding 18 months. You're single with total taxable income of $95,000.
If you'd held the stock for only 11 months instead, it would be short-term. Your marginal income tax rate is likely 22%, so the tax would be $5,500 × 0.22 = $1,210—$385 more in taxes. That's the power of the one-year holding period.
Our calculator does this comparison instantly-but now you understand how timing of the sale matters significantly.
Planning When to Sell Investments to Minimize Tax
Regina has invested for 25 years and has a stock position with a $40,000 gain. She planned to sell it next month, which would be 11 months of holding (short-term). Her marginal tax rate is 24%, so the short-term tax would be $9,600. But if she waits one month, the gain becomes long-term and she qualifies for the 15% rate. Her tax drops to $6,000—a $3,600 savings for waiting 30 days. The capital gains tax calculator makes this planning obvious.
Managing Multiple Stock Sales in the Same Year
David sold three stock positions in one year. Sale 1: $2,000 gain (long-term). Sale 2: $8,500 gain (short-term). Sale 3: $3,200 gain (long-term). His total gains are $13,700. Using the capital gains calculator, he discovers the short-term portion ($8,500) is taxed at his ordinary income rate (24%), while the long-term portion ($5,200) is taxed at the preferential 15% rate. His total tax is about $2,310. If he could have deferred the short-term sale into next year, his tax would drop to about $1,515. The calculator shows the value of timing sales strategically.
Understanding Inherited Basis and Long-term Gains
When Claire's aunt passed away, she inherited a rental property worth $500,000 that had a cost basis of only $200,000 (so the original owner's gain was $300,000). But under the "stepped-up basis" rule, Claire's new basis becomes the fair market value at death: $500,000. If Claire sells immediately for $500,000, she has zero gain and zero tax-even though her aunt had never paid the tax on the $300,000 gain. This inherited basis advantage is one of the most significant wealth-transfer tax benefits. The capital gains calculator shows why timing is irrelevant for inherited assets (you're already at the stepped-up basis).
Evaluating Whether to Sell or Hold a Losing Investment
Marcus has 200 shares of a stock he bought for $6,000. It's now worth $4,500—a $1,500 loss. He's considering selling to eliminate the position. Using the capital gains calculator in reverse, he realizes he'd have a capital loss instead of a gain. Capital losses can be deducted against capital gains dollar-for-dollar, and up to $3,000 of losses can be deducted against ordinary income per year. The remaining loss carries forward. Depending on his other gains and income, selling the loss might actually reduce his overall tax burden. The calculator helps him evaluate this trade-off.
Tips and Things to Watch Out For
Capital gains tax rates changed and will change again. The rates discussed here are accurate for 2024 and are indexed for inflation annually. Always verify current-year rates when planning sales. Congress could change rates anytime. Plan conservatively if you have flexibility on timing.
State and local taxes compound your burden. Federal capital gains tax is one layer. Most states also tax capital gains (California at up to 13.3%, New York at up to 10.9%). Some cities add local taxes. Your total tax might be 30%+ for long-term gains, or 45%+ for short-term gains in high-tax states. The calculator shows federal only-add your state's rate for the true total.
The one-year holding period is a bright-line rule. If you've held an asset for 364 days, it's short-term. On day 366, it's long-term. There's no gradual transition. If you're close to the one-year mark, waiting a week or two can save thousands in tax. Plan accordingly.
Collectibles and certain assets have higher rates. Art, gold, and certain other collectibles are taxed at a maximum 28% long-term rate, not the standard 20%. These are exceptions. Make sure you understand what you're selling.
Mutual fund distributions are often taxed as capital gains. Even if you didn't sell, mutual funds that distribute their gains to you trigger capital gains tax. You own the gain even though you didn't trigger the sale. This surprises many investors.
Wash-sale rules prevent tax-loss harvesting abuse. If you sell a stock at a loss and buy the same or "substantially identical" stock within 30 days (before or after the sale), the IRS disallows the loss. If you're harvesting losses, stay out of that stock for 31 days to ensure the loss is deductible.
Step-up basis only applies to inherited assets. If you give assets to heirs while alive, they keep your cost basis. The step-up basis only applies at death. This is why the timing of gifts versus inheritance planning matters tremendously.
Frequently Asked Questions
What's the difference between short-term and long-term capital gains?
Short-term gains are on assets held less than one year. They're taxed as ordinary income at your marginal rate (up to 37%). Long-term gains are on assets held over one year. They're taxed at preferential rates: 0%, 15%, or 20% depending on income. Long-term rates are significantly lower, often saving thousands in taxes.
Can I deduct capital losses against my income?
Yes, up to $3,000 per year of net capital losses can be deducted against ordinary income. Losses above $3,000 carry forward to future years indefinitely. This is why tax-loss harvesting is a real strategy for reducing tax liability.
Do I have to report all sales, even if I made no gain?
Technically, yes. You report the transaction. If you sold for less than you bought it for, you have no gain (or a loss). A loss can actually be valuable for tax purposes, so it's worth reporting even if you made no money.
What happens if I die with unrealized gains?
Your heirs get a "step-up basis" to the fair market value at your death. If you bought stock for $10,000 and it's worth $60,000 when you die, your heirs' basis becomes $60,000. If they sell immediately, there's no gain and no tax. This is one of the most significant estate tax advantages.
Are capital gains from real estate treated the same as stocks?
Yes, the same holding period rules apply. Short-term is taxed as ordinary income. Long-term qualifies for the preferential 0%, 15%, or 20% rates. However, real estate sales might trigger the Net Investment Income Tax (3.8% on high earners) or other rules. Consult a tax professional for real estate specifics.
What if I have capital losses but no gains-can I still deduct them?
Yes. You can deduct up to $3,000 of net capital losses against ordinary income per year. Any losses above $3,000 carry forward indefinitely to future years. Many people stockpile losses to deduct against future gains or income.
Related Calculators
Our income tax calculator shows your overall federal tax situation. The investment return calculator helps you evaluate the gross returns before tax. The retirement calculator incorporates tax considerations for long-term planning. The 401k calculator shows tax-advantaged growth where capital gains don't trigger immediate tax. And our rental property calculator handles capital gains on real estate specifically.