Why do Cats like boxes?

It's simple:

The main reason why cats like to play and hide in boxes is that they feel safe and comfortable. Mostly because this way they can't be reached by predators from back and side.

It's important to look at other reasons that could lead a cat to rest in a cardboard box. It could also help them as stress-free zone where they can keep away from stressful situations for a while. Cardboard boxes also can help cats to keep they body temperatures more stable. 

Not just cardboard boxes but other types of enclosures can be choose by your cat as well.

Tips:

1 - When getting a new package, save the cardboard box for your cat.

 2 - You can close the box with tape and cut some holes in it (so your cat can come in and out) to make it more fun.

 3 - Leave some toys around that your cat can drag inside the box to play or cuddle.