Puppies need to be let out more often than adult dogs. As a general rule, you should not leave a puppy alone for more than two hours at a time.
Some breeds are more prone to separation anxiety than others. If your dog is prone to separation anxiety, you may need to limit the amount of time they spend alone.
Some dogs are more independent than others. If your dog is independent, they may be able to handle being alone for longer periods of time.
Crate training can help your dog feel more comfortable being alone. When crate training, make sure the crate is the right size for your dog.
Leaving your dog with toys or a puzzle can help keep them entertained while you're gone. This will help prevent them from getting bored and destructive.
Before you leave your dog home alone, take them for a long walk or play session. This will help them burn off some energy.
If you can, try to come home early from work or errands. This will help reduce the amount of time your dog spends alone.