The ASPCA's first instruction is to work out why the dog is barking before trying to change it, because the fixes are different. Its list has nine kinds.
Territorial: at people, dogs or animals coming into or near what the dog considers its ground.
Alarm: at any sight or sound that startles it, anywhere. The body is stiffer than in a greeting.
Attention-seeking: at people or animals to get food, toys, play or simply a look.
Greeting: at people or dogs it wants to meet, with a relaxed body, excitement and a wagging tail.
Compulsive: repetitive barking, in the ASPCA's words like a broken record, often with repetitive movement.
Socially facilitated: because another dog is barking, even one far away.
Frustration: when it cannot get to something it wants, or cannot move.
Illness or injury: dogs sometimes bark in response to pain. A dog whose barking is new and has no pattern is a vet visit before it is a training problem.
Separation anxiety: only when the dog is alone or about to be left. Petipedia has a page on that.
What works
The ASPCA's general advice is short. Do not shout. Never give the barking what it is asking for, whether that is attention, the door opening, or the food. Reward the quiet, every time, so quiet is what pays. And give the dog more to do: more exercise and more work for its head, because a bored dog barks.
Collars
The ASPCA reports a study in which citronella spray collars were at least as effective at stopping barking as electronic shock collars. It also says both are punishment devices, not a first step, and not for barking that comes from fear or anxiety, where punishment adds to the fear that is causing it. The same logic is on Petipedia's page on the ladder a dog climbs before it bites: punishing the warning teaches the dog to skip the warning.