Desktop wallets are safe, but not the safest. And countless number of times these online wallets have been hacked. But, there are various safe online wallets as well, like Atomic wallet, Guarda, Exodus, etc.
The thing with online wallets is that some of them store your private keys on their platform, and as it's an online wallet it means that your keys are stored on an online server. And you can imagine how unsafe that is, considering all the hacks that have taken place in the past.
The safest wallets are the hardware wallets, the best one being Ledger Nano S. The only upside of having online wallets is that your crypto can be accessed anytime anywhere. And hence, trading becomes slightly easier. That's not the case with hardware wallets, as they are to be linked to a software wallet (a companion wallet), and then only can your crypto be accessed.