🥗 Diet Calculator
Calculate BMI, BMR and Daily Calories
Healthy Weight Tips
- Eat more fruits and vegetables.
- Choose lean protein sources.
- Drink at least 2–3 liters of water daily.
- Exercise for 30 minutes most days.
- Limit sugary drinks and processed foods.
function calculateDiet(){
let gender=document.getElementById("gender").value;
let age=parseFloat(document.getElementById("age").value);
let height=parseFloat(document.getElementById("height").value);
let weight=parseFloat(document.getElementById("weight").value);
let activity=parseFloat(document.getElementById("activity").value);
if(!age || !height || !weight){
alert("Please fill all fields.");
return;
}
let bmi=weight/((height/100)*(height/100));
let bmiStatus="";
if(bmi<18.5){ bmiStatus="Underweight"; }else if(bmi<25){ bmiStatus="Healthy"; }else if(bmi<30){ bmiStatus="Overweight"; }else{ bmiStatus="Obese"; } let bmr; if(gender=="male"){ bmr=10*weight+6.25*height-5*age+5; }else{ bmr=10*weight+6.25*height-5*age-161; } let calories=Math.round(bmr*activity); let loss=Math.round(calories-500); let gain=Math.round(calories+500); document.getElementById("results").innerHTML=`
BMI
${bmi.toFixed(1)}
Category
${bmiStatus}
BMR
${Math.round(bmr)} kcal
Maintenance Calories
${calories} kcal
Weight Loss
${loss} kcal/day
Weight Gain
${gain} kcal/day
`;
}