RC Low-Pass Filter Calculator

Enter any two values (Frequency, Resistance, Capacitance) and leave one blank. Choose appropriate units to calculate the missing value.


Hz
kHz
MHz


Ω




F
μF
nF
pF


Note: The cutoff frequency is calculated using f = 1 / (2πRC). Use standard values for best results in real circuits.

function calculateRC() {
const freq = parseFloat(document.getElementById(“freq”).value);
const freqUnit = parseFloat(document.getElementById(“freqUnit”).value);
const R = parseFloat(document.getElementById(“resistance”).value);
const Runit = parseFloat(document.getElementById(“resUnit”).value);
const C = parseFloat(document.getElementById(“cap”).value);
const Cunit = parseFloat(document.getElementById(“capUnit”).value);
const result = document.getElementById(“rcResult”);

const hasFreq = !isNaN(freq);
const hasR = !isNaN(R);
const hasC = !isNaN(C);

if ([hasFreq, hasR, hasC].filter(Boolean).length !== 2) {
result.textContent = “Please enter any two values and leave one blank.”;
return;
}

if (!hasFreq) {
const f = 1 / (2 * Math.PI * (R * Runit) * (C * Cunit));
result.textContent = “Calculated Frequency = ” + f.toFixed(2) + ” Hz”;
} else if (!hasR) {
const Rcalc = 1 / (2 * Math.PI * (freq * freqUnit) * (C * Cunit));
result.textContent = “Calculated Resistance = ” + Rcalc.toFixed(2) + ” Ω”;
} else if (!hasC) {
const Ccalc = 1 / (2 * Math.PI * (freq * freqUnit) * (R * Runit));
result.textContent = “Calculated Capacitance = ” + Ccalc.toExponential(3) + ” F”;
}
}

function resetRC() {
document.getElementById(“freq”).value = “”;
document.getElementById(“resistance”).value = “”;
document.getElementById(“cap”).value = “”;
document.getElementById(“rcResult”).textContent = “”;
document.getElementById(“freqUnit”).selectedIndex = 0;
document.getElementById(“resUnit”).selectedIndex = 0;
document.getElementById(“capUnit”).selectedIndex = 0;
}


(adsbygoogle = window.adsbygoogle || []).push({});