Net Promoter Score (NPS) Calculator
The Net Promoter Score (NPS) is a customer loyalty metric used to gauge the willingness of customers to recommend a company's products or services to others. It's a simple yet powerful tool that helps businesses understand customer satisfaction and identify areas for improvement. The score is based on a single question: "On a scale of 0 to 10, how likely are you to recommend [Company/Product/Service] to a friend or colleague?"
How NPS is Calculated:
- Promoters: Customers who rate 9 or 10 are considered Promoters. They are loyal enthusiasts who will keep buying and refer others, fueling growth.
- Passives: Customers who rate 7 or 8 are considered Passives. They are satisfied but unenthusiastic customers who are vulnerable to competitive offerings.
- Detractors: Customers who rate 0 to 6 are considered Detractors. They are unhappy customers who can damage your brand and impede growth through negative word-of-mouth.
The NPS is calculated using the following formula:
NPS = (% of Promoters) – (% of Detractors)
The resulting score can range from -100 to +100. A positive NPS indicates more promoters than detractors, which is generally a good sign of customer loyalty and satisfaction.
.calculator-container {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.calculator-container h2, .calculator-container h3 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.explanation {
margin-bottom: 25px;
padding: 15px;
background-color: #f9f9f9;
border-left: 4px solid #007bff;
}
.explanation h3 {
text-align: left;
margin-bottom: 10px;
}
.explanation ul {
padding-left: 20px;
margin-bottom: 10px;
}
.explanation li {
margin-bottom: 5px;
}
.calculator-form .form-group {
margin-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.calculator-form label {
flex: 1;
margin-right: 10px;
font-weight: bold;
color: #555;
}
.calculator-form input[type="number"] {
flex: 1;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 120px; /* Adjust width for better alignment */
}
.calculator-form button {
display: block;
width: 100%;
padding: 10px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-form button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
background-color: #eef7ff;
border: 1px solid #007bff;
border-radius: 4px;
text-align: center;
}
#result {
font-size: 24px;
font-weight: bold;
color: #007bff;
}
function calculateNPS() {
var totalRespondents = parseFloat(document.getElementById("totalRespondents").value);
var promoters = parseFloat(document.getElementById("promoters").value);
var passives = parseFloat(document.getElementById("passives").value);
var detractors = parseFloat(document.getElementById("detractors").value);
var resultElement = document.getElementById("result");
resultElement.innerHTML = ""; // Clear previous results
if (isNaN(totalRespondents) || isNaN(promoters) || isNaN(passives) || isNaN(detractors) ||
totalRespondents <= 0 || promoters < 0 || passives < 0 || detractors < 0) {
resultElement.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Optional: Check if the sum of categories matches total respondents
if (promoters + passives + detractors !== totalRespondents) {
resultElement.innerHTML = "Warning: The sum of Promoters, Passives, and Detractors does not equal Total Respondents. Calculation will proceed based on provided Promoter and Detractor counts relative to Total Respondents.";
// If you prefer to strictly enforce this, uncomment the next two lines:
// resultElement.innerHTML = "Error: The sum of Promoters, Passives, and Detractors must equal Total Respondents.";
// return;
}
var percentPromoters = (promoters / totalRespondents) * 100;
var percentDetractors = (detractors / totalRespondents) * 100;
var nps = percentPromoters – percentDetractors;
// Ensure NPS is within the valid range (-100 to 100) due to potential floating point inaccuracies or input issues
nps = Math.max(-100, Math.min(100, nps));
resultElement.innerHTML = nps.toFixed(2); // Display NPS with 2 decimal places
}