The pain you feel when you have a headache is caused by pain-sensitive structures called nociceptors. These structures are found at the ends of certain nerve fibers. Factors such as stress, muscle tension, or dilated blood vessels set off a chain of events that can activate the nociceptors. Once activated, they send a signal up the nerve fibers to the brain. The brain reads that signal as pain.
The part of your head that hurts depends on where the activated nociceptor is located. Pain-sensitive areas within your head include a network of nerves that extend over the scalp as well as nerves of the face, mouth, and throat. The muscles of your head and the blood vessels along its surface and at the base of the brain are also sensitive to pain. Your skull bones and brain tissue never hurt because they don't have pain-sensitive nerve fibers.
The brain also releases certain chemicals during the pain process. These can cause inflammation, swelling, and increased pain sensitivity. The chemicals can also irritate the nerve fibers in your head.
Different types of headaches have different causes. To find out more about these types of headaches, see What are the different types of headaches? To find out what causes a specific kind of headache, see the following topics below.