The trickiest part of this isn't really the number of calories - it's realizing that every body responds differently. From what I've seen, when people cut too aggressively (like 500+ calories in a day), they do lose weight but then end up looking kind of deflated, precisely because they lose muscle along with it. The safest deficit is actually pretty modest - something like 250 to 400 calories a day, depending on how much you weigh and your overall lifestyle.
The people above are right about pointing out protein as crucial, but let me be honest: there's no point having protein in decent amounts if the rest of your diet is all over the place. Protein matters, yeah, but you also need consistency - training, eating well most days rather than some, getting decent sleep. It makes way more of a difference if you can manage 200-300g of protein daily (depending on your weight) and a chill calorie deficit over months than bouncing between cutting 500 calories one week and not cutting anything the next.
The trick really is this: start moderate (like 250 to 300 calories less than you normally eat), keep protein high, stick with exercise, and give it time. If you don't see progress in 3-4 weeks, then dial it back a bit more. But too fast and your body starts going into economy mode, it gets harder, and you lose muscle. Patience is really your best tool here.