Calculate the fixed rate for a 2-year vanilla interest rate swap.
Semi-Annual (Standard)
Discount Factor (6m):0.0000
Discount Factor (12m):0.0000
Discount Factor (18m):0.0000
Discount Factor (24m):0.0000
Par Swap Rate:0.00%
How to Calculate a Swap Rate
In the world of fixed income derivatives, the "Swap Rate" refers to the fixed interest rate that a party demands in exchange for the obligation to pay a floating rate (like SOFR or EURIBOR). This is the core component of a "Vanilla" Interest Rate Swap (IRS).
Calculating a swap rate is not as simple as averaging current interest rates. It requires determining a rate that sets the Net Present Value (NPV) of the swap to zero at inception. This means the Present Value (PV) of the expected fixed rate payments must exactly equal the Present Value of the expected floating rate payments.
The Mathematics of the Swap Rate
To calculate the par swap rate manually, financial professionals use a process called "bootstrapping" the yield curve to find Discount Factors (DF) for each payment date. The formula for a generic swap rate (S) is:
S = (1 – DF_final) / Σ (DF_i × Δ_i)
Where:
S: The annualized Par Swap Rate.
DF_final: The discount factor for the final maturity date.
DF_i: The discount factor for each payment period (i).
Δ_i (Delta): The time accrual factor (e.g., 0.5 for semi-annual payments).
Understanding the Inputs
Our calculator above simplifies the complex bootstrapping process by asking for the Zero Rates (Spot Rates) for specific maturities. Here is what these inputs represent:
Zero Rates (Spot Yields)
These are the yields on zero-coupon bonds for the specific timeframes. For a 2-year semi-annual swap, we need the rates for 6 months, 12 months, 18 months, and 24 months. These rates are used to calculate the Discount Factors.
Discount Factors (DF)
The discount factor represents the present value of $1 received at a future date. It is calculated as:
DF = 1 / (1 + r)^t
Where r is the zero rate and t is the time in years.
Example Calculation
Let's assume a steep yield curve environment where short-term rates are lower than long-term rates:
6-Month Rate: 4.00%
12-Month Rate: 4.20%
18-Month Rate: 4.50%
24-Month Rate: 4.80%
The calculator converts these percentages into discount factors. It sums the product of these factors and the time period (0.5 years). Finally, it solves for the fixed rate that balances the equation.
In this scenario, the calculated Par Swap Rate would be approximately 4.77%. This is the rate a corporate treasurer would lock in to hedge against future interest rate volatility.
function calculateSwapRate() {
// 1. Get Inputs by ID
var r6Input = document.getElementById("spotRate6m");
var r12Input = document.getElementById("spotRate12m");
var r18Input = document.getElementById("spotRate18m");
var r24Input = document.getElementById("spotRate24m");
var freqInput = document.getElementById("paymentFreq");
// 2. Parse Inputs
var r6 = parseFloat(r6Input.value);
var r12 = parseFloat(r12Input.value);
var r18 = parseFloat(r18Input.value);
var r24 = parseFloat(r24Input.value);
var dt = parseFloat(freqInput.value); // Delta time (0.5)
// 3. Validation
if (isNaN(r6) || isNaN(r12) || isNaN(r18) || isNaN(r24)) {
alert("Please enter valid numeric Zero Rates for all periods.");
return;
}
// 4. Calculate Discount Factors
// Formula: DF = 1 / (1 + r)^t
// Note: Rates are entered as percentages (e.g. 5.0), so divide by 100
var df6 = 1 / Math.pow((1 + r6/100), 0.5);
var df12 = 1 / Math.pow((1 + r12/100), 1.0);
var df18 = 1 / Math.pow((1 + r18/100), 1.5);
var df24 = 1 / Math.pow((1 + r24/100), 2.0);
// 5. Calculate Swap Rate Formula
// Numerator = 1 – DF_final
var numerator = 1 – df24;
// Denominator = Sum of (DF_i * dt)
// dt is 0.5 for semi-annual
var denominator = (df6 * dt) + (df12 * dt) + (df18 * dt) + (df24 * dt);
var swapRateDecimal = numerator / denominator;
var swapRatePercent = swapRateDecimal * 100;
// 6. Display Results
document.getElementById("df6mResult").innerHTML = df6.toFixed(4);
document.getElementById("df12mResult").innerHTML = df12.toFixed(4);
document.getElementById("df18mResult").innerHTML = df18.toFixed(4);
document.getElementById("df24mResult").innerHTML = df24.toFixed(4);
document.getElementById("finalSwapRate").innerHTML = swapRatePercent.toFixed(3) + "%";
// Show result box
document.getElementById("resultBox").style.display = "block";
}