# Capital Gains Calculator

Estimate capital gains and the resulting tax impact from selling stocks, property, or other investment assets that you own.

---

- **Canonical URL:** https://dothecalculation.com/calculators/capital-gains-calculator
- **Category:** Financial calculators
- **Publisher:** Do The Calculation (https://dothecalculation.com)
- **Cost:** Free, no account or sign-up required
- **Privacy:** Runs entirely in the browser; inputs are never sent to a server
- **Methodology:** https://dothecalculation.com/methodology

---

## Capital Gains Calculator — Taxable Gain and Net After-Tax Proceeds

Estimate taxable gains, tax liabilities, and net after-tax proceeds from the sale of stocks, real estate, or other appreciated assets.

- Taxable capital gains calculations
- Estimated tax liabilities
- After-tax net cash proceeds

## How Capital Gains Taxes Work

A capital gain is the profit realized when an asset (such as stocks, mutual funds, real estate, or business assets) is sold for more than its original acquisition cost. The tax assessed on this profit is called the capital gains tax.

Calculating capital gains tax requires identifying your **Cost Basis** (usually the original purchase price plus improvements or transaction fees) and subtracting it from your **Net Sales Price** (sales price minus selling commissions).

Tax treatment depends on the asset type and how long you owned it before selling.

## How to Use This Calculator

Enter the sale price of the asset, your cost basis, any selling costs (commissions, closing fees, legal fees), and your estimated tax rate.

The calculator subtracts cost basis and selling costs from the sale price to find the taxable gain, applies your tax rate, and shows the estimated tax owed alongside your net after-tax proceeds and net profit.

## Worked Example: $150,000 Sale, $100,000 Basis

Sale price $150,000, cost basis $100,000, selling costs $5,000, tax rate 15%.

Taxable gain: $150,000 − $100,000 − $5,000 = $45,000.

Estimated tax: $45,000 × 15% = $6,750.

Net profit after tax: $45,000 − $6,750 = $38,250.

Net proceeds (cash in hand): $150,000 − $5,000 − $6,750 = $138,250.

Selling costs and taxes together took $11,750 off the $150,000 sale price — about 7.8% — before the seller ever sees the money, which is why both figures belong in any pre-sale planning estimate.

## The Capital Gains Tax Formula

To calculate taxable gain, tax liabilities, and net after-tax proceeds, the tool applies the following equations:

$$\text{Taxable Gain} = \text{Sale Price} - \text{Cost Basis} - \text{Selling Costs}$$

$$\text{Estimated Tax} = \max(0, \text{Taxable Gain} \times \text{Tax Rate}\%)$$

$$\text{Net Proceeds} = \text{Sale Price} - \text{Selling Costs} - \text{Estimated Tax}$$

$$\text{Net Profit} = \text{Taxable Gain} - \text{Estimated Tax}$$

If the taxable gain is zero or negative (representing a capital loss), the tax liability is treated as zero, and the loss may potentially be used to offset other taxable gains in your tax return.

## Holding Periods: Short-Term vs. Long-Term Gains

In many tax jurisdictions, capital gains are split into two categories based on holding duration:

**Short-Term Capital Gains**: Applied to assets held for **one year or less**. These gains are treated as ordinary income and taxed at your standard federal income tax bracket (up to 37% in the US).

**Long-Term Capital Gains**: Applied to assets held for **more than one year**. These qualify for preferential, lower tax brackets (0%, 15%, or 20% in the US) to encourage long-term investing.

## Real Estate and Capital Gains Exclusions

Real estate sales have special capital gains tax rules. In the US, the **Section 121 Exemption** allows primary homeowners to exclude up to $250,000 (single filers) or $500,000 (married filing jointly) of capital gains from taxation, provided they lived in and owned the home for at least 2 of the 5 years prior to the sale.

## Related Calculators

If you also hold losing positions this year, see whether realizing them first would offset this bill using the [tax loss harvesting calculator](/calculators/tax-loss-harvesting-calculator), or compare the annualized growth rate of the asset with the [CAGR calculator](/calculators/cagr-calculator).

## Frequently asked questions

### What is a capital gain?

A capital gain is the profit earned when you sell an asset (like stock or real estate) for more than its original cost basis.

### How do I calculate my capital gains tax?

Subtract your cost basis and selling costs from the sale price to find the taxable gain, then multiply that gain by your capital gains tax rate.

### What is cost basis?

Cost basis is the total price paid to acquire an asset, including the purchase price plus transaction fees, commissions, and adjustments.

### What is the tax rate for long-term capital gains?

In the US, long-term rates are 0%, 15%, or 20% depending on your taxable income, which is significantly lower than ordinary income tax rates.

### What is a capital loss and how does it help?

A capital loss occurs when you sell an asset for less than its cost basis. You can use capital losses to offset capital gains, and deduct up to $3,000 of ordinary income annually.

### Is primary home sales taxable?

In the US, you can exclude up to $250,000 (single) or $500,000 (married) of capital gains on a primary home sale if you met the 2-out-of-5-years occupancy rules.

### What is the Section 121 exclusion?

A tax rule allowing primary homeowners to exclude a set amount of capital gains from the sale of their principal residence from federal tax.

### Does this calculator apply to short-term gains?

Yes. To model a short-term gain, input your ordinary federal income tax rate into the tax rate field.

### Are selling fees tax-deductible?

Yes. Selling costs (like broker fees, legal fees, and commissions) are subtracted from the sale price, directly reducing your taxable capital gain.

### What is a 1031 exchange?

A 1031 exchange allows real estate investors to defer capital gains taxes by reinvesting the proceeds from a rental property sale into a similar, new investment property.

### What happens if my cost basis is higher than my sale price?

If the sale price is lower than your cost basis plus selling costs, you have a capital loss rather than a gain. This calculator floors the taxable gain at zero in that case — you would separately report the loss on your tax return, where it can offset other gains.

### Does this calculator distinguish between short-term and long-term rates automatically?

No. You enter the tax rate directly, so you control whether the estimate reflects a short-term (ordinary income) rate or a long-term (preferential) rate. Simply enter your applicable rate based on how long you held the asset.

## Related concepts

- **Section 121** — The IRS tax code section allowing capital gains exclusions on primary home sales.
- **Taxable Gain** — The net profit on an asset sale that is subject to tax after subtracting cost basis and expenses.
- **Net Proceeds** — The final cash amount received from a sale after all transaction fees and tax liabilities are paid.
- **Capital Loss** — A loss realized when an asset sells for less than its cost basis, usable to offset other taxable capital gains.

## Related guides

- [Capital Gains Tax Guide: Basis, Selling Costs, and After-Tax Sale Proceeds](https://dothecalculation.com/blog/finance/capital-gains-tax-guide) — Estimate taxable gain more accurately by separating sale price, adjusted basis, selling costs, tax assumptions, and after-tax proceeds.
- [Tax-Advantaged Accounts: 2026 Rules and Comparison](https://dothecalculation.com/blog/finance/tax-advantaged-accounts) — Compare 401(k), IRA, HSA, and 529 tax treatment, review 2026 federal limits, and understand what DTC account calculators assume.

## Related calculators

- [Tax Loss Harvesting Calculator](https://dothecalculation.com/calculators/tax-loss-harvesting-calculator) — Estimate tax savings and loss carryforward amounts by netting capital gains against harvestable investment losses each year.
- [Weighted Average Cost of Capital (WACC) Calculator](https://dothecalculation.com/calculators/wacc-calculator) — Estimate Weighted Average Cost of Capital, after-tax cost of debt, and capital weights to evaluate investment and financing decisions.
- [Estate & Gift Tax Calculator](https://dothecalculation.com/calculators/estate-tax-planning-calculator) — Estimate federal and state estate and gift tax liabilities, applicable exemptions, and net inheritance passed on to heirs.
- [FIRE Calculator](https://dothecalculation.com/calculators/fire-calculator) — Estimate your financial independence number and early retirement timeline based on savings rate and expected investment returns.
- [HSA Tax Savings Calculator](https://dothecalculation.com/calculators/hsa-tax-savings-calculator) — Estimate federal income tax and FICA tax savings from contributing pre-tax dollars to a Health Savings Account each year.
- [Income Tax Calculator](https://dothecalculation.com/calculators/income-tax-calculator) — Estimate your federal income tax liability, applicable deductions, and take-home pay based on income, filing status, and credits.

---

_This tool is for educational purposes only. Asset returns, trading fees, capital gains tax liabilities, dividend payments, and bond yields depend on market conditions, broker commissions, local tax codes (e.g. IRS short vs. long-term classifications), and individual credit/holding terms. Always consult a certified financial planner, licensed CPA, or tax professional before making major investment or liquidation transactions._

---

_Source: [Do The Calculation](https://dothecalculation.com/calculators/capital-gains-calculator). Quote freely with attribution and a link to this page._
