Capital Gains Tax Calculator (2024/2025 Estimates)
Includes wages, salary, and other earnings.
Single
Married Filing Jointly
Head of Household
Short Term (Less than 1 year)
Long Term (More than 1 year)
Calculation Results
Total Capital Gain:$0.00
Estimated Federal Tax:$0.00
Net Investment Income Tax (NIIT):$0.00
Estimated State Tax:$0.00
Total Estimated Tax:$0.00
Net Profit (After Tax):$0.00
Understanding Capital Gains Tax
When you sell an asset—such as stocks, real estate, or cryptocurrency—for more than you paid for it, the profit is considered a "capital gain." The Internal Revenue Service (IRS) taxes these profits differently depending on how long you held the asset before selling it and your overall taxable income.
Short-Term vs. Long-Term Capital Gains
The most critical factor in calculating your tax liability is the holding period:
Short-Term Capital Gains: Assets held for one year or less. These are taxed as ordinary income, meaning they are added to your wages and taxed at your regular marginal tax bracket (ranging from 10% to 37%).
Long-Term Capital Gains: Assets held for more than one year. These benefit from preferential tax rates of 0%, 15%, or 20%, depending on your income level.
2024 Long-Term Capital Gains Tax Brackets
For the 2024 tax year (taxes filed in 2025), the long-term capital gains tax rates break down roughly as follows based on taxable income:
Single Filers
0% Rate: Income up to $47,025
15% Rate: Income between $47,026 and $518,900
20% Rate: Income over $518,900
Married Filing Jointly
0% Rate: Income up to $94,050
15% Rate: Income between $94,051 and $583,750
20% Rate: Income over $583,750
Net Investment Income Tax (NIIT)
High earners may be subject to an additional 3.8% Net Investment Income Tax. This applies if your Modified Adjusted Gross Income (MAGI) exceeds:
$200,000 for Single filers
$250,000 for Married Filing Jointly
$125,000 for Married Filing Separately
This calculator estimates this surcharge automatically based on the income entered.
How to Reduce Your Capital Gains Tax
Investors often use strategies like Tax-Loss Harvesting (selling losing assets to offset gains) or holding assets for over a year to qualify for lower long-term rates. Always consult with a certified tax professional (CPA) for advice specific to your financial situation.
function calculateCapitalGains() {
// 1. Get Input Values
var buyPrice = parseFloat(document.getElementById('cgt_purchase_price').value);
var sellPrice = parseFloat(document.getElementById('cgt_sale_price').value);
var income = parseFloat(document.getElementById('cgt_income').value);
var status = document.getElementById('cgt_filing_status').value;
var period = document.getElementById('cgt_holding_period').value;
var stateRate = parseFloat(document.getElementById('cgt_state_tax').value);
// 2. Validate Inputs
if (isNaN(buyPrice) || isNaN(sellPrice) || isNaN(income)) {
alert("Please enter valid numbers for Purchase Price, Sale Price, and Income.");
return;
}
if (isNaN(stateRate)) {
stateRate = 0;
}
// 3. Calculate Base Gain
var gain = sellPrice – buyPrice;
// Display Logic for Results Div
document.getElementById('cgt_results_area').style.display = "block";
// 4. Handle Loss or Zero Gain
if (gain <= 0) {
document.getElementById('res_total_gain').innerText = formatCurrency(gain);
document.getElementById('res_fed_tax').innerText = "$0.00";
document.getElementById('res_niit_tax').innerText = "$0.00";
document.getElementById('res_state_tax').innerText = "$0.00";
document.getElementById('res_total_tax').innerText = "$0.00";
document.getElementById('res_net_profit').innerText = formatCurrency(gain); // You just lost money, net is the loss
return;
}
var fedTax = 0;
var niitTax = 0;
var taxRate = 0;
// 5. Calculate Federal Tax
if (period === 'short') {
// Short Term: Taxed as Ordinary Income
// Simplified Bracket Logic for 2024 (Approximate Marginal Rate based on total income)
// Note: In reality, gain sits on top of income, potentially crossing brackets.
// We will approximate the marginal rate based on the income + gain.
var totalIncome = income + gain;
if (status === 'single') {
if (totalIncome <= 11600) taxRate = 0.10;
else if (totalIncome <= 47150) taxRate = 0.12;
else if (totalIncome <= 100525) taxRate = 0.22;
else if (totalIncome <= 191950) taxRate = 0.24;
else if (totalIncome <= 243725) taxRate = 0.32;
else if (totalIncome <= 609350) taxRate = 0.35;
else taxRate = 0.37;
} else if (status === 'married_joint') {
if (totalIncome <= 23200) taxRate = 0.10;
else if (totalIncome <= 94300) taxRate = 0.12;
else if (totalIncome <= 201050) taxRate = 0.22;
else if (totalIncome <= 383900) taxRate = 0.24;
else if (totalIncome <= 487450) taxRate = 0.32;
else if (totalIncome <= 731200) taxRate = 0.35;
else taxRate = 0.37;
} else { // Head of Household
if (totalIncome <= 16550) taxRate = 0.10;
else if (totalIncome <= 63100) taxRate = 0.12;
else if (totalIncome <= 100500) taxRate = 0.22;
else if (totalIncome <= 191950) taxRate = 0.24;
else if (totalIncome <= 243700) taxRate = 0.32;
else if (totalIncome niitThreshold) {
var excess = magi – niitThreshold;
var taxableNiitAmount = Math.min(gain, excess);
niitTax = taxableNiitAmount * 0.038;
}
// 7. Calculate State Tax
var stateTax = gain * (stateRate / 100);
// 8. Totals
var totalTax = fedTax + niitTax + stateTax;
var netProfit = gain – totalTax;
// 9. Update UI
document.getElementById('res_total_gain').innerText = formatCurrency(gain);
document.getElementById('res_fed_tax').innerText = formatCurrency(fedTax);
document.getElementById('res_niit_tax').innerText = formatCurrency(niitTax);
document.getElementById('res_state_tax').innerText = formatCurrency(stateTax);
document.getElementById('res_total_tax').innerText = formatCurrency(totalTax);
document.getElementById('res_net_profit').innerText = formatCurrency(netProfit);
}
function formatCurrency(num) {
return '$' + num.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
}