More than 1 year (Long Term)
1 year or less (Short Term)
Please enter valid positive numbers for all fields.
Total Capital Gain:$0.00
Tax Classification:Long Term
Estimated Tax Rate:0%
Estimated Tax Owed:$0.00
Net Profit (After Tax):$0.00
Understanding Capital Gains Tax in 2024
Calculating your potential tax liability on investments is a crucial part of financial planning. Whether you are selling stocks, real estate, or cryptocurrencies, the profit you make is subject to capital gains tax. This calculator helps you estimate your federal tax obligation based on the 2024 tax brackets.
Short-Term vs. Long-Term Capital Gains
The duration for which you hold an asset significantly impacts the tax rate applied to your profit:
Short-Term Capital Gains: Assets held for one year or less. These are taxed as ordinary income, meaning they are added to your regular annual income and taxed at your specific 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, typically 0%, 15%, or 20%, depending on your taxable income and filing status.
2024 Long-Term Capital Gains Tax Brackets
For the 2024 tax year, the income thresholds for long-term capital gains rates are approximately:
0% Rate: Single filers with taxable income up to $47,025; Married couples filing jointly up to $94,050.
15% Rate: Single filers with income between $47,026 and $518,900; Married couples between $94,051 and $583,750.
20% Rate: Single filers with income exceeding $518,900; Married couples exceeding $583,750.
Net Investment Income Tax (NIIT)
High-income earners may also be subject to an additional 3.8% Net Investment Income Tax. This generally applies if your modified adjusted gross income (MAGI) exceeds $200,000 for single filers or $250,000 for married couples filing jointly.
Note: This calculator provides an estimate for federal taxes only. State taxes may also apply depending on where you reside.
function calculateCGT() {
var buyPrice = parseFloat(document.getElementById('cgt_buyPrice').value);
var sellPrice = parseFloat(document.getElementById('cgt_sellPrice').value);
var income = parseFloat(document.getElementById('cgt_income').value);
var status = document.getElementById('cgt_status').value;
var duration = document.getElementById('cgt_duration').value;
var errorMsg = document.getElementById('cgt_error');
var resultsDiv = document.getElementById('cgt_results');
// Validation
if (isNaN(buyPrice) || isNaN(sellPrice) || isNaN(income) || buyPrice < 0 || sellPrice < 0 || income < 0) {
errorMsg.style.display = 'block';
resultsDiv.style.display = 'none';
return;
}
errorMsg.style.display = 'none';
var gain = sellPrice – buyPrice;
var taxOwed = 0;
var taxRateDisplay = "0%";
var classification = "";
// If loss or break even
if (gain <= 0) {
resultsDiv.style.display = 'block';
document.getElementById('res_gain').innerHTML = "$" + gain.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('res_type').innerHTML = "Loss / Break Even";
document.getElementById('res_rate').innerHTML = "0%";
document.getElementById('res_tax').innerHTML = "$0.00";
document.getElementById('res_net').innerHTML = "$" + gain.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
return;
}
// Logic for Short Term (Ordinary Income Proxy)
if (duration === 'short') {
classification = "Short Term (Ordinary Income)";
// Simplified 2024 Federal Brackets for estimation (Single / Married)
// Note: In a real scenario, this would calculate marginal steps.
// For this calculator, we approximate the marginal rate the gain falls into.
var totalIncome = income + gain;
var marginalRate = 0;
if (status === 'married') {
if (totalIncome <= 23200) marginalRate = 10;
else if (totalIncome <= 94300) marginalRate = 12;
else if (totalIncome <= 201050) marginalRate = 22;
else if (totalIncome <= 383900) marginalRate = 24;
else if (totalIncome <= 487450) marginalRate = 32;
else if (totalIncome <= 731200) marginalRate = 35;
else marginalRate = 37;
} else { // Single or Head (approximated to Single for simplicity in this demo)
if (totalIncome <= 11600) marginalRate = 10;
else if (totalIncome <= 47150) marginalRate = 12;
else if (totalIncome <= 100525) marginalRate = 22;
else if (totalIncome <= 191950) marginalRate = 24;
else if (totalIncome <= 243725) marginalRate = 32;
else if (totalIncome = 583750) rate = 0.20;
else if (income >= 94050) rate = 0.15;
else rate = 0;
} else { // Single or Head
if (income >= 518900) rate = 0.20;
else if (income >= 47025) rate = 0.15;
else rate = 0;
}
// NIIT Check (Net Investment Income Tax) 3.8%
// Thresholds: 200k Single, 250k Married
var niitThreshold = (status === 'married') ? 250000 : 200000;
var niitTax = 0;
if (income > niitThreshold) {
niitTax = gain * 0.038;
// Add notation about NIIT
taxRateDisplay = (rate * 100) + "% + 3.8% NIIT";
} else {
taxRateDisplay = (rate * 100) + "%";
}
taxOwed = (gain * rate) + niitTax;
}
var netProfit = gain – taxOwed;
// Output
resultsDiv.style.display = 'block';
document.getElementById('res_gain').innerHTML = "$" + gain.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('res_type').innerHTML = classification;
document.getElementById('res_rate').innerHTML = taxRateDisplay;
document.getElementById('res_tax').innerHTML = "$" + taxOwed.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('res_net').innerHTML = "$" + netProfit.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}