Based on weight, height, age, sex and activity level, nutrition experts have guidelines that describe how many calories you need to maintain your weight. Eat less than this, lose weight. Eat more, gain weight. That's the basic concept. Of course metabolism and percent bodyfat plays a part, which can not be factored into this calculator.