🛠️ToolsShed

Calorie Calculator

Calculate daily calorie needs based on age, weight, height, and activity.

These are estimates based on the Mifflin-St Jeor equation. Consult a healthcare professional or registered dietitian for personalized nutrition advice.

Calorie Calculator estimates your daily calorie needs based on your personal characteristics and fitness goal. It combines your Basal Metabolic Rate (the calories burned at rest) with your activity level to find your maintenance calories, then adjusts that figure up or down depending on whether your goal is to lose weight, maintain, or gain muscle mass.

Enter your age, height, weight, sex, and activity level. Then choose your goal: a calorie deficit for fat loss (typically 250–500 calories below maintenance), maintenance for body recomposition, or a surplus for lean muscle gain. The tool shows recommended daily calories, protein, carbohydrate, and fat targets based on widely accepted nutritional guidelines.

These numbers are starting estimates. Everyone's metabolism is slightly different, so track your body weight and energy levels over a few weeks and adjust your intake by 100–200 calories if your results don't match expectations. Consulting a registered dietitian can provide a more personalized plan.

Frequently Asked Questions

Code Implementation

def bmr_mifflin(weight_kg, height_cm, age, sex):
    """
    Mifflin-St Jeor BMR formula.

    Parameters:
        weight_kg - body weight in kilograms
        height_cm - height in centimetres
        age       - age in years
        sex       - 'male' or 'female'

    Returns Basal Metabolic Rate in kcal/day.
    """
    bmr = 10 * weight_kg + 6.25 * height_cm - 5 * age
    return bmr + 5 if sex == "male" else bmr - 161


ACTIVITY_MULTIPLIERS = {
    "sedentary":    1.2,   # little or no exercise
    "light":        1.375, # 1-3 days/week
    "moderate":     1.55,  # 3-5 days/week
    "active":       1.725, # 6-7 days/week
    "very_active":  1.9,   # twice/day or physical job
}


def tdee(weight_kg, height_cm, age, sex, activity_level="moderate"):
    """Total Daily Energy Expenditure = BMR × activity multiplier."""
    b = bmr_mifflin(weight_kg, height_cm, age, sex)
    return b * ACTIVITY_MULTIPLIERS[activity_level]


def macros(calories, protein_pct=0.30, carb_pct=0.40, fat_pct=0.30):
    """
    Split calories into macronutrient grams.
    Default split: 30% protein / 40% carbs / 30% fat.
    protein & carbs = 4 kcal/g; fat = 9 kcal/g.
    """
    return {
        "protein_g": calories * protein_pct / 4,
        "carbs_g":   calories * carb_pct   / 4,
        "fat_g":     calories * fat_pct    / 9,
    }


# Example: 30-year-old male, 80 kg, 175 cm, moderately active
b = bmr_mifflin(80, 175, 30, "male")
t = tdee(80, 175, 30, "male", "moderate")
m = macros(t)

print(f"BMR:            {b:.0f} kcal/day")
print(f"TDEE (moderate): {t:.0f} kcal/day")
print(f"Protein:        {m['protein_g']:.0f} g")
print(f"Carbs:          {m['carbs_g']:.0f} g")
print(f"Fat:            {m['fat_g']:.0f} g")

# Weight-loss / gain targets
print(f"\nWeight loss (-500 kcal): {t - 500:.0f} kcal/day")
print(f"Weight gain (+500 kcal): {t + 500:.0f} kcal/day")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.