How to use the capital gains calculator
- Enter the purchase price and any purchase fees, and the sale price and selling costs. Use totals for the whole position, not per share.
- Enter the date acquired and date sold. The tool decides whether the gain is short term or long term from the dates.
- Enter the tax rates that apply to you for short term and long term gains. The values shown are only examples.
- Open the advanced options if you want to add another tax rate, such as state tax, or offset the gain with losses, then read the tax and your cash after tax.
Formula
Cost basis = purchase price + purchase fees
Net proceeds = sale price - selling costs
Gain = net proceeds - cost basis
Tax = (gain - other losses) x (rate + other tax rate), for a positive gain
A holding of more than one year counts as long term, so a sale on the first anniversary is still short term and one day later is long term. The rates are values you enter. The tool does not look up brackets.
Worked example
A position bought on March 15, 2023 for $10,000 plus $100 in fees is sold on June 15, 2026 for $15,000 less $150 in costs. The cost basis is $10,100 and the net proceeds are $14,850, so the gain is $4,750.
The holding period is 1,188 days, which is long term. At a 15% long term rate the tax is $712.50, leaving a gain of $4,037.50 after tax and $14,137.50 in cash.
If the same position had been sold on December 1, 2023, after 261 days, the 24% short term rate would apply and the tax would be $1,140.
Short term and long term gains
In the United States, gains on assets held for one year or less are generally taxed at ordinary income rates, and gains on assets held longer are taxed at lower long term rates for most people. The line is more than one year, which is why the dates matter. The exact rules for special assets, such as collectibles or some real estate, are different.
What counts in your cost basis
Your basis is generally what you paid plus the costs of acquiring the asset, such as commissions and closing costs. Selling costs reduce your proceeds. Reinvested dividends, stock splits, inherited property and improvements to real estate can all change basis, and this tool uses only the numbers you enter.
Losses
If the sale is at a loss the tool shows no tax. A net capital loss can often offset gains from other sales and, within limits, other income. Other losses you enter in the advanced options reduce the taxable gain on this sale, but it does not apply the annual limits or carryover rules.
Assumptions and limits
- Tax rates are the ones you enter. The defaults are examples and not a statement of current law.
- The tool does not model tax brackets, filing status, the net investment income tax, wash sale rules, depreciation recapture or the exclusion on a main home.
- Holding period is measured from the date acquired to the date sold using calendar dates.
- This is an estimate for planning and not tax advice. Ask a tax professional or use official forms for filing.
Frequently asked questions
How long do I have to hold an asset for the long term rate?
More than one year. A sale on the one year anniversary is still short term, and the day after it is long term. Enter your two dates and the tool applies this for you.
Do fees reduce my capital gain?
Generally yes. Purchase fees add to your cost basis and selling costs reduce your proceeds, and both make the gain smaller. Enter them in the fee fields.
What if I sold at a loss?
The tool shows the loss and no tax. A capital loss can often be used against other gains and some other income, subject to limits, which is a question for a tax professional.
Does this work for a house?
It can show the arithmetic, but home sales have special rules, such as an exclusion for a main home and adjustments to basis for improvements. Use it only as a rough check and add those items yourself.