Audited ·Last updated 27 Jul 2026·5 citations·Tier 1·0 uses

Capital Gains Tax Calculator

Calculate federal and state capital gains tax. Determine short-term vs long-term rates and net proceeds from asset sales. Free calculator.

Capital Gains Tax Calculator

Original cost basis of the asset
$
Amount received from sale
$
Years asset was held
years
Other taxable income for the year
$
Filing Status
Additional state tax on gains
%
Capital Gain
$50,000.00
Sale price minus purchase price
Federal Capital Gains Tax
$7,500.00
State Capital Gains Tax
$0.00
Total Capital Gains Tax
$7,500.00
Net Proceeds
$142,500.00
Effective Tax Rate
15.00%

Background.

Capital gains tax is the tax on profit from the sale of assets such as stocks, bonds, real estate, and collectibles. The tax rate depends on how long the asset was held and the taxpayer's income level. Assets held for one year or less generate short-term capital gains, which are taxed at ordinary income rates up to 37%. Assets held for more than one year generate long-term capital gains, which benefit from preferential rates of 0%, 15%, or 20%. The long-term rate structure is one of the most significant tax advantages available to investors, rewarding patience with substantially lower tax bills and meaningfully improving after-tax compounded returns over multi-year holding periods.

The long-term capital gains brackets are indexed to inflation and vary by filing status. For 2024, single filers pay 0% on gains if their total taxable income is $47,025 or less, 15% on income between $47,026 and $518,900, and 20% above $518,900. Married couples filing jointly have thresholds roughly double these amounts, with the 0% bracket extending to $94,050. An additional 3.8% Net Investment Income Tax applies to high-income taxpayers with modified adjusted gross income above $200,000 for singles or $250,000 for married couples. Some states also impose their own capital gains taxes, which can add anywhere from 0% to 13.3% depending on the jurisdiction, making location a material factor in after-tax return calculations.

The holding period is measured from the day after purchase to the day of sale. Selling one day before the one-year anniversary results in short-term treatment, which can cost thousands in additional taxes for even modest gains. Taxpayers can offset capital gains with capital losses, using up to $3,000 in net losses against ordinary income per year, with excess losses carried forward indefinitely to future tax years. Real estate investors may defer gains through 1031 exchanges, and homeowners can exclude up to $250,000 ($500,000 for married couples) of gain on the sale of a primary residence under Section 121 of the Internal Revenue Code. This calculator computes federal and state capital gains tax based on holding period, filing status, and income level, enabling investors to model before-and-after tax scenarios for portfolio rebalancing, real estate transactions, and business asset sales.

Understanding capital gains tax is essential for portfolio management, real estate transactions, and business succession planning. Institutional investors model after-tax returns before rebalancing decisions. Retail investors use holding-period strategies to optimize tax outcomes. The Tax Cuts and Jobs Act of 2017 maintained the long-term rate structure but altered ordinary income brackets, indirectly affecting the relative value of long-term treatment. Congress has periodically debated eliminating the preferential rate, which the Congressional Budget Office estimates would raise roughly $150 billion over ten years, though no such legislation has advanced. The Joint Committee on Taxation identifies the capital gains preference as one of the largest tax expenditures in the federal budget.

Taxpayers should consult qualified tax professionals or use specialized software when planning large asset sales, as the interaction between federal and state rates, the NIIT, and alternative minimum tax can produce unexpected outcomes.

What is capital gains tax calculator?

Capital gains tax is a tax on the profit from selling an asset for more than its purchase price. The gain is the difference between the sale price and the cost basis, which includes the original purchase price plus certain improvements and transaction costs. Short-term gains on assets held one year or less are taxed as ordinary income. Long-term gains on assets held more than one year receive preferential tax rates of 0%, 15%, or 20% based on the taxpayer's income.

The tax applies to capital assets, defined broadly under Internal Revenue Code Section 1221 to include property held for investment or personal use, with exceptions for inventory, depreciable business property, and certain copyrights. The unit of taxation is the dollar of gain, but the rate depends on the holding period measured in days. Cost basis adjustments include stock splits, reinvested dividends, return of capital distributions, and depreciation recapture for real estate. Taxpayers must track basis meticulously because an understated basis leads to overstated gain and excess tax. Brokers report basis for covered securities purchased after 2011, but non-covered securities, private equity, real estate, and many alternative assets require manual record-keeping. The IRS can challenge reported basis during an examination, so contemporaneous documentation is critical.

How to use this calculator.

  1. Enter the original purchase price of the asset.
  2. Input the sale price you received or expect to receive.
  3. Specify how long you held the asset in years.
  4. Enter your other taxable income for the year.
  5. Select your tax filing status.
  6. Optionally add your state's capital gains tax rate.
  7. Review the gain type, federal and state tax, net proceeds, and effective rate.

The formula.

Tax = Σ Gᵢ × rᵢ + G × s

The capital gains calculation begins with the gain itself: sale price minus purchase price. This is the gross gain before any adjustments. The taxpayer can increase the cost basis by adding capital improvements, selling costs such as broker commissions, and certain fees. For simplicity, this calculator uses purchase price as the basis; users should add improvements to the purchase price input for accuracy.

The holding period determines whether the gain is short-term or long-term. The IRS defines the holding period as beginning the day after acquisition and ending on the sale date. If this period is 365 days or less, the gain is short-term and taxed at the taxpayer's marginal ordinary income rate. If it exceeds 365 days, the gain is long-term and taxed at the preferential capital gains rates. The day count includes weekends and holidays; leap years do not affect the one-year threshold.

The federal long-term rate is determined by stacking the gain on top of the taxpayer's other taxable income. If the other income is $40,000 and the gain is $20,000, the first $7,025 of gain falls in the 0% bracket, and the remaining $12,975 falls in the 15% bracket. This stacking method means that a gain can be partially taxed at different rates. The calculator implements this tiered logic. State taxes are calculated as a flat percentage of the total gain, though some states have their own tiered systems. Dimensional analysis is consistent: all monetary values in dollars, rates dimensionless, time in years.

Mathematically, if taxable income is I, gain is G, and bracket thresholds are T0 and T1, then the portion taxed at 0% is max(0, min(G, T0 minus I)), the portion at 15% is max(0, min(G minus max(0, T0 minus I), T1 minus max(I, T0))), and the remainder at 20%. This piecewise linear function ensures accurate marginal taxation across all income levels. The effective rate is total tax divided by gain, which is always less than or equal to the highest marginal rate applied.

A worked example.

Example

An investor purchased stock for $100,000 and sold it two years later for $150,000. The capital gain is $150,000 minus $100,000, which equals $50,000. Because the holding period exceeds one year, the gain is classified as long-term. The investor's other taxable income is $75,000, which places them in the 15% long-term capital gains bracket for 2024. Federal tax is calculated as 15% multiplied by $50,000, yielding $7,500. The investor lives in a state with a 5% capital gains tax, adding $2,500. Total tax is $10,000, for an effective rate of 20%. Net proceeds from the sale are $150,000 minus $10,000, which equals $140,000. If the investor had sold one month earlier, after 11 months, the entire gain would be short-term and taxed at the 22% ordinary income rate, producing $11,000 in federal tax alone—a $3,500 difference that illustrates the cost of premature realization. This example demonstrates why tax-aware investors monitor holding periods closely, especially near the one-year anniversary, and why portfolio management systems often flag positions approaching long-term status.

filing Statussingle
state Tax Rate5
sale Price150,000
taxable Income75,000
purchase Price100,000
holding Period Years2

Frequently asked questions.

What is the difference between short-term and long-term capital gains?
Short-term gains apply to assets held one year or less and are taxed at ordinary income rates up to 37%. Long-term gains apply to assets held more than one year and are taxed at preferential rates of 0%, 15%, or 20%. The rate difference can be substantial: a $50,000 gain for a taxpayer in the 24% bracket costs $12,000 if short-term but only $7,500 if long-term. The holding period begins the day after purchase and ends on the sale date, so selling on the 365th day produces short-term treatment while the 366th day qualifies as long-term. This single-day difference can alter tax liability by thousands of dollars. Investors should verify holding periods carefully, especially for securities purchased around weekends or holidays, because settlement dates can shift the acquisition date.
How can I reduce my capital gains tax?
Hold assets for more than one year to qualify for long-term rates. Offset gains with capital losses, which can be carried forward indefinitely if they exceed the annual $3,000 ordinary income limit. Contribute appreciated assets to charity to avoid gain recognition entirely. Use a 1031 exchange for real estate to defer gains into replacement property. Invest in Qualified Opportunity Zones to defer and potentially exclude gains. Harvest tax losses annually to net against gains. Hold assets until death for a stepped-up basis, which resets the cost basis to fair market value at death, eliminating built-in gain for heirs. Each strategy has specific statutory requirements and should be documented carefully. For example, charitable contributions of appreciated stock require holding the asset for more than one year to deduct the full fair market value.
What is the Net Investment Income Tax?
The NIIT is a 3.8% tax on investment income, including capital gains, interest, dividends, and rental income, for taxpayers with modified adjusted gross income above $200,000 for singles or $250,000 for married couples. It applies in addition to regular capital gains tax, meaning the top federal rate on long-term gains can reach 23.8%. The tax was enacted as part of the Affordable Care Act in 2010 and took effect in 2013. It is reported on Form 8960. Taxpayers near the threshold can sometimes reduce MAGI through retirement contributions or charitable donations to avoid the surtax. The NIIT is not indexed to inflation, so more taxpayers cross the threshold each year as nominal incomes rise. Estate and trust thresholds are much lower, at approximately $14,000.
Do I pay capital gains tax on my primary residence?
Homeowners can exclude up to $250,000 of gain ($500,000 for married couples) on the sale of a primary residence if they owned and lived in the home for at least two of the five years before sale. Gains above the exclusion are taxed as capital gains. The exclusion can be used once every two years. Partial exclusions are available for sales due to work relocation, health reasons, or unforeseen circumstances under Treasury regulations. The exclusion is one of the most generous provisions in the tax code and has remained largely unchanged since the Taxpayer Relief Act of 1997. Rental property and second homes do not qualify for this exclusion, though a property that was converted from a primary residence to a rental may qualify for a partial exclusion if the two-year use test was met.
What is a 1031 exchange?
A 1031 exchange, named after Section 1031 of the Internal Revenue Code, allows real estate investors to defer capital gains tax by reinvesting sale proceeds into like-kind property. The deferred gain reduces the basis of the new property. To qualify, the investor must identify replacement property within 45 days and close within 180 days of the sale. A qualified intermediary must hold the proceeds to avoid constructive receipt. Personal residences, inventory, and securities do not qualify. The 2017 Tax Cuts and Jobs Act limited 1031 exchanges to real property only, eliminating personal property eligibility. The replacement property must be of equal or greater value, and any cash boot received is taxable. Deferred gain is recognized when the replacement property is eventually sold without another exchange.
Can I deduct capital losses?
Yes. Capital losses offset capital gains dollar for dollar in the same tax year. If losses exceed gains, up to $3,000 of net losses can be deducted against ordinary income per year. Excess losses carry forward indefinitely and retain their character as short-term or long-term. Losses from personal-use property, such as a primary residence or personal vehicle, are not deductible. The wash sale rule under Section 1091 disallows losses if the same or substantially identical security is repurchased within 30 days before or after the sale. Loss carryforwards are tracked on Form 1040, Schedule D, and can provide significant tax savings over multiple years. Taxpayers with large carryforwards should plan gain realization strategically to absorb the losses efficiently.
How do states tax capital gains?
Some states tax capital gains as ordinary income with no preference for long-term gains. California taxes capital gains at up to 13.3%, the highest state rate in the nation. New York and New Jersey also tax gains as ordinary income. Others have no income tax at all, including Texas, Florida, Nevada, and Washington. State rates range from 0% to 13.3%. The calculator applies a flat state rate for simplicity; taxpayers in states with tiered systems should use their effective state rate. Nine states have no broad-based individual income tax and therefore impose no state capital gains tax. Massachusetts imposes a separate 12% tax on short-term capital gains while taxing long-term gains at 5%. Investors should consider state residency when planning large realizations.
What is cost basis and how do I calculate it?
Cost basis is the original purchase price plus acquisition costs, capital improvements, and selling costs. For stocks, basis includes purchase price plus commissions and fees. For real estate, basis includes the purchase price, closing costs such as title insurance and recording fees, and permanent improvements like a new roof or addition. Reinvested dividends increase basis for mutual funds and dividend reinvestment plans. Return of capital distributions reduce basis. When property is received as a gift, basis generally carries over from the donor, though it may step up if the donor's basis was lower than fair market value at the time of gift. When inherited, basis steps up to fair market value at death under Section 1014. Accurate basis tracking prevents overpayment of tax and is essential if the IRS requests documentation during an examination.

Embed

Quanta Pro

Paid features are coming later.

  • All 313 calculators remain free
  • No billing is enabled
Coming soon