Estimate your 2024 tax liability on investment sales.
Single
Married Filing Jointly
Head of Household
Short Term (Less than 1 year)
Long Term (More than 1 year)
Total Capital Gain:$0.00
Applicable Tax Rate:0%
Estimated Tax Owed:$0.00
Net Profit (After Tax):$0.00
Understanding Capital Gains Tax in 2024
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 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 duration of your ownership is the primary factor in determining your tax rate:
Short-Term Capital Gains: Assets held for one year or less. These are taxed as ordinary income, meaning they are added to your regular salary and taxed according to your standard federal income 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 and filing status.
How Income Affects Your Rate
Unlike ordinary income tax, long-term capital gains tax rates are generally lower to encourage investment. For the 2024 tax year:
0% Rate: Applies if your taxable income is below $47,025 (Single) or $94,050 (Married Filing Jointly).
15% Rate: Applies to income between $47,025 and $518,900 (Single) or $94,050 and $583,750 (Married Filing Jointly).
20% Rate: Applies to income exceeding the 15% bracket thresholds.
Calculating Your Cost Basis
To accurately calculate your gain, you must know your Cost Basis. This is usually the purchase price plus any fees paid (like brokerage commissions or closing costs). If you made improvements to a property, those costs also increase your basis, thereby lowering your taxable gain.
Note: This calculator provides an estimation based on 2024 federal tax brackets. It does not account for the Net Investment Income Tax (NIIT) of 3.8% on high earners or specific state capital gains taxes.
function calculateCapitalGains() {
var purchasePrice = parseFloat(document.getElementById('cgtPurchasePrice').value);
var salePrice = parseFloat(document.getElementById('cgtSalePrice').value);
var income = parseFloat(document.getElementById('cgtIncome').value);
var filingStatus = document.getElementById('cgtFilingStatus').value;
var holdingPeriod = document.getElementById('cgtHoldingPeriod').value;
var resultsDiv = document.getElementById('cgtResults');
// Validation
if (isNaN(purchasePrice) || isNaN(salePrice) || isNaN(income)) {
alert("Please enter valid numbers for Purchase Price, Sale Price, and Income.");
return;
}
var gain = salePrice – purchasePrice;
// If loss, no tax
if (gain <= 0) {
resultsDiv.style.display = "block";
document.getElementById('resGain').innerText = formatMoney(gain);
document.getElementById('resRate').innerText = "0%";
document.getElementById('resTax').innerText = "$0.00";
document.getElementById('resNet').innerText = formatMoney(gain);
return;
}
var taxRate = 0;
var taxAmount = 0;
if (holdingPeriod === 'short') {
// Short Term: Taxed as Ordinary Income
// Using simplified 2024 marginal tax brackets for estimation based on total income
taxRate = getOrdinaryIncomeRate(income, filingStatus);
} else {
// Long Term: Preferential Rates (0%, 15%, 20%)
taxRate = getLongTermRate(income, filingStatus);
}
taxAmount = gain * taxRate;
var netProfit = gain – taxAmount;
// Update DOM
resultsDiv.style.display = "block";
document.getElementById('resGain').innerText = formatMoney(gain);
document.getElementById('resRate').innerText = (taxRate * 100).toFixed(1) + "%";
document.getElementById('resTax').innerText = formatMoney(taxAmount);
document.getElementById('resNet').innerText = formatMoney(netProfit);
}
function getLongTermRate(income, status) {
// 2024 Long Term Capital Gains Brackets
if (status === 'single') {
if (income <= 47025) return 0;
if (income <= 518900) return 0.15;
return 0.20;
} else if (status === 'married_joint') {
if (income <= 94050) return 0;
if (income <= 583750) return 0.15;
return 0.20;
} else if (status === 'head_household') {
if (income <= 63000) return 0;
if (income <= 551350) return 0.15;
return 0.20;
}
return 0.15; // Fallback
}
function getOrdinaryIncomeRate(income, status) {
// Simplified 2024 Ordinary Income Marginal Rates (Standard Brackets)
// This estimates the marginal rate the gains would fall into
var brackets = [];
if (status === 'single') {
brackets = [11600, 47150, 100525, 191950, 243725, 609350];
} else if (status === 'married_joint') {
brackets = [23200, 94300, 201050, 383900, 487450, 731200];
} else if (status === 'head_household') {
brackets = [16550, 63100, 100500, 191950, 243700, 609350];
}
if (income <= brackets[0]) return 0.10;
if (income <= brackets[1]) return 0.12;
if (income <= brackets[2]) return 0.22;
if (income <= brackets[3]) return 0.24;
if (income <= brackets[4]) return 0.32;
if (income <= brackets[5]) return 0.35;
return 0.37;
}
function formatMoney(amount) {
return "$" + amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}