.nrr-calculator-container {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f9f9f9;
border: 1px solid #e0e0e0;
border-radius: 8px;
}
.nrr-calculator-box {
background: #ffffff;
padding: 25px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
margin-bottom: 30px;
}
.nrr-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.nrr-input-group {
margin-bottom: 15px;
}
.nrr-input-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
color: #2c3e50;
}
.nrr-input-group input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box; /* Ensures padding doesn't affect width */
}
.nrr-section-title {
grid-column: 1 / -1;
font-size: 1.1em;
color: #0d47a1;
border-bottom: 2px solid #e3f2fd;
padding-bottom: 10px;
margin-bottom: 15px;
margin-top: 10px;
}
.nrr-btn {
background-color: #2e7d32;
color: white;
border: none;
padding: 12px 20px;
font-size: 16px;
border-radius: 4px;
cursor: pointer;
width: 100%;
margin-top: 10px;
transition: background-color 0.3s;
}
.nrr-btn:hover {
background-color: #1b5e20;
}
#nrr-result {
margin-top: 20px;
padding: 20px;
background-color: #e8f5e9;
border: 1px solid #c8e6c9;
border-radius: 4px;
text-align: center;
display: none;
}
.nrr-value {
font-size: 2.5em;
font-weight: bold;
color: #1b5e20;
}
.nrr-breakdown {
margin-top: 10px;
font-size: 0.9em;
color: #555;
display: flex;
justify-content: space-around;
}
.nrr-article {
line-height: 1.6;
color: #333;
}
.nrr-article h2 {
color: #2c3e50;
margin-top: 25px;
}
.nrr-article ul {
padding-left: 20px;
}
.nrr-article li {
margin-bottom: 8px;
}
@media (max-width: 600px) {
.nrr-grid {
grid-template-columns: 1fr;
}
}
function calculateCricketNRR() {
// 1. Get Input Values
var runsScored = parseFloat(document.getElementById('runsScored').value);
var oversFacedStr = document.getElementById('oversFaced').value;
var runsConceded = parseFloat(document.getElementById('runsConceded').value);
var oversBowledStr = document.getElementById('oversBowled').value;
// 2. Validate Inputs
if (isNaN(runsScored) || runsScored < 0 ||
oversFacedStr === "" ||
isNaN(runsConceded) || runsConceded 1) {
balls = parseInt(parts[1]);
// Handle cases where user types 10.10 (treated as 10 balls? usually treated as just digit check)
// Standard cricket notation is single digit after dot usually, or strict .1 to .5
// If user enters 10.50, parseInt gives 50. Let's assume standard notation 1-5.
if (balls >= 6 && balls = 6 in standard notation
if (balls >= 6) {
// If balls are 6 or more, simplistic conversion:
// e.g. 10.6 -> 11.0
overs += Math.floor(balls / 6);
balls = balls % 6;
}
return overs + (balls / 6.0);
}
var realOversFaced = convertOversToMath(oversFacedStr);
var realOversBowled = convertOversToMath(oversBowledStr);
// Avoid division by zero
if (realOversFaced === 0 || realOversBowled === 0) {
alert("Total overs faced or bowled cannot be zero.");
return;
}
// 4. Calculate Logic
// Run Rate For = Runs Scored / Overs Faced
var runRateFor = runsScored / realOversFaced;
// Run Rate Against = Runs Conceded / Overs Bowled
var runRateAgainst = runsConceded / realOversBowled;
// Net Run Rate
var nrr = runRateFor – runRateAgainst;
// 5. Display Results
var resultBox = document.getElementById('nrr-result');
var nrrDisplay = document.getElementById('finalNRR');
var rpoForDisplay = document.getElementById('rpoFor');
var rpoAgainstDisplay = document.getElementById('rpoAgainst');
// Format NRR: Always show sign (+/-) and 3 decimal places
var sign = nrr > 0 ? "+" : "";
// Handle -0.000 case (display as +0.000)
if (Math.abs(nrr) = 0) {
nrrDisplay.style.color = "#1b5e20"; // Green
} else {
nrrDisplay.style.color = "#c62828"; // Red
}
rpoForDisplay.innerHTML = "Batting RPO: " + runRateFor.toFixed(2);
rpoAgainstDisplay.innerHTML = "Bowling RPO: " + runRateAgainst.toFixed(2);
resultBox.style.display = "block";
}
Net Run Rate Calculator
Your Team's Batting Stats (For)
Opponent's Stats Against You (Against)
Your Net Run Rate is:
+0.000
Batting RPO: 0.00
Bowling RPO: 0.00
How to Calculate Net Run Rate (NRR) in Cricket
Net Run Rate (NRR) is the preferred method for ranking cricket teams with equal points in limited-overs tournaments like the IPL, ICC World Cup, and T20 leagues. It measures a team's winning margin or losing deficit relative to the number of overs played.
The Net Run Rate Formula
The calculation involves two main components: the rate at which a team scores runs and the rate at which they concede runs.
NRR = (Total Runs Scored / Total Overs Faced) – (Total Runs Conceded / Total Overs Bowled)
Step-by-Step Calculation Guide
- Calculate Average Runs Per Over (For): Divide the total runs your team has scored in the tournament by the total overs your team has faced.
- Calculate Average Runs Per Over (Against): Divide the total runs your team has conceded (scored by opponents) by the total overs your team has bowled.
- Subtract the Against rate from the For rate: A positive number indicates you are scoring faster than your opponents on average. A negative number indicates the opposite.
Crucial Rules for Calculation
- The "All Out" Rule: If a team is bowled out before completing their full quota of overs (e.g., all out in 35 overs in a 50-over match), the calculation assumes they faced the full quota of overs (50 overs). This penalizes teams heavily for getting all out.
- Decimal Overs: In cricket, overs are counted in base-6. An input of "10.3" overs means 10 full overs and 3 balls. Mathematically, this is converted to 10.5 overs (since 3/6 = 0.5) before division.
- Abandoned Matches: Matches with no result usually do not contribute to the NRR calculation.
Example Calculation
Imagine Team A plays one match. They score 180 runs in 20 overs. They restrict the opponent to 160 runs in 20 overs.
- Batting Run Rate: 180 / 20 = 9.00
- Bowling Run Rate: 160 / 20 = 8.00
- Net Run Rate: 9.00 – 8.00 = +1.000