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
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.
- Enter the original purchase price of the asset.
- Input the sale price you received or expect to receive.
- Specify how long you held the asset in years.
- Enter your other taxable income for the year.
- Select your tax filing status.
- Optionally add your state's capital gains tax rate.
- Review the gain type, federal and state tax, net proceeds, and effective rate.
The formula.
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.
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.
Frequently asked questions.
What is the difference between short-term and long-term capital gains?
How can I reduce my capital gains tax?
What is the Net Investment Income Tax?
Do I pay capital gains tax on my primary residence?
What is a 1031 exchange?
Can I deduct capital losses?
How do states tax capital gains?
What is cost basis and how do I calculate it?
References& sources.
- [1]IRS (2024). Publication 544: Sales and Other Dispositions of Assets.
- [2]IRS (2024). Publication 523: Selling Your Home.
- [3]IRS (2023). Rev. Proc. 2023-34: Inflation Adjustments for 2024.
- [4]IRS (2024). Topic No. 409: Capital Gains and Losses.
- [5]Tax Foundation (2023). State Individual Income Tax Rates and Brackets.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled