How do I calculate daily calories for my size?

I want to lose weight. I'm going to start intermediate fasting, but I'm not sure how many calories I should eat daily, or how to calculate it.

I'm 6 foot tall. And weight 250. I want to get to 170-180 again, then start building muscle.

How do I calculate this stuff?