Caffeine is a stimulant. It stimulates wakefulness and can disrupt sleep patterns. It takes about 3-5 hoursTrusted Source for the effects of caffeine to wear off. Therefore, it is best to avoid caffeine for at least 4 hours before going to bed.
In some people, consuming caffeine at any time of the day could have a negative impact on sleep quality. For these people, it may be best to avoid caffeine altogether.