Caffeine in coffee can promote wakefulness and increase exercise performance, but it can also cause problems with sleep and anxiety in some people.
The stimulating effects of caffeine from coffee last 3–5 hours, and depending on individual differences, about half of the total caffeine you consume remains in your body after 5 hours (7Trusted Source).
Consuming coffee too close to bedtime, such as with dinner, can cause sleeping problems.
To avoid caffeine’s disruptive effects on sleep, it’s recommended to avoid consuming caffeine for a minimum of 6 hours before bed (9Trusted Source).
In addition to sleep problems, caffeine can increase anxiety in some people (10Trusted Source).
If you have anxiety, you may find that drinking coffee makes it worse, in which case, you may need to consume less or avoid the beverage completely.
You can also try switching to green tea, which contains one-third of the caffeine in coffee (11Trusted Source).
The beverage also provides the amino acid L-theanine, which has relaxing and calming properties (12Trusted Source).
Caffeine can cause sleep problems when it’s consumed too close to bedtime. The stimulant may also increase anxiety in some people.