Daily calorie needs
BMR, the calories your body burns at rest, is counted with the Mifflin-St Jeor formula from sex, age, weight and height. Times an activity factor (1.2 to 1.9) it gives your daily need (TDEE).
To lose weight the calculator takes 500 kcal off - about half a kilogram a week; to gain, it adds 300. Protein is 1.6 to 2 g per kg of body weight, fat a quarter of the calories, carbohydrates the rest. These are estimates: watch your weight for two or three weeks and adjust.