.nrr-calculator-wrapper {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 800px;
margin: 0 auto;
color: #333;
line-height: 1.6;
}
.nrr-calc-box {
background: #f0f4f8;
border: 2px solid #0056b3;
border-radius: 8px;
padding: 30px;
margin-bottom: 40px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.nrr-title {
text-align: center;
color: #0056b3;
margin-bottom: 25px;
font-size: 24px;
font-weight: 700;
}
.nrr-flex-row {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 20px;
}
.nrr-col {
flex: 1;
min-width: 250px;
}
.nrr-section-label {
font-weight: bold;
color: #2c3e50;
margin-bottom: 10px;
border-bottom: 2px solid #ddd;
padding-bottom: 5px;
display: block;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-size: 14px;
font-weight: 600;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
.form-group .help-text {
font-size: 12px;
color: #666;
margin-top: 4px;
}
.calc-btn {
display: block;
width: 100%;
background: #0056b3;
color: white;
border: none;
padding: 15px;
font-size: 18px;
font-weight: bold;
border-radius: 4px;
cursor: pointer;
transition: background 0.3s;
}
.calc-btn:hover {
background: #004494;
}
.result-box {
margin-top: 25px;
padding: 20px;
background: #fff;
border: 1px solid #ddd;
border-radius: 4px;
text-align: center;
display: none;
}
.nrr-value {
font-size: 32px;
font-weight: 800;
color: #0056b3;
}
.nrr-breakdown {
font-size: 14px;
color: #555;
margin-top: 10px;
}
.positive-nrr { color: #28a745; }
.negative-nrr { color: #dc3545; }
/* Article Styling */
.nrr-article h2 { color: #2c3e50; margin-top: 30px; font-size: 22px; }
.nrr-article h3 { color: #34495e; margin-top: 20px; font-size: 18px; }
.nrr-article ul { margin-bottom: 20px; padding-left: 20px; }
.nrr-article li { margin-bottom: 8px; }
.formula-box {
background: #eef;
padding: 15px;
border-left: 4px solid #0056b3;
font-family: monospace;
margin: 20px 0;
}
function calculateNRR() {
// Get inputs
var runsScored = parseFloat(document.getElementById('runsScored').value);
var oversFacedInput = parseFloat(document.getElementById('oversFaced').value);
var runsConceded = parseFloat(document.getElementById('runsConceded').value);
var oversBowledInput = parseFloat(document.getElementById('oversBowled').value);
// Validation
if (isNaN(runsScored) || isNaN(oversFacedInput) || isNaN(runsConceded) || isNaN(oversBowledInput)) {
alert("Please enter valid numbers for all fields.");
return;
}
if (oversFacedInput === 0 || oversBowledInput === 0) {
alert("Overs cannot be zero.");
return;
}
// Helper function to convert cricket overs (e.g., 19.4) to decimal overs (19.666)
function convertOvers(oversVal) {
var wholeOvers = Math.floor(oversVal);
// Extract the decimal part properly (avoiding floating point errors)
var balls = Math.round((oversVal – wholeOvers) * 10);
// Validate balls (cannot be more than 5 in cricket notation .6 becomes next over)
if (balls >= 6) {
// If user enters 19.6, treat as 20.0, though strictly invalid input
wholeOvers += Math.floor(balls / 6);
balls = balls % 6;
}
return wholeOvers + (balls / 6);
}
var decimalOversFaced = convertOvers(oversFacedInput);
var decimalOversBowled = convertOvers(oversBowledInput);
// Calculate Run Rates
var runRateFor = runsScored / decimalOversFaced;
var runRateAgainst = runsConceded / decimalOversBowled;
// Calculate NRR
var nrr = runRateFor – runRateAgainst;
// Update UI
var resultBox = document.getElementById('resultDisplay');
var nrrValueEl = document.getElementById('nrrValue');
var breakdownEl = document.getElementById('nrrBreakdown');
resultBox.style.display = 'block';
// Format NRR to 3 decimal places (standard in cricket)
var formattedNRR = (nrr > 0 ? "+" : "") + nrr.toFixed(3);
nrrValueEl.textContent = formattedNRR;
// Color coding
if (nrr >= 0) {
nrrValueEl.className = "nrr-value positive-nrr";
} else {
nrrValueEl.className = "nrr-value negative-nrr";
}
breakdownEl.innerHTML =
"Team Run Rate: " + runRateFor.toFixed(3) + "" +
"Opponent Run Rate: " + runRateAgainst.toFixed(3);
}
How to Calculate Net Run Rate (NRR) in Cricket Tournaments
Net Run Rate (NRR) is the preferred method for ranking teams with equal points in limited-overs cricket tournaments, such as the ICC World Cup, T20 World Cup, and leagues like the IPL. It serves as a tie-breaker by measuring a team's winning margin relative to their losing margin throughout a competition.
The Net Run Rate Formula
The calculation essentially compares the average runs a team scores per over against the average runs they concede per over.
NRR = (Total Runs Scored / Total Overs Faced) – (Total Runs Conceded / Total Overs Bowled)
This can be simplified as:
NRR = Average Run Rate For – Average Run Rate Against
Step-by-Step Calculation Guide
To manually calculate NRR, follow these steps:
- Calculate Run Rate For: Sum up all runs scored by the team across all matches. Sum up all overs faced. Divide total runs by total overs.
- Calculate Run Rate Against: Sum up all runs scored by opponents against the team. Sum up all overs bowled by the team. Divide opponent runs by overs bowled.
- Subtract: Deduct the "Run Rate Against" from the "Run Rate For".
Important Rules and Edge Cases
- The "All Out" Rule: This is the most critical rule in NRR calculation. If a team is bowled out (all out) before completing their full quota of overs (e.g., bowled out in 35 overs in a 50-over match), the calculation uses the full quota of overs (50 overs) rather than the actual overs faced. This penalizes the team for losing all wickets.
- Overs Notation: Cricket overs are counted in base-6. An input of "10.3" means 10 full overs and 3 balls. For calculation purposes, this must be converted to a decimal. 3 balls is 3/6 of an over, or 0.5. Thus, 10.3 overs = 10.5 in the formula.
- Abandoned Matches: Matches that are abandoned without a result usually do not count towards the NRR calculation.
Real-World Example
Imagine Team A has played 2 matches:
- Match 1: Scored 180 runs in 20 overs. Conceded 160 runs in 20 overs.
- Match 2: Scored 150 runs in 20 overs. Conceded 190 runs in 20 overs.
Total Runs Scored: 180 + 150 = 330
Total Overs Faced: 20 + 20 = 40
Run Rate For: 330 / 40 = 8.25
Total Runs Conceded: 160 + 190 = 350
Total Overs Bowled: 20 + 20 = 40
Run Rate Against: 350 / 40 = 8.75
Final NRR: 8.25 – 8.75 = -0.500
Why NRR Can Change Drastically
Because NRR is cumulative, a single heavy defeat can severely impact a team's standing. Conversely, chasing down a small target in very few overs can boost the NRR significantly, as the denominator (overs faced) remains small while the runs remain constant.