Insomnia can be triggered by a number of possible factors, including worry and stress, underlying health conditions, and alcohol or drug use.
Sometimes it's not possible to identify a clear cause.
Stress and anxiety
Some people develop insomnia after a stressful event, such as a bereavement, problems at work, or financial difficulties.
The problem can continue long after the event has passed because they start to associate going to bed with being awake. This develops into an anxiety about sleep itself.
Having more general worries – for example, about work, family or health – are also likely to keep you awake at night.
These can cause your mind to start racing while you lie in bed, which can be made worse by also worrying about not being able to sleep.
Poor sleep routine and sleeping environment
You may struggle to get a good night's sleep if you go to bed at inconsistent times, nap during the day, or don't "wind down" before going to bed.
A poor sleeping environment can also contribute to insomnia – for instance, an uncomfortable bed or a bedroom that's too bright, noisy, hot or cold.
Drinking alcohol before going to bed and taking certain recreational drugs can affect your sleep, as can stimulants such as nicotine (found in cigarettes) and caffeine (found in tea, coffee and energy drinks). These should be avoided in the evenings.
Changes to your sleeping patterns can also contribute to insomnia – for example, because of shift work or changing time zones after a long-haul flight (jet lag).
Mental health conditions
Underlying mental health problems can often affect a person's sleeping patterns, including:
Physical health conditions
Insomnia can also be caused by underlying physical conditions, including:
In women, childbirth can sometimes lead to insomnia.
Some prescriptions or over-the-counter medications can cause insomnia as a side effect.
Check the leaflet that comes with any medication you're taking to see if insomnia or sleeping difficulties are listed as a possible side effect.