What this Capital Gains Tax Calculator does
This calculator helps you estimate how much tax you might owe when you sell an investment or property for a profit. You can enter your purchase price, sale price, expenses, loss carryovers, home sale exclusion amount, holding period, filing status, income, and tax rates. The tool then estimates your taxable gain and the tax owed at short-term or long-term rates, plus any state tax you choose to include.
Use it for a quick, educational estimate before you place a trade, sell a rental, or plan a home sale. The actual tax you owe will depend on your full tax situation and current law, so always confirm with a tax professional or official guidance.
What is a capital gain?
A capital gain is the profit you make when you sell a capital asset for more than your cost basis. Common capital assets include stocks, ETFs, mutual funds, bonds, rental property, your primary home, cryptocurrency, and collectibles.
In simple terms:
- You have a capital gain if your net sale proceeds are higher than what you invested, after adjusting for eligible costs and improvements.
- You have a capital loss if your net sale proceeds are lower than your adjusted investment.
Tax rules typically treat capital gains differently from wages or salary. Short-term gains are usually taxed at your ordinary income rate, while long-term gains often benefit from reduced tax rates.
Short-term vs. long-term capital gains
The holding period—how long you held the asset—determines whether your gain is short-term or long-term.
- Short-term capital gain: Asset held for one year or less. Taxed at your ordinary federal income tax rate (the same brackets used for wages).
- Long-term capital gain: Asset held for more than one year. Taxed at reduced long-term capital gains rates (commonly 0%, 15%, or 20% at the federal level, depending on income and filing status).
This calculator lets you indicate the holding period using either:
- Purchase date and sale date, or
- Holding period (years) if you prefer to enter an approximate duration.
If you provide both exact dates and a holding period in years, treat the dates as your primary reference for real tax reporting. The holding period field is provided mainly for planning and what-if analysis.
Core formulas used in the calculator
This calculator follows a simplified version of common capital gains tax formulas. The basic steps are:
- Compute your adjusted basis.
- Compute your net proceeds from the sale.
- Find your capital gain or loss.
- Apply any loss carryovers and home sale exclusion.
- Multiply the taxable gain by your federal and state rates.
Adjusted basis
Your adjusted basis is your original purchase price plus certain purchase expenses and improvements.
In plain notation:
Adjusted basis = Purchase price + Purchase expenses / improvements
Net proceeds
Net proceeds are what you effectively receive after subtracting selling costs such as broker commissions, real estate agent commissions, and transfer fees.
Net proceeds = Sale price - Selling expenses
Capital gain before exclusions
Your preliminary gain (or loss) is:
Taxable gain after adjustments
Next, the calculator subtracts capital loss carryovers and any home sale exclusion amount you enter (for example, up to $250,000 for a qualifying single taxpayer or $500,000 for certain married couples filing jointly on a primary residence, subject to IRS rules).
In simplified form:
Taxable gain = max( 0, Gain - Loss carryover - Home sale exclusion )
Estimated tax owed
Finally, the calculator multiplies the taxable gain by your short-term or long-term federal rate, plus the state rate (if you enter one):
where r is your federal rate (short-term or long-term, as appropriate) and s is your state rate. Rates are entered as percentages in the calculator and converted to decimals in the math.
How to use this Capital Gains Tax Calculator
- Enter purchase information
- Purchase Price: What you originally paid for the asset.
- Purchase expenses/improvements: Include broker commissions on purchase, closing costs on a property, and qualifying capital improvements.
- Purchase date (optional): The date you acquired the asset.
- Enter sale information
- Sale Price: The gross amount you receive when you sell.
- Selling expenses: Broker commissions, listing fees, escrow fees, transfer taxes, and similar costs.
- Sale date (optional): The date you sell the asset.
- Holding period (years): If you do not enter exact dates, you can enter your approximate holding period here. A value at or below one year typically indicates short-term; over one year indicates long-term.
- Adjust for special items
- Capital loss carryover: Prior-year net capital losses you have not yet used on your tax return.
- Home sale exclusion amount: For a qualifying sale of a primary residence, enter the amount of gain you expect to exclude (for example, $250,000 or $500,000, subject to IRS rules).
- Enter filing status and income
- Filing status: Single, Married filing jointly, Married filing separately, or Head of household.
- Taxable income before this sale: Your estimated taxable income from all other sources, which helps you select appropriate federal long-term capital gains brackets if you are comparing rates.
- Specify tax rates
- Short-Term Federal Rate: An estimate of your marginal ordinary income tax rate.
- Long-Term Federal Rate: An estimate of your long-term capital gains rate based on your income and filing status.
- State tax rate: Your state marginal rate on capital gains, if applicable.
- Run the calculation
- Click Calculate to see your estimated taxable gain, total tax, and after-tax proceeds.
- Use Copy Results to keep a record or share the estimate with a financial or tax advisor.
Interpreting your results
When you run the calculation, focus on three key values:
- Taxable capital gain: The portion of your gain that is subject to tax after accounting for basis, expenses, loss carryovers, and any home sale exclusion.
- Estimated total tax: The combined federal (short-term or long-term) and state tax based on the rates you entered.
- Estimated after-tax proceeds: The amount you keep after paying the estimated tax.
If the calculator shows a negative gain, that means you have a capital loss. In many cases, capital losses can offset capital gains and, to a limited extent, other income, but the rules depend on your situation. This tool lets you see how prior-year loss carryovers might reduce tax on your current sale.
You can also use the tool to compare scenarios:
- Change the holding period from less than one year to more than one year to see the difference between short-term and long-term rates.
- Adjust the state rate to compare moving or selling while living in a different state.
- Modify the loss carryover field to see how fully using losses affects your tax bill.
Worked example
Suppose an investor buys a stock position for $12,000 and pays $50 in brokerage fees. Two years later, she sells all of the shares for $20,000 and pays $100 in selling commissions. She has a $2,000 capital loss carryover from previous years. She lives in a state that taxes capital gains at 5%. Her long-term federal capital gains rate is 15% based on her income and filing status.
Step-by-step:
- Adjusted basis
- Purchase price: $12,000
- Purchase expenses: $50
- Adjusted basis = $12,000 + $50 = $12,050
- Net proceeds
- Sale price: $20,000
- Selling expenses: $100
- Net proceeds = $20,000 - $100 = $19,900
- Capital gain before exclusions
- Gain = $19,900 - $12,050 = $7,850
- Apply loss carryover
- Loss carryover: $2,000
- Home sale exclusion: $0 (not a primary residence)
- Taxable gain = $7,850 - $2,000 = $5,850
- Compute tax
- Federal long-term rate: 15% (0.15)
- State rate: 5% (0.05)
- Total rate = 0.15 + 0.05 = 0.20 (20%)
- Estimated tax = $5,850 × 0.20 = $1,170
- After-tax proceeds
- Net proceeds: $19,900
- Estimated tax: $1,170
- After-tax proceeds = $19,900 - $1,170 = $18,730
By changing the rates or the holding period in the calculator, the investor can see how much more tax she would pay if the same gain were short-term instead of long-term.
Comparison: short-term vs. long-term capital gains
The table below summarizes some high-level differences between short-term and long-term capital gains treatment in the U.S. federal system. Exact details depend on your filing status, income, and current law.
| Feature |
Short-Term Capital Gains |
Long-Term Capital Gains |
| Holding period requirement |
One year or less |
More than one year |
| Typical federal tax rate |
Ordinary income tax brackets (up to the top marginal rate) |
Preferential 0%, 15%, or 20% brackets for most assets |
| Common examples |
Frequent stock trades, crypto trades within a year |
Long-term investments held for growth, many real estate holdings |
| Impact of taxable income |
Directly uses your ordinary income bracket |
Uses special long-term capital gains brackets based on income and filing status |
| Planning opportunities |
Timing sales to avoid pushing into a higher ordinary bracket |
Waiting to cross the one-year mark, managing income to qualify for lower LTCG brackets |
Limitations and assumptions
This Capital Gains Tax Calculator is designed for simplicity and educational use. It makes several important assumptions:
- Not personalized tax advice: Results are estimates only and do not replace advice from a CPA, EA, or other qualified professional.
- User-supplied tax rates: The calculator relies on the federal and state tax rates you enter. It does not automatically look up current IRS brackets or state rules.
- Single-asset focus: The tool focuses on one sale at a time. It does not automatically net multiple gains and losses across different assets for the same year.
- Simplified state tax treatment: State tax is modeled as a flat percentage applied to your taxable gain. Many states have more complex rules.
- No special asset classes: It does not explicitly model collectibles tax rates, depreciation recapture, Section 1250 property rules, qualified small business stock exclusions, or other specialized regimes.
- No wash sale or straddle rules: For stocks and other securities, the calculator does not apply wash sale rules, constructive sales, or straddle rules that can affect basis and recognized loss.
- No 3.8% Net Investment Income Tax (NIIT): The potential additional 3.8% surtax on net investment income for higher-income taxpayers is not included.
- No Alternative Minimum Tax (AMT): The tool does not compute AMT or interact with AMT rules.
- Home sale exclusion entered manually: For primary residence sales, you must enter the exclusion amount yourself. The calculator does not test your eligibility or automatically cap the exclusion at statutory limits.
- Approximate holding period: If you rely on the holding period in years instead of exact dates, the classification as short-term vs. long-term is approximate for planning scenarios only.
Because tax law changes periodically, numbers and examples may no longer match current rules. Always verify important decisions with up-to-date official sources, such as IRS publications, and with a qualified professional.