It’s a general rule not to feed dogs chocolate. But why not?

Chocolate is made from the cocoa plant, a plant native to the rainforests of America. The cocoa plant contains the chemical theobromine which can be toxic to dogs.
Theobromine is an alkoid, meaning it appears in many plants, like the cocoa plant, the tea plant, and the kola nut.
In general, eating a square of chocolate won’t harm a dog, but eating a whole chocolate cake will. Depending on the type of chocolate, theobromine content will vary, meaning some types will be more harmful than others: 

Chocolate Type    Theobromine Content (mg/g)
White Chocolate    0.01
Milk Chocolate    2.4
Dark Chocolate    5.5
Dark Baking Chocolate    16


For example, if a 25kg dog ate 100g of milk chocolate, he probably would be fine, whereas if the same dog ate 10g of dark chocolate, he would vomit and have diarrhea.
Different species have different tolerances to theobromine. These are measured by LD50, a way a finding how much chocolate it will take to have a half chance of dying. LD50 for theobromine varies from animal to animal, depending on how fast their metabolism is. The slower the metabolism, the less theobromine needed to poison the animal.

Below shows the LD50 of different animals:
Animal    LD50 in mg/kg
Human    1000 mg/kg
Dog    300 mg/kg
Cat    200 mg/kg
Mice    1000 mg/kg
Rat    1000 mg/kg

Although cats have a lower LD50, they cannot taste sweetness, so they are less likely to eat chocolate. 
So, in summary, chocolate poisoning varies from chocolate to quantity eaten. The poisonous chemical in chocolates is called theobromine and dogs and cats can be poisoned if they eat it. Humans can tolerate more theobromine that dogs can, so we are able to eat chocolate. Theobromine tolerance varies from animal to animal and is measured by LD50. So, don’t feed your dog chocolate!