As a web developer, I need to use my computer for work. So for almost 10-15 hours a day, I work on my computer. Sometimes I get a very bad headache.

I am using the laptop on my bed while I use a pillow behind my back, and one under my body, and one long pillow under my legs. There is a fan and a low-power light (deem-light) in my room. What is the best way to avoid headaches in this situation?

  • 3
    I have heard from somewhere that focusing on far object after 10 minutes for 10-15 seconds will also help in concentrating on the work!! Commented May 8, 2017 at 19:20
  • 4
    It may not be the cause of your headaches, but the ergonomics of that setup are appalling. Please, for the love of all that is sacred, and for the sake of your health work at a real desk (as most others point out in the answers). Another thing: GET MULTIPLE MONITORS. You will get such a productivity boost from being able to get things done quicker with 2 ore more monitors that you will no longer have to work 11 hour days. I bet half your time now is spent switching windows or trying to recall information in a window you just minimized.
    – Dmitri
    Commented Jun 12, 2017 at 23:08
  • 3
  • Wearing contacts (or avoiding poor lighting angles) has reduced my eye strain to almost nil. It turns out that it was caused by squinting through sunlight to see my PC screen. I had simply never realized that it was my glasses, not the screen, which was causing the issue. Never had headaches, though; YMMV.
    – jpaugh
    Commented Nov 9, 2017 at 20:55

10 Answers 10


Your work posture, lack of lighting and too-long workday are major health risks. Change your habits before it's too late.

Too little light is a possible cause of headaches. To work comfortably on a computer, you need enough ambient light that the screen isn't the brightest element in the room.

A laptop is a very cramped work environment. It's much more comfortable to use a separate mouse and keyboard, plus a large external monitor, all set up on a desk that uses an ergonomically correct layout. With your current position, you're probably hunching your shoulders, which creates pressure on the nerves going to your arms. Your bent neck also creates pressure on the nerves. Both lead to RSI, which is painful and difficult to get rid of.

For a correct setup, see e.g. this document. Summary: all your limbs should be either horizontal or vertical. Monitor straight in front of you, center of monitor slightly below eye level.

TidBITS - Caring for wrists

Finally, 10- to 15-hour days are way too long. A normal work day is 8 hours, then you need to get away from the computer and relax your body and your brain. The occasional 15-hour day may be necessary, but when you do overtime more often, you quickly lose its benefit: when you work too much, you become less productive until the point where you complete less work in 15 hours than a well-rested version of you can accomplish in 8 hours.


I have the same problem a few years back when I started working in front of my PC, every day I feel very much headache. The things that I tried to get rid of this are:

  • I went for my eye checkup and found that my eyesight got affected, so the ophthalmologist told me to use specs. You have to be very specific about choosing you lens, he told me to use anti-glare lenses because eliminate the light reflection.
  • Don't sit continuously for many hours, take a break for 10-15mins in every one or two hours and avoid using any gadget at that time. Relax your eyes sit somewhere where you can see long range objects.
  • Keep doing exercise, especially there are several eyes relaxing yogas.

Hope it will help you.

  • Will Polarized lens will work?? Commented May 8, 2017 at 19:21
  • 1
    I also experienced a headache coupled with dry eyes during long days in front of computer screens. Went for an eye check and got 0.25 factor glasses which is superficially very little but made the dry eyes and headache disappear entirely. Commented May 10, 2017 at 23:53
  • Polarized lenses would make the screen darker (or completely black, depending on the polarization direction of the screen and glasses). It'd be easier just to reduce screen brightness.
    – Hobbes
    Commented Jun 8, 2017 at 9:30
  • Definitely get your eyes tested. If you do need glasses, tell the eye-doctor you need to work at a screen and you may be advised to get a second pair just for that.
    – RedSonja
    Commented Jan 9, 2018 at 14:26
  • Don't sit on your bed while working with a computer, but put the computer on a desk and sit down on a chair.
  • Respect the distanct between the screen and your face (ideally this distance is longer than the length of your arm).
  • Make sure that your eyes are on the same height as the top of your screen.
  • Keep out with fans and/or airconditioning: those tend to make the air more, even too, dry, which will irritate your eyes and which might cause headaches.
  • Regularly, get up and move around.
  • ...

Do not rest your head on the pillow, while working, it is the cause of your headache. I sometimes get severe headache when watching TV while resting my head on a pillow.

I also suggest you to use proper light, and minimize your computer glares if you have to work in the dark room.

You can also find more advice in the "Health SE" forum.

  • now a days i am working on total dark room.
    – bdspice
    Commented May 8, 2017 at 12:50

I'm a programmer and a sysadmin myself, so I deal with the same thing, especially since I use contact lenses as well...

  • Drink lots of water and keep away from coffee, energy drinks and alcohol (as they reduce your body's net water level)
  • Quit energy drinks entirely (I know you drink them :-P ), and stick to regular Coke or pepsi (not only were they reason for my headaches, but they also destroy your heart and insulin system over time)
  • Take regular breaks, even if your manager hates you for it. Keep away from any screen or monitor for at least 10-15 minutes every hour or two... (I personally do it after a given assignment or if I'm done with a nasty bug)
  • DO NOT WORK IN BED! (this also affects your sleep negatively... The bed is for sleeping ONLY!)
  • Make sure the room is well-lit (not eveybody can take sitting in a dark room, looking at a bright screen. Quick movements and flashes on the screen while it's dark also increases the chance of photosensitive seizures.)
  • Change poses or positions often (Most of your headaches are likely caused by muscle fatigue or stress)
  • Move your fan (as mentioned previously, the air flow can irritate your eyes further)
  • Close your eyes for a minute (a good quickie for getting your eyes moist again, breathing excercises optional)
  • Remove or add a pillow each half hour (forces you to change pose)


  • Get up from your chair or bed once in a while and STRETCH like you would after the best nights sleep of your life.

  • Move a part of your regular excercise regimen (if you have one) to different times throughout your day. (if you feel it's nescessary, get on the floor and take 10)

There are loads of tips out there, but my primary one is that you never work from bed again. This affects your sleep pattern a lot, since your brain adjusts itself for WORK instead of SLEEP when you go to bed. If you have insomnia, that'smostlikely also the reason... and insomnia itself can give dreadful headaches as well...

  • How do you know i drink energy drinks? i dont drink it and as a muslim, i am forbidden to drink alcohol. Dont be so sure,when you dont know anything properly
    – bdspice
    Commented Jun 29, 2017 at 22:10
  • 1
    barring certain brands and types, like eg. Cult Mokai, energy drinks are generally non-alcoholic... From my experience, programmers (and many, many other computer users) like to chug down energy drinks like there's no tomorrow, muslims included... That said, the statement was indicative of high probability, not a generalization
    – Tylon Foxx
    Commented Dec 1, 2017 at 9:49

Eye strain might be the cause for your headaches.

  • Get your eyes examined by a doctor and to make sure your glasses are the right prescription.
  • try out a different external monitors. I'm using a Dell Computer Ultrasharp U2415 24.0 in LED Monitor and love it.
  • adjust the contrast and brightness settings on your display. Maybe a lower setting will help relieve the eye strain.
    original image-link: https://cnet1.cbsistatic.com/img/ZZ4v3azXkXBk0-dkFWqSoKHTyFg=/770x433/2011/05/01/fd01f09c-67bc-11e3-a665-14feb5ca9861/PictureSettings1.jpg

More info: https://www.quora.com/What-is-the-best-type-of-computer-monitor-for-coding


One thing that works for me is to set your display to have white text on a black background.


Even your work implies a lot of time spent in front of PC, you should think about your health.

To avoid headaches:

  • Drink enough water (drink it often, maybe 1 sit every 20 minutes) - dehydration is common cause of headaches. Limit usage of coffee, eat healt food... Useful site if you´re more interesting.
  • Doing exercise, just go outside & walk, jogging. You should find time for yourself (stuff that lot of people just ignore).
  • Last (but not least) - control color temperature of your display; there is very useful program called f.lux. Personally, I use alternative for linux Redshift.

When I was had a headache, I used (and recommended to you) Cai-Pan Mint spray, which is based on peppermint oil. It have cooling-effect and relieve headaches, pains, stress etc.


Had a similar issue, just wanted to add some more tips to the already good answers. For me, this really helped:

  • Use normal glasses with quality aspheric lenses. Avoid varifocals and the like, they increase fatigue for some people.

  • Reduce the brightness of your monitor. I find that high contrast but overall low brightness is the best.

  • Try a dark background. I find that running apps in dark mode reduces eye strain significantly.

  • Get a bigger, higher quality monitor. I upgraded from 22" to 28" monitors. The cost was minimal, LCDs are so cheap these days, and it really helped. If you do this make sure you don't just bump up the resolution and make everything smaller - the 28" screens I got are 1920x1080 resolution, the same as the 22" ones. Having said that, if you can go 4k/5k and have Windows 10 or similar that supports it, that will also make reading easier.


There are lots of things to preserve your vision. The science of proper body positioning for various types of effort is called ergonomics.

Start by getting out of bed and either sitting intermittently with walking or try a standing desk with some foot pressure-relieving floor mats.

Practice the 20-20-20 rule:

Every 20 minutes, focus your eyes on an object 20 feet away for 20 seconds to relieve eye strain.

Adjust your environment to minimize contrast between the room illumination and your screen.

Increase the lighting level using indirect light to a minimum of 300 lux at the work surface.

Keep the coordinated colour temperature as natural as possible with 5000°K as the target value (this is the optimal for human eye efficiency). The monitor colour temperature can be lowered to this from its native 6500°K (too high which is stressful for viewing.)

Ensure your Vitamin A and D are balanced and sufficient for your best vision nutrient requirements for long screen-viewing hours.

Not the answer you're looking for? Browse other questions tagged or ask your own question.