.lr-calculator-container {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 25px;
background-color: #ffffff;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
border: 1px solid #e0e0e0;
}
.lr-calculator-container h3 {
text-align: center;
color: #2c3e50;
margin-bottom: 25px;
font-size: 24px;
}
.lr-form-group {
margin-bottom: 20px;
}
.lr-form-group label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #34495e;
}
.lr-form-group input {
width: 100%;
padding: 12px;
border: 2px solid #bdc3c7;
border-radius: 6px;
font-size: 16px;
transition: border-color 0.3s;
box-sizing: border-box;
}
.lr-form-group input:focus {
border-color: #3498db;
outline: none;
}
.lr-form-group .lr-help-text {
font-size: 12px;
color: #7f8c8d;
margin-top: 5px;
}
.lr-btn {
width: 100%;
padding: 14px;
background-color: #3498db;
color: white;
border: none;
border-radius: 6px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s;
}
.lr-btn:hover {
background-color: #2980b9;
}
.lr-result-box {
margin-top: 25px;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
border-left: 5px solid #3498db;
display: none;
}
.lr-result-row {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
font-size: 16px;
color: #2c3e50;
}
.lr-result-row.total {
font-weight: bold;
font-size: 20px;
color: #27ae60;
border-top: 1px solid #ddd;
padding-top: 10px;
margin-top: 10px;
}
.lr-error {
color: #e74c3c;
text-align: center;
margin-top: 10px;
font-weight: bold;
display: none;
}
.lr-article {
max-width: 800px;
margin: 40px auto;
font-family: inherit;
line-height: 1.6;
color: #333;
}
.lr-article h2 {
color: #2c3e50;
margin-top: 30px;
border-bottom: 2px solid #eee;
padding-bottom: 10px;
}
.lr-article p {
margin-bottom: 15px;
}
.lr-article ul {
margin-bottom: 15px;
padding-left: 20px;
}
.lr-article li {
margin-bottom: 8px;
}
.lr-formula-box {
background: #eef7fc;
padding: 15px;
border-radius: 5px;
text-align: center;
font-family: monospace;
font-size: 18px;
margin: 20px 0;
border: 1px dashed #3498db;
}
function calculateLiteracyRate() {
// 1. Get input values by ID
var totalPopulationInput = document.getElementById('total_pop_input');
var literatePopulationInput = document.getElementById('literate_pop_input');
var errorDiv = document.getElementById('lr_error_msg');
var resultDiv = document.getElementById('lr_result_display');
// 2. Parse values
var totalPop = parseFloat(totalPopulationInput.value);
var litPop = parseFloat(literatePopulationInput.value);
// 3. Reset display
errorDiv.style.display = 'none';
resultDiv.style.display = 'none';
errorDiv.innerHTML = ";
// 4. Validate Inputs
if (isNaN(totalPop) || isNaN(litPop)) {
errorDiv.innerHTML = "Please enter valid numbers for both fields.";
errorDiv.style.display = 'block';
return;
}
if (totalPop <= 0) {
errorDiv.innerHTML = "Total population must be greater than zero.";
errorDiv.style.display = 'block';
return;
}
if (litPop totalPop) {
errorDiv.innerHTML = "Literate population cannot exceed total population.";
errorDiv.style.display = 'block';
return;
}
// 5. Calculate Literacy Rate logic
// Formula: (Literate Population / Total Population) * 100
var literacyRate = (litPop / totalPop) * 100;
var illiteracyRate = 100 – literacyRate;
var illiterateCount = totalPop – litPop;
// 6. Update HTML with results
document.getElementById('literacy_percentage').innerText = literacyRate.toFixed(2) + '%';
document.getElementById('illiteracy_percentage').innerText = illiteracyRate.toFixed(2) + '%';
document.getElementById('illiterate_count').innerText = illiterateCount.toLocaleString();
// 7. Show result
resultDiv.style.display = 'block';
}
How to Calculate the Literacy Rate
Calculating the literacy rate is a fundamental demographic exercise used by governments, NGOs, and researchers to assess the educational standards of a specific region, country, or community. It provides a percentage representation of the population that possesses the ability to read and write.
While the definition of "literacy" can vary by country (e.g., ability to read a simple sentence vs. completing a specific grade level), the mathematical formula for calculating the rate remains consistent across most statistical applications.
The Literacy Rate Formula
The literacy rate is calculated by dividing the number of literate individuals by the total population of the relevant age group, and then multiplying the result by 100 to get a percentage.
Literacy Rate = (Literate Population / Total Population) × 100
Note on "Total Population": In demographic statistics, the "Total Population" usually refers to a specific age bracket rather than the entire population. For example, international standards often calculate adult literacy based on the population aged 15 years and older. In some specific national contexts (like India), it is calculated for the population aged 7 years and above.
Step-by-Step Calculation Example
To better understand the calculation, let's look at a practical example involving a small town.
- Step 1: Define the Demographic. We want to find the literacy rate for adults aged 15 and above.
- Step 2: Find the Total Population. According to the census, the town has 25,000 people aged 15+.
- Step 3: Find the Literate Count. Out of those 25,000 people, surveys show that 21,500 can read and write.
- Step 4: Apply the Formula.
Calculation:
(21,500 ÷ 25,000) = 0.86
0.86 × 100 = 86%
Therefore, the literacy rate of the town is 86%.
Why Is Calculating Literacy Rate Important?
Measuring literacy is vital for social development for several reasons:
- Policy Making: Governments use this data to allocate budgets for schools and adult education programs.
- Economic Indicator: Higher literacy rates often correlate with higher GDP and better economic opportunities.
- Social Health: Literacy affects health outcomes, gender equality, and political participation.
Understanding Illiteracy Rate
The inverse of the literacy rate is the illiteracy rate. This represents the percentage of the population that lacks basic reading and writing skills. It can be calculated easily once you have the literacy rate:
Illiteracy Rate = 100% – Literacy Rate
Using our previous example: 100% – 86% = 14% Illiteracy Rate.