function toggleInputs() {
var mode = document.getElementById('calcMode').value;
var battingSec = document.getElementById('battingSection');
var bowlingSec = document.getElementById('bowlingSection');
var resultArea = document.getElementById('resultArea');
// Reset inputs and hide result when switching
resultArea.style.display = "none";
document.getElementById('runsScored').value = ";
document.getElementById('ballsFaced').value = ";
document.getElementById('ballsBowled').value = ";
document.getElementById('wicketsTaken').value = ";
if (mode === 'batting') {
battingSec.style.display = 'block';
bowlingSec.style.display = 'none';
} else {
battingSec.style.display = 'none';
bowlingSec.style.display = 'block';
}
}
function calculateStrikeRate() {
var mode = document.getElementById('calcMode').value;
var resultArea = document.getElementById('resultArea');
var srDisplay = document.getElementById('srResult');
var explanation = document.getElementById('resExplanation');
var finalRate = 0;
resultArea.style.display = "block";
if (mode === 'batting') {
var runs = parseFloat(document.getElementById('runsScored').value);
var balls = parseFloat(document.getElementById('ballsFaced').value);
if (isNaN(runs) || isNaN(balls)) {
srDisplay.innerHTML = "–";
explanation.innerHTML = "Please enter valid numbers for runs and balls.";
return;
}
if (balls === 0) {
srDisplay.innerHTML = "Undefined";
explanation.innerHTML = "Balls faced cannot be zero.";
return;
}
// Batting SR Formula: (Runs / Balls) * 100
finalRate = (runs / balls) * 100;
srDisplay.innerHTML = finalRate.toFixed(2);
explanation.innerHTML = "This means the batsman scores an average of " + finalRate.toFixed(2) + " runs for every 100 balls faced.";
} else {
var ballsBowled = parseFloat(document.getElementById('ballsBowled').value);
var wickets = parseFloat(document.getElementById('wicketsTaken').value);
if (isNaN(ballsBowled) || isNaN(wickets)) {
srDisplay.innerHTML = "–";
explanation.innerHTML = "Please enter valid numbers for balls and wickets.";
return;
}
if (wickets === 0) {
srDisplay.innerHTML = "N/A";
explanation.innerHTML = "Strike rate is undefined if no wickets are taken.";
return;
}
// Bowling SR Formula: Balls / Wickets
finalRate = ballsBowled / wickets;
srDisplay.innerHTML = finalRate.toFixed(2);
explanation.innerHTML = "This means the bowler takes a wicket every " + finalRate.toFixed(2) + " balls on average.";
}
}
How Strike Rate is Calculated in Cricket
In the world of cricket, Strike Rate (SR) is one of the most critical statistics used to evaluate a player's performance. However, the calculation differs significantly depending on whether you are analyzing a batsman or a bowler. While a high strike rate is desirable for a batsman, a low strike rate is the goal for a bowler.
1. Batting Strike Rate Calculation
For a batsman, the strike rate represents the average number of runs scored per 100 balls faced. It measures how quickly a batsman scores runs.
Formula: (Total Runs Scored ÷ Total Balls Faced) × 100
Example:
Imagine a batsman scores 45 runs off 30 balls.
Step 1: Divide runs by balls: 45 ÷ 30 = 1.5
Step 2: Multiply by 100: 1.5 × 100 = 150
Result: The Batting Strike Rate is 150.00.
What is a Good Batting Strike Rate?
Format
Average SR
Good SR
Test Cricket
40 – 50
60+
ODI (One Day)
75 – 85
90+
T20 Cricket
120 – 130
140+
2. Bowling Strike Rate Calculation
For a bowler, the strike rate measures the average number of balls bowled for every wicket taken. Unlike batting, a lower number is better because it means the bowler takes wickets more frequently.
Formula: Total Balls Bowled ÷ Total Wickets Taken
Example:
Suppose a bowler bowls 4 overs (which is 24 balls) and takes 2 wickets.
While the Economy Rate (runs conceded per over) is often prioritized in T20 cricket to restrict scoring, the Strike Rate is considered the premier metric in Test cricket, where taking wickets is the only way to win a match.
Frequently Asked Questions
Does "balls faced" include wides?
No. For a batsman, "balls faced" generally excludes wides, as a wide is not counted as a legal delivery bowled to the batter. However, it does include dot balls.
How do I calculate Strike Rate if no wickets are taken?
If a bowler takes zero wickets, their bowling strike rate is undefined (mathematically, you cannot divide by zero). In statistics tables, this is often represented as a dash (-) or considered infinite.
Why is T20 Strike Rate so high?
In T20 cricket, batters take more risks to score quickly because there are fewer overs (20 overs). In Test cricket (unlimited overs), preservation of the wicket is more important than scoring speed, resulting in lower strike rates.