Relatively speaking, it is safe to do your laundry overnight, but experts generally warn against it as your machine could pose a fire hazard. As a result, whether or not you choose to run your washing machine while you are asleep is down to personal preference, but you should absolutely avoid running your tumble dryer, as this proves to be a more formidable risk.
If you have to run your washing machine at night due to money-saving concerns or a less conventional daily timetable, it's all the more important to have smoke alarms fitted throughout your home, particularly near your machines to help mitigate some risk to your home and health.