The Weighted Average Cost of Capital (WACC) is a calculation of a firm's cost of capital in which various sources of capital—common stock, preferred stock, bonds, and other debt—are included, each according to its proportion in the company's capital structure. WACC is used by companies to determine the minimum rate of return required to justify new projects or investments. It represents the blended cost of financing for a company.
Results
function calculateWACC() {
var riskFreeRate = parseFloat(document.getElementById("riskFreeRate").value);
var beta = parseFloat(document.getElementById("beta").value);
var equityMarketReturn = parseFloat(document.getElementById("equityMarketReturn").value);
var costOfDebt = parseFloat(document.getElementById("costOfDebt").value);
var marketValueEquity = parseFloat(document.getElementById("marketValueEquity").value);
var marketValueDebt = parseFloat(document.getElementById("marketValueDebt").value);
var waccResultDiv = document.getElementById("waccResult");
var costOfEquityResultDiv = document.getElementById("costOfEquityResult");
waccResultDiv.innerHTML = "";
costOfEquityResultDiv.innerHTML = "";
if (isNaN(riskFreeRate) || isNaN(beta) || isNaN(equityMarketReturn) || isNaN(costOfDebt) || isNaN(marketValueEquity) || isNaN(marketValueDebt) ||
riskFreeRate < 0 || beta < 0 || equityMarketReturn < 0 || costOfDebt < 0 || marketValueEquity <= 0 || marketValueDebt <= 0) {
waccResultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Calculate Cost of Equity using CAPM: Re = Rf + β * (Rm – Rf)
var costOfEquity = riskFreeRate + beta * (equityMarketReturn – riskFreeRate);
costOfEquityResultDiv.innerHTML = "Cost of Equity (CAPM): " + costOfEquity.toFixed(2) + "%";
// Calculate Total Market Value
var totalMarketValue = marketValueEquity + marketValueDebt;
// Calculate Weights
var weightEquity = marketValueEquity / totalMarketValue;
var weightDebt = marketValueDebt / totalMarketValue;
// Calculate WACC: WACC = E/V * Re + D/V * Rd * (1 – Tc)
// Assuming Tax Rate (Tc) is already factored into Cost of Debt for simplicity in this example.
// If Cost of Debt is pre-tax, a Tax Rate input would be needed.
var wacc = (weightEquity * costOfEquity) + (weightDebt * costOfDebt);
waccResultDiv.innerHTML = "Weighted Average Cost of Capital (WACC): " + wacc.toFixed(2) + "%";
}
.wacc-calculator {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.wacc-calculator h2 {
text-align: center;
margin-bottom: 15px;
color: #333;
}
.wacc-calculator p {
font-size: 0.9em;
color: #555;
line-height: 1.5;
margin-bottom: 20px;
}
.input-section label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.input-section input[type="number"] {
width: calc(100% – 22px); /* Adjust for padding and border */
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
.wacc-calculator button {
display: block;
width: 100%;
padding: 12px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1em;
cursor: pointer;
transition: background-color 0.3s ease;
margin-top: 10px;
}
.wacc-calculator button:hover {
background-color: #0056b3;
}
.result-section {
margin-top: 25px;
padding: 15px;
background-color: #e9ecef;
border-radius: 4px;
border: 1px solid #dee2e6;
}
.result-section h3 {
margin-top: 0;
color: #333;
text-align: center;
}
#waccResult, #costOfEquityResult {
font-size: 1.2em;
font-weight: bold;
color: #28a745; /* Green for positive results */
text-align: center;
margin-top: 10px;
}
#waccResult:empty, #costOfEquityResult:empty {
display: none;
}