I'm not pulling this out of a hat. Science suggests that caffeine is not just a stimulant that keeps you alert, it can also improve your mood and help you become a walking ball of sunshine. This may seem like a tall order for caffeine... but wait ‘til you order a tall cup of coffee and experience it yourself!
Based on a review conducted by A. Nehlig, having 75mg of caffeine (a cup of coffee) every 4 hours can lead to a “pattern of sustained improvement of mood over the day.” It can increase alertness and well-being, help concentration, improve mood and limit depression. 
Keep reading to find out more!
The relationship of caffeine and mood, according to science
To understand what exactly happens, you need to know this chemical called adenosine.
Your body breaks down a high-energy molecule called ATP, which is needed for its constant supply of energy. As it performs this function, it liberates adenosine, a sleep-inducing molecule in your body that causes sleepiness. When adenosine binds to adenosine receptors in the brain, it slows down nerve cell activity, making you drowsy.
Here comes caffeine, which looks like adenosine. As an “adenosine receptor antagonist,” caffeine is recognized by the nerve cells and receptors as adenosine. When caffeine binds to the receptors, it blocks adenosine and inhibits the latter’s effects on your body. 
So instead of slowing down nerve cell activity, caffeine does the complete opposite – it stimulates you!
Here’s a TED video that explains it:
According to the video, adenosine receptors are linked to dopamine receptors. Dopamine are chemicals in the body that trigger feelings of reward and pleasure. When adenosine docks in the receptors paired with dopamine receptors, it makes it harder for dopamine to fit and bind. As a result, the pleasure feeling gets inhibited.
But when caffeine occupies the adenosine receptors, it creates the opposite effect. Dopamine can fit the receptors this time, and the feeling of pleasure goes in full gear. 
As a result, you become more alert, less bored, and generally in a great mood!
However, the mood-enhancing effects of caffeine and how you achieve them depend on the following factors:
How tired you are.Highly-fatigued adults are more likely to observe significant mood changes (for the better) compared to those who are less fatigued. 
Age. Older coffee drinkers tend to experience caffeine’s mood-enhancing effects more compared to younger ones. 
What time you get your caffeine fix. Caffeine is more likely to boost your mood when you take it later in the morning. 
Whether you’re a regular coffee drinker or not. If you love your coffee and drink it regularly, then you’re more likely and frequently to see caffeine’s positive effect on your mood compared to non-coffee drinkers. However, greater improvements in performance are more noticeable among non-consumers. 
4 ways caffeine affects your mood
Now that you know how caffeine interacts with your body, it’s time to learn how it can be your much-needed happy pill. Here are the different ways it can boost your mood and overall well-being:
Caffeine keeps you alert and attentive.
We know that caffeine is a psychoactive drug that serves as an effective stimulant. The most widely embraced effect of caffeine? Alertness and heightened attention.
Studies support this claim:
According to The Coffee Science Information Centre, 100 to 200 mg of caffeine or a cup of coffee makes you more mentally alert. 
60 mg caffeine dose results in “clear enhancement of sustained attention and alertness, contentment, and mood.” 
100 mg of caffeine in your body can lead to “significantly decreased lethargy/fatigue and increased vigor.” 
Caffeine can help ease and reduce the risk of depression. 
We previously covered the relationship between depression and caffeine at length. But there are also several studies and research pointing to the positive effects of caffeine on depression:
A study conducted by JAMA Internal Medicine shows that women who have caffeine are shown to develop lower risk of depression. Following 800 women in the US in a span of 10 years, the study took note of the participants’ caffeine consumption and depressed feelings, eventually reporting that those who consumed 4 or more cups of coffee per day were the least likely to become depressed verses those who didn’t. 
An experiment shows that caffeine can help us respond to stressful situations better. Thanks to the chemical effects of caffeine, we can cope better with bad mood or a depressive state in the face of threat or pressure. 
A research study examines “the relationship of coffee and caffeine intake to risk of death from suicide,” suggesting that its chemical effects lower the risk of suicide among men. 
Caffeine can turn you into a ray of sunshine.
According to the Harvard School of Public Health, you can become happy and positive by just drinking coffee. Substances in caffeine can tap into the reward systems of the brain, thus mimicking the effects of a mild antidepressant. It’s important to remember, however, that coffee shouldn’t be used to cure depression and taken as a replacement for antidepressants. 
Caffeine helps you get along with other people better.
We just need to follow the logic here. Being tired can often result in lapses in judgment. But having caffeine as a stimulant can lead to ethical decisions and motivate workers to stick to their guns and keep to the choices they make. 
Another study shows that coffee helps people appreciate their colleagues more. An experiment compared participants with caffeine in their system and those that were given decaf drinks. The former group turned out to think of their co-workers more positively compared to the latter subset. 
Caffeine can enhance your mood, but proceed with caution
Having a cup of coffee definitely brings a lot of benefits especially for your mood. But as with everything in life, make sure you drink it in moderation. Overdoing it may result in the following:
Erectile dysfunction. In combination, those are two of the ugliest words known to man. But can caffeine help you get it up?
Science hasn't found the definitive answer to this question, but one study concluded that fewer men who consume caffeine have problems performing. The study said:
Caffeine intake reduced the odds of prevalent ED, especially an intake equivalent to approximately 2-3 daily cups of coffee (170-375 mg/day). This reduction was also observed among overweight/obese and hypertensive, but not among diabetic men. Yet, these associations are warranted to be investigated in prospective studies