How to Calculate the Rate of Simple Interest

Capital Gains Tax Calculator (2024 Estimates)

Estimate your federal tax liability on stock, real estate, or crypto profits.

Stocks / Crypto / Mutual Funds Real Estate (Primary or Investment) Collectibles (Art, Coins, etc.)
Include salary, wages, etc.
Single Married Filing Jointly Head of Household
Less than 1 year (Short Term) More than 1 year (Long Term)

Calculation Results

Total Capital Gain: $0.00
Tax Bracket Type:
Est. Federal Tax Rate: 0%
Est. Tax Owed: $0.00
Net Profit (After Tax): $0.00

*Note: This calculator provides estimates based on 2024 federal tax brackets. State taxes and Net Investment Income Tax (NIIT) may also apply depending on your specific situation.

function calculateCapitalGains() { // Get Input Values var buyPrice = parseFloat(document.getElementById('cgt_buy_price').value); var sellPrice = parseFloat(document.getElementById('cgt_sell_price').value); var income = parseFloat(document.getElementById('cgt_income').value); var status = document.getElementById('cgt_filing_status').value; var duration = document.getElementById('cgt_duration').value; var assetType = document.getElementById('cgt_asset_type').value; // Validation if (isNaN(buyPrice) || isNaN(sellPrice) || isNaN(income)) { alert("Please enter valid numbers for prices and income."); return; } // Basic Gain Calculation var gain = sellPrice – buyPrice; // If Loss or Break Even if (gain 609350) taxRate = 0.37; else if (totalInc > 243725) taxRate = 0.35; else if (totalInc > 191950) taxRate = 0.32; else if (totalInc > 100525) taxRate = 0.24; else if (totalInc > 47150) taxRate = 0.22; else if (totalInc > 11600) taxRate = 0.12; else taxRate = 0.10; } // Simplified 2024 Bracket Logic (Married Joint) else if (status === 'married_joint') { if (totalInc > 731200) taxRate = 0.37; else if (totalInc > 487450) taxRate = 0.35; else if (totalInc > 383900) taxRate = 0.32; else if (totalInc > 201050) taxRate = 0.24; else if (totalInc > 94300) taxRate = 0.22; else if (totalInc > 23200) taxRate = 0.12; else taxRate = 0.10; } // Head of Household else { if (totalInc > 609350) taxRate = 0.37; else if (totalInc > 243700) taxRate = 0.35; else if (totalInc > 191950) taxRate = 0.32; else if (totalInc > 100500) taxRate = 0.24; else if (totalInc > 63100) taxRate = 0.22; else if (totalInc > 16550) taxRate = 0.12; else taxRate = 0.10; } } else { // Long Term Capital Gains Rates (0%, 15%, 20%) taxTypeLabel = "Long Term Capital Gains"; if (status === 'single') { if (income > 518900) taxRate = 0.20; else if (income > 47025) taxRate = 0.15; else taxRate = 0.00; } else if (status === 'married_joint') { if (income > 583750) taxRate = 0.20; else if (income > 94050) taxRate = 0.15; else taxRate = 0.00; } else { // Head of Household if (income > 551350) taxRate = 0.20; else if (income > 63000) taxRate = 0.15; else taxRate = 0.00; } } // NIIT Logic (Net Investment Income Tax) – 3.8% surtax // Thresholds: Single 200k, Married 250k var niitThreshold = (status === 'married_joint') ? 250000 : 200000; var niitTax = 0; if (income > niitThreshold) { niitTax = gain * 0.038; // Note: Simply adding it to the total tax for display } var baseTax = gain * taxRate; var totalTax = baseTax + niitTax; // Adjust effective rate for display if NIIT applies var effectiveRate = (totalTax / gain) * 100; var netProfit = gain – totalTax; // Output Results document.getElementById('cgt_result').style.display = 'block'; document.getElementById('res_total_gain').innerHTML = "$" + gain.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); document.getElementById('res_total_gain').style.color = "#2d3748″; document.getElementById('res_tax_type').innerHTML = taxTypeLabel + (niitTax > 0 ? " + NIIT" : ""); document.getElementById('res_tax_rate').innerHTML = effectiveRate.toFixed(1) + "%"; document.getElementById('res_tax_owed').innerHTML = "$" + totalTax.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); document.getElementById('res_net_profit').innerHTML = "$" + netProfit.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); document.getElementById('res_net_profit').style.color = "#38a169"; }

Understanding Capital Gains Tax

When you sell an asset—whether it's stocks, cryptocurrency, or real estate—for more than you paid for it, the profit is considered a "capital gain." The IRS taxes these gains differently depending on how long you held the asset before selling.

Short-Term vs. Long-Term Capital Gains

The duration of ownership is the most critical factor in calculating your tax bill:

  • Short-Term: Assets held for one year or less. These are taxed as ordinary income, meaning they are added to your salary and wages and taxed at your regular tax bracket (ranging from 10% to 37%).
  • Long-Term: Assets held for more than one year. These benefit from preferential tax rates of 0%, 15%, or 20%, depending on your taxable income.

How the Calculation Works

This calculator determines your estimated tax liability using the following steps:

  1. Determine Cost Basis: We subtract your Purchase Price from your Sale Price to find the Gross Profit.
  2. Apply Tax Brackets: Based on your Annual Taxable Income and Filing Status, we identify your specific tax bracket.
  3. Add Surtaxes: For high-income earners (Single filers over $200k or Married filers over $250k), a Net Investment Income Tax (NIIT) of 3.8% may be applied to the gains.

Example Calculation

Scenario: You bought $10,000 worth of stock and sold it 18 months later for $15,000. Your regular annual income is $80,000, and you file as Single.

  • Gain: $5,000 ($15,000 – $10,000)
  • Status: Long-Term (held > 1 year)
  • Tax Rate: 15% (Based on $80k income)
  • Tax Owed: $750 ($5,000 × 0.15)
  • Net Profit: $4,250

Disclaimer: This calculator is for educational purposes and provides estimates based on 2024 tax tables. Tax laws are complex and subject to change. Please consult a CPA or tax professional for advice regarding your specific financial situation.

Leave a Comment