Whenever I sit down to program, I quickly become extremely sleepy and mentally drained, almost as if my brain shuts down as soon as I begin coding. I may feel reasonably alert beforehand, but the tiredness appears soon after starting. This is also a new problem—I used to be able to program for hours without feeling this way. Has anyone experienced something similar, and what helped?
4 Answers
Make sure the basic health factors are covered: enough sleep, regular meals, hydration, movement, and a comfortable workspace. Since this is a new and persistent change, it would be sensible to discuss it with a doctor if improving those habits doesn’t help. They can check for general health issues, and a therapist may help if attention, stress, or burnout seem involved.
Sometimes this happens when your brain is readjusting to sustained, focused work. If you’ve been spending more time on highly stimulating activities, programming can feel unusually demanding by comparison. Building your focus gradually, taking short breaks, and practicing consistently may help over a few weeks.
It could also be a sign of boredom, overload, or burnout—especially if the sleepiness disappears when you switch to videos or other highly engaging activities. Try shorter coding sessions, easier tasks, and a proper break from programming if you’ve been pushing too hard. You don’t have to force yourself through the fog.
I’ve had something similar with hobbies I used to enjoy. After doing them too intensely, my brain started associating them with pressure instead of enjoyment. Taking several guilt-free days away and returning with smaller, more interesting projects helped me. If the tiredness happens with many activities—not just programming—that’s more reason to get it checked.

Even eating well and sleeping enough doesn’t rule out every possible issue, since people differ in how they absorb and process nutrients. If the fatigue continues, getting professional advice is better than guessing.