If you notice that your Xbox isn’t online, you should take a look at a few aspects.
1. If your Wi-Fi or Ethernet doesn’t seem to work well, try resetting your router and checking it once more.
2. In Settings, select Network to make sure the internet works.
3. You should check the status page at the link above to see if Xbox Live has any outages.
4. Restarting or updating your console can solve the problem.
5. Try to bring your Xbox closer to the router if you’re using Wi-Fi.
Should everything else not help, get in touch with Xbox support to figure out a solution.