Capital Gains Tax Calculator
Estimate federal taxes on investment gains based on holding period and income
Educational purposes only. This calculator is for informational purposes and should not be considered financial, tax, or legal advice. Consult a qualified professional for personalized guidance.
Investment Details
Tax Situation
Salary, wages, other income (excluding this gain)
Enter purchase and sale prices to estimate capital gains tax
How This Tool Works
Capital Gains Tax Calculator
Taxation on Investment Profits
When you sell an investment for more than you paid, the profit is a capital gain—and the government takes a portion as tax. The rules governing this taxation are complex: rates differ based on how long you held the investment, your total income, and the type of asset sold. The capital gains tax calculator untangles this complexity, helping you understand the after-tax return on investments before you sell and enabling strategic decisions about timing.
Capital gains tax is one of the few taxes where you have significant control over timing. Unlike income that arrives when employers pay it, you choose when to realize capital gains by choosing when to sell. This control creates planning opportunities—and pitfalls for the unaware. The calculator helps you navigate these decisions strategically.
Understanding capital gains tax transforms investment selling from reactive to strategic.
Short-Term vs. Long-Term Capital Gains
The holding period distinction is the most important factor in capital gains taxation. Assets held one year or less before sale generate short-term capital gains; those held more than one year generate long-term capital gains.
Short-term capital gains are taxed as ordinary income—at your marginal income tax rate. For high earners in the 37% federal bracket, short-term gains face this same 37% rate, plus state taxes where applicable.
Long-term capital gains receive preferential rates. Most taxpayers pay 0%, 15%, or 20% on long-term gains, depending on income level. The 0% rate applies to income up to approximately $44,625 (single) or $89,250 (married filing jointly). The 15% rate covers income up to roughly $492,300 (single) or $553,850 (married jointly). Above these thresholds, the 20% rate applies.
This difference can be dramatic. On a $50,000 gain for a high-income investor, short-term treatment might cost $18,500 in federal tax (37%), while long-term treatment costs $10,000 (20%)—an $8,500 difference for simply waiting past the one-year mark.
The Net Investment Income Tax
High-income investors face an additional 3.8% Net Investment Income Tax (NIIT) on the lesser of net investment income or the amount by which modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).
For investors above these thresholds, the effective long-term capital gains rate becomes 23.8% (20% + 3.8%). This applies on top of any state capital gains taxes.
The calculator incorporates NIIT when your income indicates it applies.
Cost Basis and Gain Calculation
Your capital gain is sale proceeds minus cost basis. Cost basis is what you paid, including commissions and fees, plus any adjustments.
For stocks purchased in a single transaction: Basis = purchase price + purchase commissions. If you bought 100 shares at $50 with a $10 commission, basis is $5,010.
For inherited assets: Basis is typically "stepped up" to fair market value at the decedent's death. This eliminates gains accumulated during the original owner's lifetime—a significant tax benefit.
For gifts: You generally inherit the giver's cost basis. If someone gives you shares they bought at $10 and you sell at $50, you're taxed on $40 per share gain even though you received them at $50.
For mutual funds with reinvested dividends: Each reinvestment creates a new purchase with its own basis. Tracking becomes complex, but failure to include reinvested dividends in basis results in double taxation.
The calculator helps compute cost basis across various acquisition scenarios.
Tax-Loss Harvesting
Capital losses offset capital gains, reducing tax liability. Losses first offset gains of the same character (short-term losses offset short-term gains; long-term offset long-term). Excess losses then offset the other character. If losses still exceed gains, up to $3,000 of net losses can offset ordinary income annually, with remaining losses carried forward to future years.
Strategic tax-loss harvesting involves selling losing positions to realize losses, which offset gains elsewhere in your portfolio. You can repurchase similar (but not "substantially identical") investments to maintain market exposure while capturing the tax benefit.
The wash-sale rule prohibits claiming a loss if you buy a substantially identical security within 30 days before or after the sale. The calculator accounts for losses but can't track wash-sale compliance—that requires careful attention to your transaction timing.
State Capital Gains Taxation
Most states tax capital gains at ordinary income rates, adding to federal tax. Rates vary dramatically—California taxes gains at up to 13.3%, while states like Florida and Texas have no income tax and thus no capital gains tax.
Some states offer preferential long-term rates similar to federal treatment, but this is uncommon. Most simply add state income tax rates on top of federal capital gains taxes.
For high-income investors in high-tax states, combined federal (23.8%) and state (up to 13.3%) rates can approach 37% even on long-term gains—comparable to short-term federal rates alone.
The calculator can incorporate state tax rates for more accurate after-tax return estimates.
Timing Strategies
Waiting to reach long-term status: If you're close to one year of holding, the tax savings from waiting almost always exceed any market risk over a few weeks or months.
Recognizing gains in low-income years: If you expect lower income in retirement, job transitions, or sabbaticals, those years might be optimal for realizing gains at lower rates.
Bunching gains and losses: Realizing gains in years when you also have losses reduces net taxable gains. Some investors harvest losses annually regardless of selling winners.
End-of-year considerations: Selling before year-end means paying tax in April; waiting until after January 1 defers tax by a full year.
The calculator models how different timing affects tax liability, helping evaluate waiting versus selling now.
Special Asset Types
Collectibles (art, coins, antiques): Maximum 28% federal rate on long-term gains, regardless of income. This is higher than the standard 20% maximum.
Real estate: Primary residences qualify for $250,000 exclusion ($500,000 married) if owned and occupied for two of the last five years. Investment properties can use 1031 exchanges to defer gains.
Qualified small business stock (QSBS): May be eligible for complete or partial exclusion of gains under specific conditions.
Cryptocurrency: Treated as property, with standard capital gains treatment. The high volatility of crypto creates both large gains and valuable loss-harvesting opportunities.
Using the Calculator
Enter purchase price, sale price, and holding period. The calculator computes gain, determines short-term or long-term status, and calculates federal tax at appropriate rates.
For portfolio analysis, enter multiple positions to model total capital gains tax across all planned sales.
Include income information to determine rate brackets and whether NIIT applies. Add state tax rates for comprehensive after-tax estimates.
Compare scenarios: selling now versus waiting for long-term treatment, selling in current year versus next, or selling versus holding until death (when heirs receive stepped-up basis).
Capital gains tax takes a portion of investment profits, but the rules offer significant planning opportunities. Understanding holding periods, rate structures, and strategic timing transforms inevitable taxation into optimized taxation. The calculator quantifies these options, enabling investment decisions that consider after-tax returns, not just gross gains.
Related Tools
Gross Pay to Net Pay Calculator
Calculate take-home pay from gross salary including taxes and deductions
Pay Raise Calculator
Calculate raise amounts and percentages
Bonus Tax Calculator
Estimate taxes on your bonus and compare withholding methods
Overtime Pay Calculator
Calculate overtime earnings with time-and-a-half or custom multipliers