The dog might look friendly, but if you don't know the dog, there is no way to tell how it reacts to strangers. If the owner gives you special instructions that differ to the ones told here, follow them. If the owner lets you pet the dog, ask the owner where the dog likes to be petted. If you see a dog with no owner loose on the street, proceed carefully and stay in position to defend yourself if necessary. Dogs chained up or left in a yard or other location with limited space may be more likely to bite, as are dogs eating or chewing on something. Approach these dogs with caution, and abandon attempts to pet them at any sign of aggression, as described below. Signs of aggression include barking, a tail standing straight up, raised hackles, growling, or a body held in a rigid position. Signs of discomfort, fear, or anxiety include lip licking, showing the whites of the dog's eyes, avoiding eye contact, holding the tail low, yawning, or pulling the ears back. Never stare into a dog's eyes, that usually makes them think you want to fight them. If the dog does not calm down or approach you within thirty seconds, abandon the attempt. Invite the dog to take the first step by squatting down closer to their level. More confident dogs only require bending over slightly, but don't bend directly over the dog, as this could make them feel threatened.  Sometimes, you can help a dog to calm down by introducing yourself. Dogs introduce themselves to each other by sniffing. Humans introduce themselves to each other by shaking hands. This works with a human introducing themselves to the dog. The human holds out the back of their hand to the dog’s snout, and if it sniffs the hand, it will usually calm down. Never squat down near a dog without an owner or a dog that is acting aggressive (see the signs listed above). Remain standing to defend yourself in case the dog attacks. If squatting down still hasn't attracted the dog, and it is acting shy or skittish (running away or hiding), look away since eye contact can be threatening. Make gentle, quiet coaxing noises; it doesn't matter what these are but avoid loud noises or noises that seem to startle the dog. Turn your body to one side to appear smaller and less threatening. Ask the owner for the dog's name and use it to coax the dog. Some dogs have been trained to respond to the sound of their name, and they may be less shy or aggressive. If the dog seems receptive to petting after these steps, or at least appears relaxed and shows no signs of aggression or discomfort, offer your fist for it to investigate. Hold your fist out towards its nose, but not directly against its face. Let the dog approach and sniff the back of your hand for as long as it likes.  Do not offer your open hand, as an unfamiliar dog may bite your fingers, thinking they are treats. The dog sniffing you is evaluating you, not asking to be pet. Wait until the dog is done sniffing before moving on. Don’t worry if a dog licks you. It’s just the dog’s way of saying they trust you and have affection for you, similar to kissing for humans. If the dog's muscles are loose (not stiff or tense), or if it makes brief eye contact, or if it wags its tail, it is probably comfortable with you. However, tail wagging may also mean the dog is tense and ready to bite.  Move on to the next section, but stop petting and offer your stationary fist again if it tries to move away.

Summary:
Ask the owner for permission to pet the dog. Be cautious if the dog has no owner. Back off if the dog shows signs of aggression or discomfort. Bend over or squat to invite dogs to approach. Coax shy dogs closer. Hold out your fist. See whether the dog is comfortable.