Frequency Rate Calculator
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
margin: 0;
padding: 20px;
background-color: #f9f9f9;
}
.calc-container {
max-width: 800px;
margin: 0 auto;
background: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.calc-header {
text-align: center;
margin-bottom: 30px;
}
.calc-header h1 {
margin: 0;
color: #2c3e50;
}
.input-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 25px;
}
@media (max-width: 600px) {
.input-grid {
grid-template-columns: 1fr;
}
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #555;
}
.form-group input, .form-group select {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 16px;
box-sizing: border-box;
}
.form-group input:focus, .form-group select:focus {
border-color: #3498db;
outline: none;
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}
.btn-calc {
width: 100%;
padding: 15px;
background-color: #3498db;
color: white;
border: none;
border-radius: 6px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s;
}
.btn-calc:hover {
background-color: #2980b9;
}
.results-area {
margin-top: 30px;
padding: 25px;
background-color: #f8f9fa;
border-radius: 8px;
border-left: 5px solid #3498db;
display: none;
}
.result-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #eee;
}
.result-row:last-child {
border-bottom: none;
}
.result-label {
font-weight: 600;
color: #7f8c8d;
}
.result-value {
font-size: 20px;
font-weight: bold;
color: #2c3e50;
}
.main-result {
text-align: center;
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 2px dashed #ddd;
}
.main-result .val {
font-size: 36px;
color: #3498db;
font-weight: 800;
}
.main-result .unit {
font-size: 18px;
color: #7f8c8d;
}
.content-section {
max-width: 800px;
margin: 40px auto;
background: #fff;
padding: 30px;
border-radius: 12px;
}
.content-section h2 {
color: #2c3e50;
border-bottom: 2px solid #ecf0f1;
padding-bottom: 10px;
}
.content-section p, .content-section li {
color: #555;
}
.formula-box {
background: #f1f8ff;
padding: 15px;
border-radius: 6px;
font-family: monospace;
text-align: center;
font-size: 18px;
margin: 20px 0;
}
Calculate Frequency
Period (Time per Cycle):
0 s
Kilohertz (kHz):
0 kHz
Megahertz (MHz):
0 MHz
RPM (Revolutions Per Minute):
0 RPM
How to Calculate Frequency Rate
Frequency represents the rate at which a repeating event occurs per unit of time. In physics, engineering, and mechanics, it is one of the most fundamental metrics used to describe waves, oscillations, and rotations. This calculator helps you determine the frequency ($f$) based on the total number of cycles ($n$) and the total time duration ($t$).
The Frequency Formula
The basic formula for calculating frequency is:
f = n / t
Where:
f = Frequency (measured in Hertz, Hz)
n = Number of Cycles (or events, oscillations, revolutions)
t = Time duration (converted to seconds)
Understanding the Period ($T$)
The Period is the reciprocal of frequency. While frequency tells you how many cycles happen in one second, the period tells you how many seconds it takes to complete one cycle.
T = 1 / f
Calculation Examples
Example 1: Sound Wave
If a sound wave completes 500 oscillations in 2 seconds :
Frequency = $500 / 2 = 250 \text{ Hz}$
Period = $1 / 250 = 0.004 \text{ seconds (or 4ms)}$
Example 2: Engine RPM
An engine completes 3000 revolutions in 1 minute .
First, convert time to seconds: 1 minute = 60 seconds.
Frequency = $3000 / 60 = 50 \text{ Hz}$
To convert back to RPM from Hz: $\text{Hz} \times 60 = \text{RPM}$.
Common Frequency Units
Hertz (Hz): One cycle per second. Base unit.
Kilohertz (kHz): 1,000 Hz. Common in audio and radio.
Megahertz (MHz): 1,000,000 Hz. Common in computer processors and wireless signals.
RPM: Revolutions Per Minute. Common in mechanics and automotive.
function calculateFrequency() {
// 1. Get input values
var cycles = parseFloat(document.getElementById('cyclesInput').value);
var time = parseFloat(document.getElementById('timeInput').value);
var unitMultiplier = parseFloat(document.getElementById('timeUnit').value);
var precision = parseInt(document.getElementById('precision').value);
// 2. Validate inputs
if (isNaN(cycles) || isNaN(time) || time === 0) {
alert("Please enter valid numbers. Time cannot be zero.");
return;
}
// 3. Normalize time to seconds
var timeInSeconds = time * unitMultiplier;
// 4. Calculate Frequency (Hz) = Cycles / Seconds
var frequencyHz = cycles / timeInSeconds;
// 5. Calculate Period (T) = 1 / Frequency
var periodSeconds = 0;
if (frequencyHz !== 0) {
periodSeconds = 1 / frequencyHz;
}
// 6. Calculate other units
var kHz = frequencyHz / 1000;
var mHz = frequencyHz / 1000000;
var rpm = frequencyHz * 60;
// 7. Format Period for readability (s, ms, µs)
var formattedPeriod = "";
if (periodSeconds >= 1) {
formattedPeriod = periodSeconds.toFixed(precision) + " s";
} else if (periodSeconds >= 0.001) {
formattedPeriod = (periodSeconds * 1000).toFixed(precision) + " ms";
} else {
formattedPeriod = (periodSeconds * 1000000).toFixed(precision) + " µs";
}
// 8. Update DOM elements
document.getElementById('resHz').innerHTML = frequencyHz.toLocaleString('en-US', { maximumFractionDigits: precision });
document.getElementById('resPeriod').innerHTML = formattedPeriod;
document.getElementById('resKHz').innerHTML = kHz.toLocaleString('en-US', { maximumFractionDigits: precision }) + " kHz";
document.getElementById('resMHz').innerHTML = mHz.toLocaleString('en-US', { maximumFractionDigits: precision + 2 }) + " MHz";
document.getElementById('resRPM').innerHTML = rpm.toLocaleString('en-US', { maximumFractionDigits: precision }) + " RPM";
// 9. Show results container
document.getElementById('results').style.display = 'block';
}