Summarize this article:

Your hamster will do best in a cage larger than 600 square inches, although 450 square inches or 30 inches by 15 inches is the minimum. It should also be more than 12 inches tall so as to be able to fit an adequately sized wheel, 10-12 inches for Syrians and 8 inches for Dwarfs. A glass aquarium (as long as it meets the minimum floor space) is a great home for a hamster. The disadvantage is the lack of ventilation, so make sure the lid is a wire mesh to allow for air movement.  An IKEA Detolf is an excellent choice too. Alternatively, the "cat tray with a wire top" type of hamster cage does have good natural ventilation. Make sure your cage is not in direct sunlight as your hamster could overheat due to the bright rays magnifying on the aquarium glass. Unless they're second hand, aquariums can be expensive. You can also purchase wire cages, which have great ventilation, just ensure that they are big enough. Many people make DIY cages, which are wallet-friendly and are great to make. One of the most popular and cheapest DIY cages is the bin cage, which is made with a 105-quart bin and mesh attached to the lid. Make sure there is plenty of ventilation. Don't place the cage in front of a hot window. Make sure to find a place that is quiet and free of any other household pets such as dogs and cats. This will reduce the stress of your pet hamster. At no point should you let your dogs or cats interact with your hamster. You’d be amazed at how clever hamsters are at escaping. Make sure all holes are sealed and that no loose or removable parts can be opened by your hamster. Be sure if you have a wire cage that your hamster can't fit through the bars or get stuck. The bar spacing of your hamster's cage should be no more than 0.7 cm apart for Dwarf hamsters and 1 cm for Syrian hamsters. It will need to be even smaller for a baby hamster. House Syrian hamsters and female Chinese hamsters alone. They are territorial starting at about the age of 5-8 weeks and will fight often to death with another hamster if placed in the same space. Some Dwarf hamsters can be housed together as long as they are properly bonded from a young age. The three species of Dwarf hamsters (Campbell's Russian dwarf, Winter White Dwarf, and Roborovski) can live alone or in pairs as long as they are introduced to each other properly. Don't pair different species of hamsters together. Mating pairs should not be permanently housed together as they may fight and injure each other. On the ground, there should be a layer of at least 6 inches of bedding. This might seem like a lot, but hamsters dig large tunnels in the wild. Many hamsters don't dig if there is too little bedding, so make sure to always add a big layer. Even if your hamster does not appear to be digging, leave the bedding inside in case your hamster really is or would like to start.  Softwood shavings such as pine and cedar are just not good for hamsters, as they cause many health issues. They can cause respiratory problems and may contain harmful oils. However, aspen bedding does not contain the same harmful oils and is perfectly safe for your hamster. Never use cotton bedding. This is very dangerous for your hamster because it is indigestible, and strands of the bedding can wrap around limbs and extremities cutting off circulation and potentially killing your hamster.

Summary:
Pick the right cage. Place the cage in a safe place. Make sure your hamster can’t escape. Understand your hamster’s territorial instincts. Make up your hamster’s bedding.