This is something very close to me (I was really overweight until around age 17) and actually something I was considering posting about, so here are my tips backed up by scientific research:
In order to lose weight (as mentioned earlier by irjza), you need to take in less calories than what you use during the day (your TDEE, Total Daily Energy Expenditure). There are many calculators online for working out what your TDEE is, but to be honest everyone is different and you'll have to work this out through trial and error (which I'll explain later). Average BMR (Base Metabolic Rate, the amount of calories your body uses just to stay alive without additional exercise) is around 2100 for adult woman, and 2300 for adult men. It gets a little more complicated than this, but I will summarize the main points.
In order to maintain lean muscle mass while still burning fat, you need to be in a calorie deficit while meeting minimum amounts of macro nutrients (protein, fat, and carbs). The minimum amount of protein needed is about 1.8g / kg goal bodyweight, the minimum amount of fat you require can be estimated at around 1 g / kg bodyweight, and any remaining calories you can fill up with carbs / more protein.
There is a lot of bro-science online regarding protein intake (with some people saying up to 3 g / kg is necessary to "protect" muscle during a cut), but there is no evidence to back up these claims; a study was done with participants operating at a calorie deficit of up to 1000 calories while doing lots of cardio, and 1.8 g / kg was enough to conserve muscle mass.
Fat gets a bad rep with most people. Dietary fat does not automatically result in body fat (being in a calorie surplus does). There are 4 different types of fats you'll generally see mentioned on product packaging: Saturated, Monounsaturated, Polyunsaturated, and Trans. The differences and benefits of these are beyond the scope of what I'm trying to explain, so I'll summarize it as follows:
- The only bad fat - which you should stay away from - is Trans fats. Your fat intake should be a mix of the other 3.
- Good easy sources of monounsaturated fats are extra virgin olive oil and macadamia nut oil.
- Some polyunsaturated fats (like flaxseed oil) can go rancid very quickly (flaxseed oil should actually be sold refrigerated, which most places don't do, and has a much shorter lifespan than other oils), so I would recommend either getting these in food (such as fatty fish), or fish oil capsules (tip: keep these in the fridge).
- For cooking, use Canola oil instead of sunflower oil or olive oil (it has a much higher smoke point, and thus will stay healthy even at high temperatures where the others would break down).
- Peanut butter is awesome, eat lots of it

Before we get to an example, I just wanted to talk about calculating your TDEE. This is going to fluctuate a lot while you're losing weight, so you'll have to rework the numbers from time to time. I would recommend starting off at 2100 or 2300 and sticking with it for a few weeks. Keep track of your weight during this time, and if you're gaining a little bit or staying the same, then your TDEE is most likely going to be lower than what you estimated it at. Just reduce it by 100 calories or so, and keep track over the next couple of weeks. Remember fat loss is not a quick fix: in order to lose weight effectively, and keep it off, slow and steady wins the race! Go too quickly, cut out too many of the things you like, and you'll most likely end up failing.
Example time, so let's take an 80 kg male:
He estimates his TDEE at 2300, and wants to plan his macro nutrients around this. His protein requirement in order to maintain muscle mass would be 144 g (576 kcal, at 4 kcal per gram of protein / carb), his fat intake would be 80 g (720 kcal, at 9 kcal per gram of fat), and this would leave him with 1004 kcal left over. He should fill this up with carbs / protein as he sees fit.
Assuming he was right about his TDEE, he should not gain or lose weight over a few weeks. If he estimated lower, he should be losing weight, and if he estimated higher he would be gaining weight. Based on the values he sees, he can alter his TDEE estimate and recalculate his macros.
So all of this should be fine until you start getting into the low teens / single digit bodyfat percentage for guys, or mid teens for woman. When you get to this point, there are some other factors that come into play since your body starts lowering your BMR to conserve whatever fat stores it has left and you can very quickly hit a plateu. If anyone has read this far, and is still interested and would like me to include some more references / summaries of what happens at this point I will.
Also with regards to what food you should be getting, this is a whole other subject. I can give you information that I have found, and my own tips and tricks for sticking to diets and which foods to eat / avoid if anyone wants me to.
Here are some references for all this information:
Sorry for the wall of text, hope someone finds this as interesting as I do
