Average Weighted Cost of Capital Calculator

Average Weighted Cost of Capital (WACC) Calculator body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f8f9fa; color: #333; line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 1000px; margin: 20px auto; padding: 20px; background-color: #ffffff; box-shadow: 0 0 15px rgba(0, 0, 0, 0.1); border-radius: 8px; } header { background-color: #004a99; color: #ffffff; padding: 20px; border-radius: 8px 8px 0 0; text-align: center; margin-bottom: 20px; } header h1 { margin: 0; font-size: 2em; } .calculator-section { margin-bottom: 30px; padding: 25px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fdfdfd; } .calculator-section h2 { color: #004a99; margin-top: 0; border-bottom: 2px solid #004a99; padding-bottom: 10px; margin-bottom: 20px; } .loan-calc-container { display: flex; flex-direction: column; gap: 15px; } .input-group { display: flex; flex-direction: column; gap: 8px; } .input-group label { font-weight: bold; color: #004a99; } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 1em; box-sizing: border-box; width: 100%; } .input-group input[type="number"]:focus, .input-group input[type="text"]:focus, .input-group select:focus { outline: none; border-color: #004a99; box-shadow: 0 0 5px rgba(0, 74, 153, 0.3); } .input-group .helper-text { font-size: 0.85em; color: #666; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; } .button-group { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; } .button-group button { padding: 12px 20px; border: none; border-radius: 5px; font-size: 1em; cursor: pointer; transition: background-color 0.3s ease; font-weight: bold; } #calculateBtn, #resetBtn, #copyBtn { background-color: #004a99; color: #ffffff; } #calculateBtn:hover, #resetBtn:hover, #copyBtn:hover { background-color: #003366; } #resetBtn { background-color: #6c757d; } #resetBtn:hover { background-color: #5a6268; } .results-container { margin-top: 30px; padding: 25px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fdfdfd; } .results-container h2 { color: #004a99; margin-top: 0; border-bottom: 2px solid #004a99; padding-bottom: 10px; margin-bottom: 20px; } .primary-result { background-color: #28a745; color: #ffffff; padding: 15px; border-radius: 5px; text-align: center; margin-bottom: 20px; font-size: 1.8em; font-weight: bold; } .intermediate-results div, .result-explanation { margin-bottom: 15px; font-size: 1.1em; } .intermediate-results span { font-weight: bold; color: #004a99; } .chart-container { margin-top: 30px; padding: 25px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fdfdfd; text-align: center; } .chart-container h2 { color: #004a99; margin-top: 0; border-bottom: 2px solid #004a99; padding-bottom: 10px; margin-bottom: 20px; } canvas { max-width: 100%; height: auto; } .table-container { margin-top: 30px; padding: 25px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fdfdfd; } .table-container h2 { color: #004a99; margin-top: 0; border-bottom: 2px solid #004a99; padding-bottom: 10px; margin-bottom: 20px; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; } th { background-color: #004a99; color: #ffffff; } tr:nth-child(even) { background-color: #f2f2f2; } .article-section { margin-top: 40px; padding: 30px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); } .article-section h2 { color: #004a99; margin-bottom: 15px; border-bottom: 2px solid #004a99; padding-bottom: 5px; } .article-section h3 { color: #0056b3; margin-top: 25px; margin-bottom: 10px; } .article-section p, .article-section ul, .article-section ol { margin-bottom: 15px; } .article-section li { margin-bottom: 8px; } .article-section strong { color: #004a99; } .faq-section { margin-top: 40px; padding: 30px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); } .faq-section h2 { color: #004a99; margin-bottom: 15px; border-bottom: 2px solid #004a99; padding-bottom: 5px; } .faq-item { margin-bottom: 15px; } .faq-item h3 { margin-bottom: 5px; cursor: pointer; color: #0056b3; } .faq-item div { display: none; padding: 10px; background-color: #f9f9f9; border-left: 4px solid #004a99; margin-top: 5px; border-radius: 4px; } .related-links { margin-top: 40px; padding: 30px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); } .related-links h2 { color: #004a99; margin-bottom: 15px; border-bottom: 2px solid #004a99; padding-bottom: 5px; } .related-links ul { list-style: none; padding: 0; } .related-links li { margin-bottom: 10px; } .related-links a { color: #004a99; text-decoration: none; font-weight: bold; } .related-links a:hover { text-decoration: underline; } footer { text-align: center; padding: 20px; margin-top: 40px; font-size: 0.9em; color: #666; } .tooltip { position: relative; display: inline-block; border-bottom: 1px dotted #004a99; cursor: help; } .tooltip .tooltiptext { visibility: hidden; width: 220px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -110px; opacity: 0; transition: opacity 0.3s; font-size: 0.8em; line-height: 1.4; } .tooltip .tooltiptext::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }

Average Weighted Cost of Capital (WACC) Calculator

WACC Calculator Inputs

The expected rate of return on an investment in the company's equity.
The total current market value of the company's outstanding shares.
The effective interest rate the company pays on its debt.
The total current market value of the company's outstanding debt.
The company's effective corporate income tax rate.

Calculation Results

$0.00%
Weight of Equity: 0.00%
Weight of Debt: 0.00%
After-Tax Cost of Debt: 0.00%

Formula Used: WACC = (E/V * Re) + (D/V * Rd * (1 – Tc))

Where: E = Market Value of Equity, D = Market Value of Debt, V = E + D, Re = Cost of Equity, Rd = Cost of Debt, Tc = Corporate Tax Rate.

Capital Structure Composition

This chart visually represents the proportion of equity and debt in your company's capital structure.

Key Input Summary

Input Value Unit
Cost of Equity 12.50 %
Market Value of Equity 100,000,000 $
Cost of Debt 6.00 %
Market Value of Debt 50,000,000 $
Corporate Tax Rate 25.00 %

What is Average Weighted Cost of Capital (WACC)?

The Average Weighted Cost of Capital (WACC), often referred to as the weighted average cost of capital, is a crucial 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's the average rate of return a company is expected to pay to all its security holders to finance its assets. WACC is widely used in financial modeling and corporate finance to discount future cash flows when valuing a business or project, and to assess the feasibility of potential investments. A lower WACC indicates that a company is more efficient at managing its capital, while a higher WACC suggests a higher risk or less efficient capital structure. Understanding your company's WACC is fundamental for making sound strategic financial decisions.

Who Should Use It?

The WACC is primarily used by:

  • Corporate Finance Professionals: To evaluate potential investment projects, mergers, and acquisitions. It serves as the hurdle rate against which project returns are measured.
  • Investors: To assess the risk associated with a company's stock and to compare different investment opportunities.
  • Financial Analysts: To determine the intrinsic value of a company through discounted cash flow (DCF) analysis.
  • Management Teams: To understand the overall cost of financing and to guide capital allocation strategies.

Common Misconceptions

  • WACC is Static: WACC is not a fixed number; it fluctuates with market conditions, interest rates, company-specific risks, and changes in capital structure.
  • WACC = Required Return: While WACC is often used as the minimum required rate of return for projects, it's the average for the entire firm. Specific projects may have different risk profiles and therefore different required returns.
  • Focus Solely on Debt Cost: WACC considers the cost of ALL capital sources, not just debt. The after-tax cost of debt is used, but equity is a significant component.

WACC Formula and Mathematical Explanation

The formula for calculating the Average Weighted Cost of Capital (WACC) is as follows:

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

Step-by-Step Derivation

  1. Calculate the Total Market Value of Capital (V): This is the sum of the market value of the company's equity (E) and the market value of its debt (D). V = E + D.
  2. Determine the Weight of Equity (E/V): Divide the market value of equity (E) by the total market value of capital (V). This represents the proportion of the company's financing that comes from equity.
  3. Determine the Weight of Debt (D/V): Divide the market value of debt (D) by the total market value of capital (V). This represents the proportion of the company's financing that comes from debt.
  4. Calculate the After-Tax Cost of Debt: The cost of debt (Rd) is typically tax-deductible. Therefore, multiply the cost of debt by (1 – Tc), where Tc is the corporate tax rate. This gives you the net cost of debt after accounting for tax savings.
  5. Calculate the Weighted Cost of Equity: Multiply the weight of equity (E/V) by the cost of equity (Re).
  6. Calculate the Weighted Cost of Debt: Multiply the weight of debt (D/V) by the after-tax cost of debt (Rd * (1 – Tc)).
  7. Sum the Weighted Costs: Add the weighted cost of equity and the weighted cost of debt to arrive at the WACC.

Variable Explanations

Understanding each component is key:

  • E (Market Value of Equity): The total market capitalization of the company. It's calculated by multiplying the current stock price by the number of outstanding shares.
  • D (Market Value of Debt): The total value of all interest-bearing debt, including bonds, loans, and other liabilities that carry an explicit cost.
  • V (Total Market Value of Capital): The sum of the market values of equity and debt (V = E + D). This represents the total market value of the firm's financing.
  • Re (Cost of Equity): The return required by equity investors. This is often estimated using models like the Capital Asset Pricing Model (CAPM).
  • Rd (Cost of Debt): The effective interest rate a company pays on its current debt. This is typically the yield-to-maturity on the company's outstanding bonds or the interest rate on its loans.
  • Tc (Corporate Tax Rate): The company's marginal or effective corporate income tax rate. This is crucial because interest payments on debt are usually tax-deductible, reducing the effective cost of debt.

Variables Table

Variable Meaning Unit Typical Range / Notes
E Market Value of Equity $ > 0 (Positive)
D Market Value of Debt $ >= 0 (Non-negative)
V Total Market Value of Capital $ E + D
Re Cost of Equity % Typically 8% – 20% (Highly company-specific)
Rd Cost of Debt % Typically 3% – 10% (Depends on credit rating and interest rates)
Tc Corporate Tax Rate % Often 21% (US Federal) to 35%+, varies by jurisdiction. Can be lower due to deductions.

Practical Examples (Real-World Use Cases)

Example 1: Tech Startup Seeking Funding

A rapidly growing tech startup, "Innovate Solutions," is planning a new R&D project and needs to determine if it's financially viable. They need to calculate their WACC to set a minimum acceptable rate of return.

  • Market Value of Equity (E): $75,000,000
  • Market Value of Debt (D): $25,000,000
  • Cost of Equity (Re): 15.0%
  • Cost of Debt (Rd): 7.0%
  • Corporate Tax Rate (Tc): 21.0%

Calculation:

  • Total Capital (V) = $75,000,000 + $25,000,000 = $100,000,000
  • Weight of Equity (E/V) = $75,000,000 / $100,000,000 = 0.75 (75%)
  • Weight of Debt (D/V) = $25,000,000 / $100,000,000 = 0.25 (25%)
  • After-Tax Cost of Debt = 7.0% * (1 – 0.21) = 7.0% * 0.79 = 5.53%
  • WACC = (0.75 * 15.0%) + (0.25 * 5.53%)
  • WACC = 11.25% + 1.38% = 12.63%

Interpretation: Innovate Solutions has a WACC of 12.63%. Any new project undertaken must be expected to generate a return greater than 12.63% to add value to the company. This rate reflects the blended risk and cost of their current financing structure.

Example 2: Mature Manufacturing Company

A well-established manufacturing firm, "Durable Goods Inc.," is considering upgrading its production line. They have a stable capital structure and lower borrowing costs.

  • Market Value of Equity (E): $200,000,000
  • Market Value of Debt (D): $100,000,000
  • Cost of Equity (Re): 10.0%
  • Cost of Debt (Rd): 4.5%
  • Corporate Tax Rate (Tc): 28.0%

Calculation:

  • Total Capital (V) = $200,000,000 + $100,000,000 = $300,000,000
  • Weight of Equity (E/V) = $200,000,000 / $300,000,000 = 0.67 (67%)
  • Weight of Debt (D/V) = $100,000,000 / $300,000,000 = 0.33 (33%)
  • After-Tax Cost of Debt = 4.5% * (1 – 0.28) = 4.5% * 0.72 = 3.24%
  • WACC = (0.67 * 10.0%) + (0.33 * 3.24%)
  • WACC = 6.70% + 1.07% = 7.77%

Interpretation: Durable Goods Inc.'s WACC is 7.77%. This relatively lower WACC compared to the tech startup reflects its lower risk profile, stable cash flows, and lower cost of debt. The upgrade project must exceed this 7.77% return threshold to be considered value-adding.

How to Use This Average Weighted Cost of Capital Calculator

Our average weighted cost of capital calculator is designed to be intuitive and provide immediate insights into your company's cost of financing. Follow these simple steps:

Step-by-Step Instructions

  1. Input Cost of Equity (%): Enter the required rate of return for your company's equity investors. This is often derived from models like CAPM.
  2. Input Market Value of Equity ($): Provide the current total market value of your company's outstanding shares (market capitalization).
  3. Input Cost of Debt (%): Enter the current effective interest rate your company pays on its debt obligations.
  4. Input Market Value of Debt ($): Enter the total current market value of your company's outstanding debt.
  5. Input Corporate Tax Rate (%): Enter your company's effective corporate income tax rate.
  6. Click 'Calculate WACC': Once all fields are populated, click the button to see your WACC and key intermediate values.

How to Read Results

  • Primary Result (WACC %): This is the headline figure. It represents your company's overall cost of capital. A lower percentage generally indicates a lower risk and a more efficient capital structure.
  • Weight of Equity & Weight of Debt: These show the proportion of your company's total capital that comes from equity and debt, respectively. This helps you understand your capital structure.
  • After-Tax Cost of Debt: This highlights the true, net cost of your debt financing after considering the tax benefits of interest deductions.
  • Chart: The Capital Structure Composition chart provides a quick visual of your equity vs. debt mix.
  • Input Summary Table: This table confirms the values you entered, useful for double-checking or for copy-pasting.

Decision-Making Guidance

Use the calculated WACC as a benchmark:

  • Investment Appraisal: Any potential project or investment should aim to generate returns significantly higher than the WACC to ensure it creates shareholder value. Consider adjusting the WACC upwards for riskier projects.
  • Valuation: WACC is a key input in Discounted Cash Flow (DCF) models for valuing businesses.
  • Capital Structure Decisions: Compare your current WACC with potential changes to your capital structure (e.g., taking on more debt if the cost of debt is low and tax benefits are significant). However, increasing debt too much can increase financial risk and negatively impact the cost of equity and debt.

Key Factors That Affect WACC Results

Several dynamic factors influence a company's Average Weighted Cost of Capital:

  1. Market Interest Rates: Changes in prevailing interest rates directly impact the cost of debt (Rd). When benchmark rates rise, new debt issuance becomes more expensive, increasing WACC. Conversely, falling rates lower Rd and potentially WACC.
  2. Company's Credit Rating: A company's creditworthiness significantly affects its borrowing costs. A higher credit rating (e.g., AAA) leads to lower Rd, while a lower rating results in higher borrowing costs, increasing WACC.
  3. Risk Profile of the Company and Industry: Companies operating in volatile industries or with uncertain future cash flows have a higher risk profile. This translates to a higher cost of equity (Re) as investors demand greater compensation for the risk.
  4. Capital Structure Mix (Weights of Debt and Equity): The relative proportions of debt (D/V) and equity (E/V) heavily influence WACC. If debt becomes cheaper relative to equity, increasing its weight can lower WACC, up to a point. However, excessive debt increases financial risk, which can drive up both Re and Rd.
  5. Tax Rates: The corporate tax rate (Tc) directly affects the after-tax cost of debt. A higher tax rate makes the tax shield on debt more valuable, reducing the effective cost of debt and potentially lowering WACC. Changes in tax policy can therefore impact WACC.
  6. Market Conditions and Investor Sentiment: Broader economic conditions and investor confidence play a role. During economic downturns, investors may demand higher returns (higher Re) due to increased perceived risk, thus raising WACC. Conversely, bull markets might see lower required returns.
  7. Company Performance and Profitability: Strong, consistent profitability and stable cash flows reduce perceived risk, potentially lowering the cost of equity (Re). Poor performance can have the opposite effect.

Frequently Asked Questions (FAQ)

What is the difference between WACC and the discount rate?

The discount rate used in financial analysis, particularly for DCF models, is often set equal to the WACC. However, the discount rate should ideally reflect the specific risk of the cash flows being discounted. For projects with a risk profile significantly different from the company's average risk, a risk-adjusted discount rate (which may differ from the overall WACC) should be used.

Can WACC be negative?

Theoretically, WACC cannot be negative because both the cost of equity and the after-tax cost of debt are typically positive. Even if the cost of debt were negative (highly unlikely), the cost of equity would still be positive, ensuring a positive WACC.

How do I find the Market Value of Debt?

For publicly traded debt (like bonds), the market value is determined by the current trading price of the bonds. For privately held debt (like bank loans), the market value is often approximated by its book value, especially if interest rates haven't changed dramatically since issuance or if the debt is short-term.

What if a company has preferred stock?

If a company has preferred stock, the WACC formula needs to be expanded to include it as a separate component. The formula becomes: WACC = (E/V * Re) + (D/V * Rd * (1 – Tc)) + (P/V * Rp), where P is the market value of preferred stock, V is the total value (E+D+P), and Rp is the cost of preferred stock.

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, or tax rates. For strategic planning, it's often recalculated annually or when evaluating major investment decisions.

What is the role of WACC in capital budgeting?

WACC serves as the minimum acceptable rate of return (hurdle rate) for new projects that have a similar risk profile to the company's existing operations. Projects expected to yield returns above the WACC are generally considered value-adding.

Does WACC account for all company risks?

WACC primarily accounts for the systematic risk (market risk) that cannot be diversified away and is reflected in the cost of equity (Re). It also incorporates the cost and tax implications of financial risk from debt. However, specific project risks or unique operational risks might need separate consideration beyond the standard WACC calculation.

How is the Cost of Equity (Re) typically calculated?

The most common method is the Capital Asset Pricing Model (CAPM): Re = Rf + β * (Rm – Rf), where Rf is the risk-free rate, β (beta) is a measure of the stock's volatility relative to the market, and (Rm – Rf) is the market risk premium. Other methods include the Dividend Discount Model.

© 2023 Your Company Name. All rights reserved.

var chartInstance = null; // Global variable to hold chart instance function validateInput(id, errorId, minValue, maxValue, isPercentage) { 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) || input.value.trim() === ") { errorElement.textContent = 'This field is required.'; isValid = false; } else if (isPercentage) { if (value 1000) { // Allowing high percentages for illustrative purposes, but usually <100 errorElement.textContent = 'Percentage seems excessively high.'; isValid = false; } } else { // For currency values if (value < 0) { errorElement.textContent = 'Value cannot be negative.'; isValid = false; } } return isValid; } function calculateWACC() { var costOfEquity = parseFloat(document.getElementById('costOfEquity').value); var marketValueOfEquity = parseFloat(document.getElementById('marketValueOfEquity').value); var costOfDebt = parseFloat(document.getElementById('costOfDebt').value); var marketValueOfDebt = parseFloat(document.getElementById('marketValueOfDebt').value); var corporateTaxRate = parseFloat(document.getElementById('corporateTaxRate').value); var allValid = true; allValid &= validateInput('costOfEquity', 'costOfEquityError', 0, 1000, true); allValid &= validateInput('marketValueOfEquity', 'marketValueOfEquityError', 0, Infinity, false); allValid &= validateInput('costOfDebt', 'costOfDebtError', 0, 1000, true); allValid &= validateInput('marketValueOfDebt', 'marketValueOfDebtError', 0, Infinity, false); allValid &= validateInput('corporateTaxRate', 'corporateTaxRateError', 0, 100, true); if (!allValid) { document.getElementById('waccResult').textContent = '$0.00%'; document.getElementById('weightOfEquity').innerHTML = 'Weight of Equity: 0.00%'; document.getElementById('weightOfDebt').innerHTML = 'Weight of Debt: 0.00%'; document.getElementById('afterTaxCostOfDebt').innerHTML = 'After-Tax Cost of Debt: 0.00%'; updateChart(0, 0); // Clear chart updateInputSummary(); return; } var totalMarketValue = marketValueOfEquity + marketValueOfDebt; var weightOfEquity = (marketValueOfEquity / totalMarketValue) * 100; var weightOfDebt = (marketValueOfDebt / totalMarketValue) * 100; var afterTaxCostOfDebt = costOfDebt * (1 – (corporateTaxRate / 100)); var wacc = (weightOfEquity / 100 * costOfEquity) + (weightOfDebt / 100 * afterTaxCostOfDebt); document.getElementById('waccResult').textContent = formatCurrency(wacc) + '%'; document.getElementById('weightOfEquity').innerHTML = 'Weight of Equity: ' + formatPercentage(weightOfEquity) + ''; document.getElementById('weightOfDebt').innerHTML = 'Weight of Debt: ' + formatPercentage(weightOfDebt) + ''; document.getElementById('afterTaxCostOfDebt').innerHTML = 'After-Tax Cost of Debt: ' + formatPercentage(afterTaxCostOfDebt) + ''; updateChart(weightOfEquity, weightOfDebt); updateInputSummary(); } function updateInputSummary() { document.getElementById('summaryCostOfEquity').textContent = parseFloat(document.getElementById('costOfEquity').value).toFixed(2); document.getElementById('summaryMarketValueOfEquity').textContent = formatCurrencyValue(parseFloat(document.getElementById('marketValueOfEquity').value)); document.getElementById('summaryCostOfDebt').textContent = parseFloat(document.getElementById('costOfDebt').value).toFixed(2); document.getElementById('summaryMarketValueOfDebt').textContent = formatCurrencyValue(parseFloat(document.getElementById('marketValueOfDebt').value)); document.getElementById('summaryCorporateTaxRate').textContent = parseFloat(document.getElementById('corporateTaxRate').value).toFixed(2); } function formatCurrency(value) { return value.toFixed(2); } function formatCurrencyValue(value) { return value.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 }); } function formatPercentage(value) { return value.toFixed(2); } function resetDefaults() { document.getElementById('costOfEquity').value = '12.5'; document.getElementById('marketValueOfEquity').value = '100000000'; document.getElementById('costOfDebt').value = '6.0'; document.getElementById('marketValueOfDebt').value = '50000000'; document.getElementById('corporateTaxRate').value = '25'; // Clear errors document.getElementById('costOfEquityError').textContent = "; document.getElementById('marketValueOfEquityError').textContent = "; document.getElementById('costOfDebtError').textContent = "; document.getElementById('marketValueOfDebtError').textContent = "; document.getElementById('corporateTaxRateError').textContent = "; calculateWACC(); // Recalculate with defaults } function copyResults() { var waccResult = document.getElementById('waccResult').textContent; var weightEquity = document.getElementById('weightOfEquity').querySelector('span').textContent; var weightDebt = document.getElementById('weightOfDebt').querySelector('span').textContent; var afterTaxDebt = document.getElementById('afterTaxCostOfDebt').querySelector('span').textContent; var summaryCostOfEquity = document.getElementById('summaryCostOfEquity').textContent; var summaryMarketValueOfEquity = document.getElementById('summaryMarketValueOfEquity').textContent; var summaryCostOfDebt = document.getElementById('summaryCostOfDebt').textContent; var summaryMarketValueOfDebt = document.getElementById('summaryMarketValueOfDebt').textContent; var summaryCorporateTaxRate = document.getElementById('summaryCorporateTaxRate').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: " + afterTaxDebt + "\n\n"; textToCopy += "— Key Assumptions —\n"; textToCopy += "Cost of Equity: " + summaryCostOfEquity + "%\n"; textToCopy += "Market Value of Equity: $" + summaryMarketValueOfEquity + "\n"; textToCopy += "Cost of Debt: " + summaryCostOfDebt + "%\n"; textToCopy += "Market Value of Debt: $" + summaryMarketValueOfDebt + "\n"; textToCopy += "Corporate Tax Rate: " + summaryCorporateTaxRate + "%\n"; navigator.clipboard.writeText(textToCopy).then(function() { alert('Results copied to clipboard!'); }).catch(function(err) { console.error('Could not copy text: ', err); // Fallback for older browsers or environments without navigator.clipboard try { var textArea = document.createElement("textarea"); textArea.value = textToCopy; textArea.style.position = "fixed"; textArea.style.left = "-9999px"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); alert('Results copied to clipboard!'); } catch (e) { alert('Failed to copy. Please copy manually.'); } }); } function updateChart(weightEquity, weightDebt) { var ctx = document.getElementById('capitalStructureChart').getContext('2d'); // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } // Ensure weights are valid numbers before plotting var validWeightEquity = isNaN(weightEquity) || weightEquity < 0 ? 0 : weightEquity; var validWeightDebt = isNaN(weightDebt) || weightDebt a + b, 0); var percentage = ((value / total) * 100).toFixed(2) + '%'; return label + ': ' + percentage; } } } } } }); } // Initial calculation and chart render on load document.addEventListener('DOMContentLoaded', function() { calculateWACC(); // Perform initial calculation // Add event listeners document.getElementById('calculateBtn').addEventListener('click', calculateWACC); document.getElementById('resetBtn').addEventListener('click', resetDefaults); document.getElementById('copyBtn').addEventListener('click', copyResults); // Add input listeners for real-time updates var inputFields = document.querySelectorAll('.loan-calc-container input, .loan-calc-container select'); inputFields.forEach(function(field) { field.addEventListener('input', calculateWACC); }); }); // FAQ Toggle Function function toggleFaq(element) { var content = element.nextElementSibling; if (content.style.display === "block") { content.style.display = "none"; } else { content.style.display = "block"; } }

Leave a Comment