DastanGou
Free Online Calculators Collection
15 different types of working calculators for daily use
This tool is perfect for birthday planning, age verification, retirement planning, and tracking important life milestones.
Simply enter your birth date and get instant, accurate results.
BMI is a reliable indicator of body fatness for most people and is used to screen for weight categories that may lead to health problems.
This calculator uses the standard BMI formula: weight (kg) ÷ height (m)².
This tool supports major currencies including USD, EUR, GBP, PKR, INR, and more.
Perfect for travel planning, international business, forex trading, and online shopping from foreign websites.
Get instant currency conversion with accurate rates.
USD – US Dollar
EUR – Euro
GBP – British Pound
PKR – Pakistani Rupee
INR – Indian Rupee
USD – US Dollar
EUR – Euro
GBP – British Pound
PKR – Pakistani Rupee
INR – Indian Rupee
This calculator uses the standard amortization formula to provide accurate results.
Perfect for financial planning, budgeting, loan comparison, and understanding the true cost of borrowing.
This calculator helps you budget for utilities, identify energy-saving opportunities, and compare different tariff plans.
Enter your electricity consumption in kWh to get an accurate estimate of your monthly bill including taxes and surcharges.
This tool helps you quickly determine appropriate gratuity, split bills evenly, and avoid awkward calculations at restaurants.
Perfect for dining out, food delivery services, and hospitality situations.
10% – Poor Service
15% – Good Service
18% – Very Good
20% – Excellent
25% – Outstanding
This tool helps you compare deals, calculate actual savings, and make informed purchasing decisions during sales events.
Enter the original price and discount percentage to see how much you’ll save.
This versatile tool handles multiple percentage calculations including basic percentage, percentage of a number, percentage change, and reverse percentage calculations.
Essential for finance, statistics, academics, and everyday math problems.
What is X% of Y?
X is what % of Y?
Percentage Increase
Percentage Decrease
This tool helps create hard-to-crack passwords for online accounts, WiFi networks, applications, and secure systems.
Includes password strength indicator to ensure your generated passwords meet security standards.
This tool is perfect for project planning, event scheduling, age calculation, contract dates, and deadline management.
Calculate exact durations between two dates or determine what date will be after a specific number of days.
This tool is essential for work hour calculations, project time tracking, scheduling, and time management.
Perform calculations with time values in HH:MM:SS format for precise results in work, sports, cooking, and scientific applications.
Add Times
Subtract Times
Time Difference
This comprehensive converter handles metric and imperial systems for scientific calculations, cooking recipes, construction, engineering, and everyday measurements.
Includes conversions for meters/feet, kilograms/pounds, Celsius/Fahrenheit, and liters/gallons.
Length
Weight
Temperature
Volume
Feet
Inches
Centimeters
Kilometers
This tool helps students plan their studies, set academic goals, and understand what scores they need on final exams.
Enter current grades, target grades, and final exam weight to calculate the required final exam score for academic success.
This tool helps with travel budgeting, vehicle selection, fuel consumption analysis, and cost planning for road trips.
Enter distance, fuel efficiency, and fuel price to calculate total fuel needed and trip cost.
This tool creates truly random numbers, supports unique number generation, and allows customization of range and quantity.
Perfect for contests, sampling, simulations, password generation, and random selection processes.
// All calculator functions from previous code remain the same
// Initialize on page load
document.addEventListener(‘DOMContentLoaded’, function() {
const today = new Date().toISOString().split(‘T’)[0];
// Set max date to today for date inputs
document.getElementById(‘birthDate’).max = today;
document.getElementById(‘startDate’).max = today;
document.getElementById(‘endDate’).max = today;
// Set default dates
const defaultBirthDate = new Date();
defaultBirthDate.setFullYear(defaultBirthDate.getFullYear() – 30);
document.getElementById(‘birthDate’).value = defaultBirthDate.toISOString().split(‘T’)[0];
const defaultStartDate = new Date();
defaultStartDate.setDate(defaultStartDate.getDate() – 30);
document.getElementById(‘startDate’).value = defaultStartDate.toISOString().split(‘T’)[0];
document.getElementById(‘endDate’).value = today;
// Calculate age on page load
calculateAge();
});
// 1. Age Calculator
function calculateAge() {
const birthDate = new Date(document.getElementById(‘birthDate’).value);
const today = new Date();
if (isNaN(birthDate.getTime())) {
alert(“Please select a valid birth date!”);
return;
}
if (birthDate > today) {
alert(“Birth date cannot be in the future!”);
return;
}
// Calculate years
let years = today.getFullYear() – birthDate.getFullYear();
let months = today.getMonth() – birthDate.getMonth();
let days = today.getDate() – birthDate.getDate();
// Adjust if current month/day is before birth month/day
if (months < 0 || (months === 0 && days < 0)) {
years–;
months += 12;
}
if (days < 0) {
const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 0).getDate();
days += lastDayOfMonth;
months–;
if (months < 0) {
months = 11;
years–;
}
}
// Calculate total days and hours
const diff = today – birthDate;
const totalDays = Math.floor(diff / (1000 * 60 * 60 * 24));
const totalWeeks = Math.floor(totalDays / 7);
// Update results
document.getElementById('yearsValue').textContent = years;
document.getElementById('monthsValue').textContent = months;
document.getElementById('weeksValue').textContent = totalWeeks.toLocaleString();
document.getElementById('daysValue').textContent = totalDays.toLocaleString();
document.getElementById('ageResults').style.display = 'block';
}
function resetAge() {
const defaultDate = new Date();
defaultDate.setFullYear(defaultDate.getFullYear() – 30);
document.getElementById('birthDate').value = defaultDate.toISOString().split('T')[0];
document.getElementById('ageResults').style.display = 'none';
}
// 2. BMI Calculator
function calculateBMI() {
const height = parseFloat(document.getElementById('height').value) / 100;
const weight = parseFloat(document.getElementById('weight').value);
if (!height || !weight || height <= 0 || weight <= 0) {
alert("Please enter valid height and weight!");
return;
}
const bmi = weight / (height * height);
let category = '';
if (bmi < 18.5) category = 'Underweight';
else if (bmi < 25) category = 'Normal weight';
else if (bmi < 30) category = 'Overweight';
else category = 'Obese';
document.getElementById('bmiValue').textContent = bmi.toFixed(1);
document.getElementById('bmiCategory').textContent = category;
document.getElementById('bmiResults').style.display = 'block';
}
function resetBMI() {
document.getElementById('height').value = '170';
document.getElementById('weight').value = '70';
document.getElementById('bmiResults').style.display = 'none';
}
// 3. Currency Converter
const exchangeRates = {
USD: { USD: 1, EUR: 0.85, GBP: 0.73, PKR: 280, INR: 83 },
EUR: { USD: 1.18, EUR: 1, GBP: 0.86, PKR: 330, INR: 98 },
GBP: { USD: 1.37, EUR: 1.16, GBP: 1, PKR: 384, INR: 114 },
PKR: { USD: 0.0036, EUR: 0.0030, GBP: 0.0026, PKR: 1, INR: 0.30 },
INR: { USD: 0.012, EUR: 0.010, GBP: 0.0088, PKR: 3.33, INR: 1 }
};
function convertCurrency() {
const amount = parseFloat(document.getElementById('amount').value);
const from = document.getElementById('fromCurrency').value;
const to = document.getElementById('toCurrency').value;
if (!amount || amount <= 0) {
alert("Please enter a valid amount!");
return;
}
const rate = exchangeRates[from][to];
const converted = amount * rate;
document.getElementById('convertedAmount').textContent = converted.toFixed(2) + ' ' + to;
document.getElementById('currencyResults').style.display = 'block';
}
function resetCurrency() {
document.getElementById('amount').value = '100';
document.getElementById('currencyResults').style.display = 'none';
}
// 4. Loan Calculator
function calculateLoan() {
const amount = parseFloat(document.getElementById('loanAmount').value);
const annualRate = parseFloat(document.getElementById('interestRate').value);
const termMonths = parseInt(document.getElementById('loanTerm').value);
if (!amount || !annualRate || !termMonths || amount <= 0 || termMonths <= 0) {
alert("Please enter valid loan details!");
return;
}
const monthlyRate = annualRate / 100 / 12;
const monthlyPayment = amount * monthlyRate * Math.pow(1 + monthlyRate, termMonths) /
(Math.pow(1 + monthlyRate, termMonths) – 1);
const totalPayment = monthlyPayment * termMonths;
const totalInterest = totalPayment – amount;
document.getElementById('monthlyPayment').textContent = '$' + monthlyPayment.toFixed(2);
document.getElementById('totalInterest').textContent = '$' + totalInterest.toFixed(2);
document.getElementById('totalPayment').textContent = '$' + totalPayment.toFixed(2);
document.getElementById('loanResults').style.display = 'block';
}
function resetLoan() {
document.getElementById('loanAmount').value = '10000';
document.getElementById('interestRate').value = '5';
document.getElementById('loanTerm').value = '60';
document.getElementById('loanResults').style.display = 'none';
}
// 5. Electricity Bill Calculator
function calculateElectricityBill() {
const units = parseFloat(document.getElementById('units').value);
const rate = parseFloat(document.getElementById('ratePerUnit').value);
const tax = parseFloat(document.getElementById('taxRate').value) / 100;
if (!units || units <= 0) {
alert("Please enter valid units!");
return;
}
const energyCharge = units * rate;
const taxAmount = energyCharge * tax;
const totalBill = energyCharge + taxAmount;
document.getElementById('energyCharge').textContent = '$' + energyCharge.toFixed(2);
document.getElementById('taxAmount').textContent = '$' + taxAmount.toFixed(2);
document.getElementById('totalBill').textContent = '$' + totalBill.toFixed(2);
document.getElementById('electricityResults').style.display = 'block';
}
function resetElectricity() {
document.getElementById('units').value = '300';
document.getElementById('ratePerUnit').value = '0.15';
document.getElementById('taxRate').value = '13';
document.getElementById('electricityResults').style.display = 'none';
}
// 6. Tip Calculator
function calculateTip() {
const bill = parseFloat(document.getElementById('billAmount').value);
const tipPercent = parseFloat(document.getElementById('tipPercentage').value) / 100;
const people = parseInt(document.getElementById('peopleCount').value);
if (!bill || bill <= 0) {
alert("Please enter a valid bill amount!");
return;
}
const tipAmount = bill * tipPercent;
const totalWithTip = bill + tipAmount;
const perPerson = totalWithTip / people;
document.getElementById('tipAmount').textContent = '$' + tipAmount.toFixed(2);
document.getElementById('totalWithTip').textContent = '$' + totalWithTip.toFixed(2);
document.getElementById('perPerson').textContent = '$' + perPerson.toFixed(2);
document.getElementById('tipResults').style.display = 'block';
}
function resetTip() {
document.getElementById('billAmount').value = '50';
document.getElementById('peopleCount').value = '2';
document.getElementById('tipResults').style.display = 'none';
}
// 7. Discount Calculator
function calculateDiscount() {
const original = parseFloat(document.getElementById('originalPrice').value);
const discount = parseFloat(document.getElementById('discountPercent').value) / 100;
if (!original || original <= 0) {
alert("Please enter a valid price!");
return;
}
const discountAmount = original * discount;
const finalPrice = original – discountAmount;
document.getElementById('discountAmount').textContent = '$' + discountAmount.toFixed(2);
document.getElementById('finalPrice').textContent = '$' + finalPrice.toFixed(2);
document.getElementById('youSave').textContent = '$' + discountAmount.toFixed(2);
document.getElementById('discountResults').style.display = 'block';
}
function resetDiscount() {
document.getElementById('originalPrice').value = '100';
document.getElementById('discountPercent').value = '20';
document.getElementById('discountResults').style.display = 'none';
}
// 8. Percentage Calculator
function calculatePercentage() {
const type = document.getElementById('percentageType').value;
const val1 = parseFloat(document.getElementById('percentageValue1').value);
const val2 = parseFloat(document.getElementById('percentageValue2').value);
if (!val1 || !val2) {
alert("Please enter both values!");
return;
}
let result = 0;
switch(type) {
case 'basic':
result = (val1 / 100) * val2;
document.getElementById('percentageResult').textContent = result.toFixed(2);
break;
case 'percentage':
result = (val1 / val2) * 100;
document.getElementById('percentageResult').textContent = result.toFixed(2) + '%';
break;
case 'increase':
result = ((val2 – val1) / val1) * 100;
document.getElementById('percentageResult').textContent = result.toFixed(2) + '% increase';
break;
case 'decrease':
result = ((val1 – val2) / val1) * 100;
document.getElementById('percentageResult').textContent = result.toFixed(2) + '% decrease';
break;
}
document.getElementById('percentageResults').style.display = 'block';
}
function resetPercentage() {
document.getElementById('percentageValue1').value = '20';
document.getElementById('percentageValue2').value = '100';
document.getElementById('percentageResults').style.display = 'none';
}
// 9. Password Generator
function updateLengthValue() {
document.getElementById('lengthValue').textContent = document.getElementById('passwordLength').value;
}
function generatePassword() {
const length = parseInt(document.getElementById('passwordLength').value);
const includeUpper = document.getElementById('includeUppercase').checked;
const includeLower = document.getElementById('includeLowercase').checked;
const includeNumbers = document.getElementById('includeNumbers').checked;
const includeSymbols = document.getElementById('includeSymbols').checked;
const upperChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const lowerChars = 'abcdefghijklmnopqrstuvwxyz';
const numberChars = '0123456789';
const symbolChars = '!@#$%^&*()_+-=[]{}|;:,.?’;
let chars = ”;
if (includeUpper) chars += upperChars;
if (includeLower) chars += lowerChars;
if (includeNumbers) chars += numberChars;
if (includeSymbols) chars += symbolChars;
if (chars === ”) {
alert(“Please select at least one character type!”);
return;
}
let password = ”;
for (let i = 0; i = 12 && (includeUpper && includeLower && includeNumbers && includeSymbols)) {
strength = ‘Very Strong’;
} else if (length >= 10 && (includeUpper && includeLower && includeNumbers)) {
strength = ‘Strong’;
} else if (length >= 8 && ((includeUpper && includeLower) || (includeLower && includeNumbers))) {
strength = ‘Medium’;
}
document.getElementById(‘generatedPassword’).textContent = password;
document.getElementById(‘passwordStrength’).textContent = strength;
document.getElementById(‘passwordResults’).style.display = ‘block’;
}
function resetPassword() {
document.getElementById(‘passwordLength’).value = ’12’;
document.getElementById(‘includeUppercase’).checked = true;
document.getElementById(‘includeLowercase’).checked = true;
document.getElementById(‘includeNumbers’).checked = true;
document.getElementById(‘includeSymbols’).checked = false;
updateLengthValue();
document.getElementById(‘passwordResults’).style.display = ‘none’;
}
// 10. Date Calculator
function calculateDate() {
const startDate = new Date(document.getElementById(‘startDate’).value);
const endDate = new Date(document.getElementById(‘endDate’).value);
const daysToAdd = parseInt(document.getElementById(‘daysToAdd’).value);
if (!startDate || !endDate || isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
alert(“Please select valid dates!”);
return;
}
// Calculate days between dates
const diffTime = Math.abs(endDate – startDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// Calculate new date
const newDate = new Date(startDate);
newDate.setDate(newDate.getDate() + daysToAdd);
document.getElementById(‘daysBetween’).textContent = diffDays;
document.getElementById(‘newDate’).textContent = newDate.toDateString();
document.getElementById(‘dateResults’).style.display = ‘block’;
}
function resetDate() {
const today = new Date();
const pastDate = new Date();
pastDate.setDate(today.getDate() – 30);
document.getElementById(‘startDate’).value = pastDate.toISOString().split(‘T’)[0];
document.getElementById(‘endDate’).value = today.toISOString().split(‘T’)[0];
document.getElementById(‘daysToAdd’).value = ’30’;
document.getElementById(‘dateResults’).style.display = ‘none’;
}
// 11. Time Calculator
function calculateTime() {
const time1 = document.getElementById(‘time1’).value;
const time2 = document.getElementById(‘time2’).value;
const operation = document.getElementById(‘timeOperation’).value;
if (!time1 || !time2) {
alert(“Please enter both times!”);
return;
}
// Parse times
const parseTime = (timeStr) => {
const parts = timeStr.split(‘:’);
return {
hours: parseInt(parts[0]) || 0,
minutes: parseInt(parts[1]) || 0,
seconds: parseInt(parts[2]) || 0
};
};
const t1 = parseTime(time1);
const t2 = parseTime(time2);
let resultHours = 0, resultMinutes = 0, resultSeconds = 0;
switch(operation) {
case ‘add’:
resultSeconds = t1.seconds + t2.seconds;
resultMinutes = t1.minutes + t2.minutes;
resultHours = t1.hours + t2.hours;
if (resultSeconds >= 60) {
resultMinutes += Math.floor(resultSeconds / 60);
resultSeconds %= 60;
}
if (resultMinutes >= 60) {
resultHours += Math.floor(resultMinutes / 60);
resultMinutes %= 60;
}
break;
case ‘subtract’:
let totalSeconds1 = t1.hours * 3600 + t1.minutes * 60 + t1.seconds;
let totalSeconds2 = t2.hours * 3600 + t2.minutes * 60 + t2.seconds;
let diffSeconds = Math.abs(totalSeconds1 – totalSeconds2);
resultHours = Math.floor(diffSeconds / 3600);
diffSeconds %= 3600;
resultMinutes = Math.floor(diffSeconds / 60);
resultSeconds = diffSeconds % 60;
break;
case ‘difference’:
const sec1 = t1.hours * 3600 + t1.minutes * 60 + t1.seconds;
const sec2 = t2.hours * 3600 + t2.minutes * 60 + t2.seconds;
const diff = Math.abs(sec1 – sec2);
resultHours = Math.floor(diff / 3600);
resultMinutes = Math.floor((diff % 3600) / 60);
resultSeconds = diff % 60;
break;
}
const formatTime = (h, m, s) => {
return `${String(h).padStart(2, ‘0’)}:${String(m).padStart(2, ‘0’)}:${String(s).padStart(2, ‘0’)}`;
};
document.getElementById(‘timeResult’).textContent = formatTime(resultHours, resultMinutes, resultSeconds);
document.getElementById(‘timeResults’).style.display = ‘block’;
}
function resetTime() {
document.getElementById(‘time1′).value = ’02:30:00’;
document.getElementById(‘time2′).value = ’01:45:00’;
document.getElementById(‘timeResults’).style.display = ‘none’;
}
// 12. Unit Converter
function convertUnits() {
const type = document.getElementById(‘unitType’).value;
const value = parseFloat(document.getElementById(‘unitValue’).value);
const toUnit = document.getElementById(‘toUnit’).value;
if (!value || value < 0) {
alert("Please enter a valid value!");
return;
}
let result = 0;
// Length conversions
if (type === 'length') {
switch(toUnit) {
case 'feet':
result = value * 3.28084;
break;
case 'inches':
result = value * 39.3701;
break;
case 'cm':
result = value * 100;
break;
case 'km':
result = value / 1000;
break;
default:
result = value;
}
}
// Weight conversions
else if (type === 'weight') {
document.getElementById('fromUnit').value = 'kilogram';
switch(toUnit) {
case 'pounds':
result = value * 2.20462;
break;
case 'ounces':
result = value * 35.274;
break;
case 'grams':
result = value * 1000;
break;
case 'ton':
result = value / 1000;
break;
default:
result = value;
}
}
// Temperature conversions
else if (type === 'temperature') {
document.getElementById('fromUnit').value = 'celsius';
switch(toUnit) {
case 'fahrenheit':
result = (value * 9/5) + 32;
break;
case 'kelvin':
result = value + 273.15;
break;
default:
result = value;
}
}
// Volume conversions
else if (type === 'volume') {
document.getElementById('fromUnit').value = 'liter';
switch(toUnit) {
case 'milliliters':
result = value * 1000;
break;
case 'gallons':
result = value * 0.264172;
break;
case 'cups':
result = value * 4.22675;
break;
case 'pints':
result = value * 2.11338;
break;
default:
result = value;
}
}
document.getElementById('convertedValue').textContent = result.toFixed(4);
document.getElementById('unitResults').style.display = 'block';
}
function resetUnits() {
document.getElementById('unitValue').value = '1';
document.getElementById('unitResults').style.display = 'none';
}
// 13. Grade Calculator
function calculateGrade() {
const current = parseFloat(document.getElementById('currentGrade').value);
const target = parseFloat(document.getElementById('targetGrade').value);
const weight = parseFloat(document.getElementById('finalWeight').value) / 100;
if (!current || !target || !weight || current 100 || target 100) {
alert(“Please enter valid grade values!”);
return;
}
// Calculate required final exam score
const required = (target – (current * (1 – weight))) / weight;
document.getElementById(‘requiredScore’).textContent = required.toFixed(1) + ‘%’;
document.getElementById(‘gradeResults’).style.display = ‘block’;
}
function resetGrade() {
document.getElementById(‘currentGrade’).value = ’75’;
document.getElementById(‘targetGrade’).value = ’80’;
document.getElementById(‘finalWeight’).value = ’30’;
document.getElementById(‘gradeResults’).style.display = ‘none’;
}
// 14. Fuel Cost Calculator
function calculateFuelCost() {
const distance = parseFloat(document.getElementById(‘distance’).value);
const efficiency = parseFloat(document.getElementById(‘fuelEfficiency’).value);
const price = parseFloat(document.getElementById(‘fuelPrice’).value);
if (!distance || !efficiency || !price || distance <= 0 || efficiency <= 0 || price = max || quantity <= 0) {
alert("Please enter valid range and quantity!");
return;
}
let numbers = [];
for (let i = 0; i {
const option = document.createElement(‘option’);
option.value = unit;
option.textContent = unit.charAt(0).toUpperCase() + unit.slice(1);
toUnit.appendChild(option);
});
} else if (type === ‘weight’) {
document.getElementById(‘fromUnit’).value = ‘kilogram’;
[‘pounds’, ‘ounces’, ‘grams’, ‘ton’].forEach(unit => {
const option = document.createElement(‘option’);
option.value = unit;
option.textContent = unit.charAt(0).toUpperCase() + unit.slice(1);
toUnit.appendChild(option);
});
} else if (type === ‘temperature’) {
document.getElementById(‘fromUnit’).value = ‘celsius’;
[‘fahrenheit’, ‘kelvin’].forEach(unit => {
const option = document.createElement(‘option’);
option.value = unit;
option.textContent = unit.charAt(0).toUpperCase() + unit.slice(1);
toUnit.appendChild(option);
});
} else if (type === ‘volume’) {
document.getElementById(‘fromUnit’).value = ‘liter’;
[‘milliliters’, ‘gallons’, ‘cups’, ‘pints’].forEach(unit => {
const option = document.createElement(‘option’);
option.value = unit;
option.textContent = unit.charAt(0).toUpperCase() + unit.slice(1);
toUnit.appendChild(option);
});
}
});


