Calculate Weighted Average Cost of Capital Calculator

Calculate Weighted Average Cost of Capital (WACC) Calculator :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –card-background: #fff; –shadow: 0 2px 5px rgba(0,0,0,0.1); –border-radius: 5px; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; } .container { max-width: 1000px; width: 100%; margin: 20px auto; padding: 20px; background-color: var(–card-background); box-shadow: var(–shadow); border-radius: var(–border-radius); display: flex; flex-direction: column; align-items: center; } header { text-align: center; margin-bottom: 30px; width: 100%; } h1 { color: var(–primary-color); margin-bottom: 10px; } .intro-summary { font-size: 1.1em; color: #555; margin-bottom: 30px; } .calculator-section { width: 100%; background-color: var(–card-background); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–shadow); margin-bottom: 30px; } .calculator-section h2 { color: var(–primary-color); text-align: center; margin-bottom: 25px; } .loan-calc-container { display: flex; flex-direction: column; gap: 20px; } .input-group { display: flex; flex-direction: column; gap: 8px; width: 100%; } .input-group label { font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { padding: 12px 15px; border: 1px solid var(–border-color); border-radius: var(–border-radius); font-size: 1em; width: 100%; box-sizing: border-box; transition: border-color 0.3s ease; } .input-group input[type="number"]:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85em; color: #666; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; min-height: 1.2em; } .button-group { display: flex; justify-content: space-between; gap: 10px; margin-top: 25px; } .button-group button { padding: 12px 20px; border: none; border-radius: var(–border-radius); cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.1s ease; flex: 1; } .button-group .reset-button { background-color: #6c757d; color: white; } .button-group .reset-button:hover { background-color: #5a6268; transform: translateY(-1px); } .button-group .copy-button { background-color: #ffc107; color: #212529; } .button-group .copy-button:hover { background-color: #e0a800; transform: translateY(-1px); } .results-container { background-color: var(–primary-color); color: white; padding: 30px; border-radius: var(–border-radius); margin-top: 25px; text-align: center; box-shadow: inset 0 0 10px rgba(0,0,0,0.2); } .results-container h3 { margin-top: 0; margin-bottom: 15px; font-size: 1.4em; color: #fff; } .primary-result { font-size: 2.5em; font-weight: bold; margin-bottom: 15px; padding: 10px; background-color: rgba(255, 255, 255, 0.2); border-radius: var(–border-radius); display: inline-block; } .intermediate-results { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-bottom: 20px; } .intermediate-result-item { text-align: center; } .intermediate-result-item h4 { margin: 0 0 5px 0; font-size: 1.1em; color: rgba(255, 255, 255, 0.8); } .intermediate-result-item p { margin: 0; font-size: 1.4em; font-weight: bold; } .formula-explanation { font-size: 0.9em; color: rgba(255, 255, 255, 0.8); margin-top: 15px; } .chart-section, .table-section { width: 100%; background-color: var(–card-background); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–shadow); margin-top: 30px; } .chart-section h2, .table-section h2 { color: var(–primary-color); text-align: center; margin-bottom: 25px; } canvas { width: 100% !important; height: 300px !important; background-color: var(–card-background); border-radius: var(–border-radius); border: 1px solid var(–border-color); } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(–border-color); } thead th { background-color: var(–primary-color); color: white; font-weight: bold; } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e9ecef; } .article-section { width: 100%; background-color: var(–card-background); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–shadow); margin-top: 30px; text-align: left; } .article-section h2 { color: var(–primary-color); text-align: left; margin-bottom: 20px; } .article-section h3 { color: var(–primary-color); margin-top: 25px; margin-bottom: 10px; } .article-section p { margin-bottom: 15px; } .article-section ul, .article-section ol { margin-left: 20px; margin-bottom: 15px; } .article-section li { margin-bottom: 8px; } .article-section a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-section a:hover { text-decoration: underline; } .internal-links-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; } .internal-links-list li { background-color: var(–background-color); padding: 15px; border-radius: var(–border-radius); border: 1px solid var(–border-color); box-shadow: 0 1px 3px rgba(0,0,0,0.05); } .internal-links-list a { font-weight: bold; display: block; margin-bottom: 5px; } .internal-links-list p { font-size: 0.9em; color: #555; margin-bottom: 0; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } .button-group { flex-direction: column; } .button-group button { width: 100%; } .intermediate-results { flex-direction: column; } }

Calculate Weighted Average Cost of Capital (WACC) Calculator

Easily determine your company's Weighted Average Cost of Capital (WACC) by inputting key financial metrics. This vital calculation helps in investment appraisal and understanding your firm's overall cost of financing.

WACC Calculator

Total market capitalization of the company's stock.
Total market value of the company's debt.
Enter as a decimal (e.g., 0.12 for 12%).
Enter as a decimal (e.g., 0.05 for 5%).
Enter as a decimal (e.g., 0.21 for 21%).

WACC Calculation Results

Weight of Equity (We)

Weight of Debt (Wd)

After-Tax Cost of Debt

WACC = (E/V) * Re + (D/V) * Rd * (1 – t)
Where V = E + D

WACC Components Breakdown

Contribution of Equity and Debt to WACC.

Key Inputs and Assumptions

Metric Value Unit
Market Value of Equity (E) Currency
Market Value of Debt (D) Currency
Cost of Equity (Re) Decimal (e.g., 0.12)
Cost of Debt (Rd) Decimal (e.g., 0.05)
Corporate Tax Rate (t) Decimal (e.g., 0.21)

What is Weighted Average Cost of Capital (WACC)?

The Weighted Average Cost of Capital (WACC) is a critical financial metric that represents a company's blended cost of capital across all sources, including common stock, preferred stock, bonds, and other forms of debt. Essentially, it is the average rate a company expects to pay to finance its assets. WACC is calculated by taking the weighted average of the cost of each capital component. It is a fundamental tool for financial analysis, project evaluation, and determining a company's overall valuation. Understanding your WACC is crucial for making sound investment decisions and strategic financial planning. Many companies use WACC to discount future cash flows when performing discounted cash flow (DCF) analysis, thereby determining the present value of their future earnings.

Who Should Use the WACC Calculator?

The WACC calculator is an indispensable tool for a wide range of finance professionals and business stakeholders, including:

  • Corporate Financial Analysts: To assess the feasibility of new projects and investments. If a project's expected return exceeds the WACC, it's generally considered a worthwhile investment.
  • Investment Bankers: For valuation purposes and advising clients on capital structure.
  • Portfolio Managers: To evaluate the risk and return profile of potential investments.
  • Business Owners and Executives: To understand the overall cost of their company's financing and make strategic decisions about raising capital.
  • Academics and Students: For learning and applying corporate finance principles.

Common Misconceptions about WACC

Several misconceptions surround WACC. One common error is confusing the market value of debt with its book value; WACC should use market values as they reflect current economic conditions. Another is neglecting the tax shield on debt; the cost of debt is tax-deductible, which reduces its effective cost, a factor accurately captured by the (1-t) term in the formula. Furthermore, WACC is not static; it fluctuates with market conditions, interest rates, and the company's risk profile. It's also important to note that WACC is specific to a company's current capital structure and risk; it cannot be directly applied to projects with significantly different risk profiles without adjustments.

WACC Formula and Mathematical Explanation

The Weighted Average Cost of Capital (WACC) formula provides a comprehensive view of a company's cost of financing. It combines the cost of equity and the after-tax cost of debt, weighted by their respective proportions in the company's capital structure.

The WACC Formula:

The standard formula for WACC is:

WACC = (E/V) * Re + (D/V) * Rd * (1 – t)

Step-by-Step Derivation and Variable Explanations:

Let's break down each component of the Weighted Average Cost of Capital calculation:

  1. Calculate Total Capital (V): This is the sum of the market value of equity (E) and the market value of debt (D).

    V = E + D

  2. Calculate Weight of Equity (We): This is the proportion of the company's total capital that is financed by equity.

    We = E / V

  3. Calculate Weight of Debt (Wd): This is the proportion of the company's total capital that is financed by debt.

    Wd = D / V

    Note: We + Wd should always equal 1 (or 100%).

  4. Determine Cost of Equity (Re): This is the return shareholders require for investing in the company's stock. It's often calculated using models like the Capital Asset Pricing Model (CAPM).
  5. Determine Cost of Debt (Rd): This is the current market rate of interest the company pays on its debt. It reflects the risk of lending to the company.
  6. Incorporate the Tax Shield: Interest payments on debt are typically tax-deductible. This reduces the effective cost of debt. The after-tax cost of debt is calculated as Rd * (1 – t), where 't' is the corporate tax rate.
  7. Calculate the Weighted Average: Multiply the weight of each capital component by its respective cost and sum them up.

    WACC = We * Re + Wd * Rd * (1 – t)

Variables Table:

Variable Meaning Unit Typical Range
E Market Value of Equity Currency (e.g., USD, EUR) Varies widely by company size
D Market Value of Debt Currency (e.g., USD, EUR) Varies widely by company size
V Total Market Value of Capital Currency (e.g., USD, EUR) E + D
Re Cost of Equity Percentage (Decimal) 0.08 – 0.20 (8% – 20%)
Rd Cost of Debt Percentage (Decimal) 0.03 – 0.08 (3% – 8%)
t Corporate Tax Rate Percentage (Decimal) 0.15 – 0.35 (15% – 35%)
WACC Weighted Average Cost of Capital Percentage (Decimal) Typically between Re and Rd*(1-t)

The WACC calculated is a vital input for many financial decisions, especially when considering a capital budgeting project.

Practical Examples (Real-World Use Cases)

Let's illustrate the Weighted Average Cost of Capital (WACC) with practical examples:

Example 1: A Large, Publicly Traded Technology Company

Scenario: "TechInnovate Inc." is considering a new R&D project. They need to know their WACC to evaluate the project's potential return.

Inputs:

  • Market Value of Equity (E): $150,000,000
  • Market Value of Debt (D): $50,000,000
  • Cost of Equity (Re): 15% (0.15)
  • Cost of Debt (Rd): 6% (0.06)
  • Corporate Tax Rate (t): 25% (0.25)

Calculation:

  • Total Capital (V) = $150M + $50M = $200,000,000
  • Weight of Equity (We) = $150M / $200M = 0.75
  • Weight of Debt (Wd) = $50M / $200M = 0.25
  • After-Tax Cost of Debt = 0.06 * (1 – 0.25) = 0.06 * 0.75 = 0.045
  • WACC = (0.75 * 0.15) + (0.25 * 0.045)
  • WACC = 0.1125 + 0.01125
  • WACC = 0.12375 or 12.38%

Interpretation: TechInnovate Inc.'s WACC is 12.38%. Any new project undertaken by the company should ideally generate a return higher than this percentage to create value for shareholders. This WACC is a key figure for their valuation methods.

Example 2: A Smaller Manufacturing Firm

Scenario: "ManuCorp Ltd." is seeking to expand its production capacity and needs to understand its cost of capital.

Inputs:

  • Market Value of Equity (E): $30,000,000
  • Market Value of Debt (D): $20,000,000
  • Cost of Equity (Re): 12% (0.12)
  • Cost of Debt (Rd): 7% (0.07)
  • Corporate Tax Rate (t): 20% (0.20)

Calculation:

  • Total Capital (V) = $30M + $20M = $50,000,000
  • Weight of Equity (We) = $30M / $50M = 0.60
  • Weight of Debt (Wd) = $20M / $50M = 0.40
  • After-Tax Cost of Debt = 0.07 * (1 – 0.20) = 0.07 * 0.80 = 0.056
  • WACC = (0.60 * 0.12) + (0.40 * 0.056)
  • WACC = 0.072 + 0.0224
  • WACC = 0.0944 or 9.44%

Interpretation: ManuCorp Ltd.'s WACC is 9.44%. This rate represents the minimum return the company must earn on its investments to satisfy its investors. It's a key benchmark for their financial modeling and strategic decisions.

How to Use This WACC Calculator

Our WACC calculator is designed for simplicity and accuracy. Follow these steps to determine your company's Weighted Average Cost of Capital:

Step-by-Step Instructions:

  1. Gather Your Financial Data: You will need the following information for your company:
    • Market Value of Equity (E): This is your company's total market capitalization (stock price multiplied by the number of outstanding shares).
    • Market Value of Debt (D): This is the current market value of all your company's interest-bearing debt (bonds, loans, etc.).
    • Cost of Equity (Re): The expected rate of return required by equity investors. You might calculate this using CAPM or consult financial data providers. Enter it as a decimal (e.g., 12% is 0.12).
    • Cost of Debt (Rd): The current market interest rate your company pays on its debt. Enter it as a decimal (e.g., 5% is 0.05).
    • Corporate Tax Rate (t): Your company's marginal corporate income tax rate. Enter it as a decimal (e.g., 21% is 0.21).
  2. Input the Values: Enter each piece of data into the corresponding field in the calculator. Ensure you use the correct decimal format for percentages.
  3. Observe the Results: As you enter valid numbers, the calculator will automatically update the results in real-time. You will see:
    • The primary result: Your company's WACC.
    • Intermediate results: The Weight of Equity (We), Weight of Debt (Wd), and the After-Tax Cost of Debt.
  4. Understand the Formula: A clear explanation of the WACC formula is provided below the results for your reference.
  5. Review the Chart and Table: The dynamic chart visually breaks down the WACC components, and the table summarizes your input assumptions, providing a clear overview of the data used in the calculation.
  6. Reset or Copy: Use the "Reset" button to clear all fields and start over with default placeholders. Use the "Copy Results" button to copy all calculated values and key inputs to your clipboard for use in reports or spreadsheets.

How to Read Results and Make Decisions:

The calculated WACC represents the minimum required rate of return for new projects or investments to be considered profitable and value-enhancing for shareholders. If a proposed project is expected to yield returns significantly above the WACC, it's likely a good investment. Conversely, if the expected returns are below the WACC, the project may destroy shareholder value and should be reconsidered. WACC is a crucial benchmark in your investment appraisal techniques.

Key Factors That Affect WACC Results

Several dynamic factors can influence a company's Weighted Average Cost of Capital (WACC). Understanding these elements is crucial for accurate calculation and strategic financial management.

  1. Market Interest Rates:

    Changes in prevailing market interest rates directly impact the cost of debt (Rd). When interest rates rise, new debt becomes more expensive, increasing Rd and consequently WACC. Conversely, falling rates reduce the cost of debt and WACC.

  2. Company Risk Profile (Beta and Credit Rating):

    The perceived riskiness of a company affects both the cost of equity (Re) and the cost of debt (Rd). A higher beta (indicating higher stock volatility relative to the market) increases Re. A lower credit rating (due to higher financial risk) increases Rd. Both lead to a higher WACC.

  3. Capital Structure (Weights of Debt and Equity):

    The proportion of debt versus equity in the company's capital mix (E/V and D/V) significantly alters WACC. As a company takes on more debt (increasing Wd), its WACC may initially decrease due to the tax deductibility of interest. However, excessive debt increases financial risk, eventually raising both Rd and Re, thus increasing WACC.

  4. Taxation Policies:

    The corporate tax rate (t) directly affects the after-tax cost of debt. A higher tax rate makes the debt tax shield more valuable, reducing the effective cost of debt and lowering WACC. Changes in tax laws can therefore influence a company's WACC.

  5. Market Conditions and Economic Outlook:

    Broader economic factors, such as inflation expectations, investor sentiment, and overall market stability, influence both Re and Rd. In uncertain economic times, investors may demand higher returns (higher Re and Rd), driving up WACC.

  6. Company Performance and Profitability:

    Strong, consistent profitability and stable cash flows can improve a company's creditworthiness (lowering Rd) and signal lower risk to equity investors (potentially lowering Re). Conversely, poor performance increases risk and WACC.

  7. Cost of Equity Estimation Method:

    The method used to calculate the cost of equity (e.g., CAPM) involves its own assumptions (e.g., risk-free rate, market risk premium). Variations in these inputs or the chosen model can lead to different Re values and thus impact the final WACC calculation.

Frequently Asked Questions (FAQ) about WACC

Q1: What is the ideal WACC for a company?
There isn't a single "ideal" WACC. The appropriate WACC varies significantly by industry, company size, risk profile, and market conditions. The goal is typically to maintain a WACC that is competitive within its industry and allows the company to undertake profitable projects.
Q2: Should I use book values or market values for E and D?
Always use market values for both Equity (E) and Debt (D). Market values reflect the current economic conditions and investor expectations, which is precisely what WACC aims to represent. Book values are historical costs and do not accurately represent the current cost of capital.
Q3: How is the Cost of Equity (Re) typically determined?
The most common method is the Capital Asset Pricing Model (CAPM), which uses the risk-free rate, the stock's beta, and the expected market return. Other methods include the dividend discount model or building-block approaches.
Q4: Why is the cost of debt adjusted for taxes?
Interest payments on debt are usually tax-deductible for corporations. This tax shield effectively reduces the actual cost of borrowing. The formula 'Rd * (1 – t)' accounts for this tax benefit.
Q5: Can WACC be negative?
No, WACC cannot be negative. The cost of equity (Re) is always positive, and even if the after-tax cost of debt were hypothetically very low, the weighted average with a positive cost of equity would result in a positive WACC.
Q6: How often should WACC be recalculated?
WACC should be recalculated whenever there are significant changes in the company's capital structure, market interest rates, cost of equity, tax rates, or overall risk profile. Annually is a common practice for stable companies, but more frequent recalculations may be necessary for volatile firms or markets.
Q7: What is the relationship between WACC and the hurdle rate?
WACC is often used as the 'hurdle rate' for investment decisions. A hurdle rate is the minimum acceptable rate of return that a project must achieve to be approved. If a project's expected return exceeds the WACC (hurdle rate), it is considered acceptable.
Q8: Does WACC apply to private companies?
Calculating WACC for private companies can be more challenging because their equity is not publicly traded, making market values and cost of equity difficult to determine. Proxies based on comparable public companies or adjusted owner's required returns are often used, but the calculation is less precise than for public firms.

Related Tools and Internal Resources

var chartInstance = null; function validateInput(id, errorId, min, max) { var input = document.getElementById(id); var errorElement = document.getElementById(errorId); var value = parseFloat(input.value); var isValid = true; errorElement.textContent = "; // Clear previous error if (isNaN(value)) { errorElement.textContent = 'Please enter a valid number.'; isValid = false; } else if (value < 0) { errorElement.textContent = 'Value cannot be negative.'; isValid = false; } else if (min !== undefined && value max) { errorElement.textContent = 'Value cannot exceed ' + max + '.'; isValid = false; } input.style.borderColor = isValid ? " : '#dc3545'; return isValid; } function calculateWacc() { var marketValueEquity = parseFloat(document.getElementById('marketValueEquity').value); var marketValueDebt = parseFloat(document.getElementById('marketValueDebt').value); var costOfEquity = parseFloat(document.getElementById('costOfEquity').value); var costOfDebt = parseFloat(document.getElementById('costOfDebt').value); var corporateTaxRate = parseFloat(document.getElementById('corporateTaxRate').value); var validEquity = validateInput('marketValueEquity', 'marketValueEquityError'); var validDebt = validateInput('marketValueDebt', 'marketValueDebtError'); var validCoE = validateInput('costOfEquity', 'costOfEquityError', 0, 1); var validCoD = validateInput('costOfDebt', 'costOfDebtError', 0, 1); var validTax = validateInput('corporateTaxRate', 'corporateTaxRateError', 0, 1); if (!validEquity || !validDebt || !validCoE || !validCoD || !validTax) { document.getElementById('waccResult').textContent = '–'; document.getElementById('weightEquity').textContent = '–'; document.getElementById('weightDebt').textContent = '–'; document.getElementById('afterTaxCostDebt').textContent = '–'; updateTableInputValues('–', '–', '–', '–', '–'); if (chartInstance) { chartInstance.destroy(); chartInstance = null; } return; } var totalValue = marketValueEquity + marketValueDebt; var weightEquity = marketValueEquity / totalValue; var weightDebt = marketValueDebt / totalValue; var afterTaxCostDebt = costOfDebt * (1 – corporateTaxRate); var wacc = (weightEquity * costOfEquity) + (weightDebt * afterTaxCostDebt); document.getElementById('waccResult').textContent = (wacc * 100).toFixed(2) + '%'; document.getElementById('weightEquity').textContent = (weightEquity * 100).toFixed(2) + '%'; document.getElementById('weightDebt').textContent = (weightDebt * 100).toFixed(2) + '%'; document.getElementById('afterTaxCostDebt').textContent = (afterTaxCostDebt * 100).toFixed(2) + '%'; updateTableInputValues( marketValueEquity.toLocaleString(), marketValueDebt.toLocaleString(), (costOfEquity * 100).toFixed(2) + '%', (costOfDebt * 100).toFixed(2) + '%', (corporateTaxRate * 100).toFixed(2) + '%' ); updateChart(weightEquity, weightDebt, costOfEquity, afterTaxCostDebt); } function updateTableInputValues(e, d, re, rd, t) { document.getElementById('tableE').textContent = e; document.getElementById('tableD').textContent = d; document.getElementById('tableRe').textContent = re; document.getElementById('tableRd').textContent = rd; document.getElementById('tableT').textContent = t; } function resetWaccCalculator() { document.getElementById('marketValueEquity').value = '50000000'; document.getElementById('marketValueDebt').value = '20000000'; document.getElementById('costOfEquity').value = '0.12'; document.getElementById('costOfDebt').value = '0.05'; document.getElementById('corporateTaxRate').value = '0.21'; // Clear error messages document.getElementById('marketValueEquityError').textContent = "; document.getElementById('marketValueDebtError').textContent = "; document.getElementById('costOfEquityError').textContent = "; document.getElementById('costOfDebtError').textContent = "; document.getElementById('corporateTaxRateError').textContent = "; // Reset input styles document.getElementById('marketValueEquity').style.borderColor = "; document.getElementById('marketValueDebt').style.borderColor = "; document.getElementById('costOfEquity').style.borderColor = "; document.getElementById('costOfDebt').style.borderColor = "; document.getElementById('corporateTaxRate').style.borderColor = "; calculateWacc(); // Recalculate with reset values } function copyWaccResults() { var waccResult = document.getElementById('waccResult').textContent; var weightEquity = document.getElementById('weightEquity').textContent; var weightDebt = document.getElementById('weightDebt').textContent; var afterTaxCostDebt = document.getElementById('afterTaxCostDebt').textContent; var tableE = document.getElementById('tableE').textContent; var tableD = document.getElementById('tableD').textContent; var tableRe = document.getElementById('tableRe').textContent; var tableRd = document.getElementById('tableRd').textContent; var tableT = document.getElementById('tableT').textContent; var textToCopy = "— WACC Calculation Results —\n\n"; textToCopy += "WACC: " + waccResult + "\n"; textToCopy += "Weight of Equity: " + weightEquity + "\n"; textToCopy += "Weight of Debt: " + weightDebt + "\n"; textToCopy += "After-Tax Cost of Debt: " + afterTaxCostDebt + "\n\n"; textToCopy += "— Key Assumptions —\n"; textToCopy += "Market Value of Equity (E): " + tableE + "\n"; textToCopy += "Market Value of Debt (D): " + tableD + "\n"; textToCopy += "Cost of Equity (Re): " + tableRe + "\n"; textToCopy += "Cost of Debt (Rd): " + tableRd + "\n"; textToCopy += "Corporate Tax Rate (t): " + tableT + "\n"; navigator.clipboard.writeText(textToCopy).then(function() { var copyButton = document.querySelector('.copy-button'); var originalText = copyButton.textContent; copyButton.textContent = 'Copied!'; setTimeout(function() { copyButton.textContent = originalText; }, 1500); }).catch(function(err) { console.error('Failed to copy text: ', err); alert('Could not copy text. Please copy manually.'); }); } function updateChart(weightEquity, weightDebt, costOfEquity, afterTaxCostDebt) { var ctx = document.getElementById('waccChart').getContext('2d'); // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } // Calculate the contribution of each component to WACC var equityContribution = weightEquity * costOfEquity; var debtContribution = (1 – weightEquity) * afterTaxCostDebt; // Using 1-weightEquity as weightDebt chartInstance = new Chart(ctx, { type: 'bar', data: { labels: ['Equity Component', 'Debt Component'], datasets: [{ label: 'Contribution to WACC', data: [equityContribution, debtContribution], backgroundColor: [ 'rgba(0, 74, 153, 0.7)', // Primary color for Equity 'rgba(40, 167, 69, 0.7)' // Success color for Debt ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(40, 167, 69, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, ticks: { callback: function(value) { return (value * 100).toFixed(1) + '%'; } } } }, plugins: { tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || "; if (label) { label += ': '; } if (context.parsed.y !== null) { label += (context.parsed.y * 100).toFixed(2) + '%'; } return label; } } }, legend: { display: true, position: 'top', } } } }); } // Load the Chart.js library dynamically var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js'; script.onload = function() { // Initial calculation and chart rendering on load resetWaccCalculator(); }; document.head.appendChild(script); // Initial calculation on load document.addEventListener('DOMContentLoaded', function() { resetWaccCalculator(); });

Leave a Comment