HACKER Q&A
📣 lajosbacs

How do you protect your eyes while coding for long hours?


We often spend long hours staring at a computer screen, which can take a toll on our eyes. What are some effective ways that you have found to protect your eyes during these long coding sessions? Do you have any specific techniques or strategies that you use to prevent eye strain?


  👤 dottjt Accepted Answer ✓
Okay, so this is what I find interesting about this post.

I actually posted this exact same thing a few days ago, and admittedly at the time, I was fairly confident that it wouldn't kick off because the title was kind of half-arsed and confusing. But also, it was uniquely me. I didn't really care.

And when I read this title, it sounds like something ChatGPT would have produced, in a very general way.

Even the body sounds very ChatGPT. So I wonder if this user decided to repost my post, in a way that would actually get engagement.

Then it got me thinking: Maybe we're reaching a point where the only thing that really matters, is your ability to create prompts. Your ability to ask the right questions to AI, so you can produce the right answers. That will be the future of humanity, and your inability to adapt to this way of thinking will hinder you.

Just an observation. Nothing more. But yeah, that title is way, way better.


👤 stevebmark
Don't worry about "eye strain." Muscular use of eyes has no long term effects. Eye dryness does probably does but I don't know much about mitigating it.

Blue light affects your circadian rhythm, use blue blocker glasses, use F.lux. Adjust phone and device brightness to be the minimal amount you're comfortable reading. Don't use full screen brightness at night, especially because your pupils are more dilated in lower light environments. Use dark mode everywhere you can.

Blue LED light may be toxic to your retina with long term exposure. The jury is still out on this one, but the above steps will help mitigate the issue.

The other issue is emmetropization and nearsightedness. Incredibly important to understand for children. It will affect you too if your eye prescription continues to change. It usually stops in your 20s (your vision stops getting worse), but for some it continues to degrade past that. Holding things close to your face keeps your peripheral vision in focus, making your eye think it's over-focusing, so the eye grows longer (more near sighted) to try to correct. This happens without the brain's involvement, it's all based on focus on the retina. Your eye doctor should know about this process, should know about low dose atropine, and should know about glasses with fogged edges, especially for children. Most don't.


👤 aizyuval
I asked an ophthalmologist (My father) about the issue:

He thinks that healthy habits keeps you safe.

As a general rule, try to avoid making too much effort.

• Avoid sitting in a dark room with just the monitor on.

• avoid being too close to the monitor. Distance of one hand length is enough, but not less. (Half of this for your phone).

• Have breaks. After one hour, give your eyes some minutes to refresh.

I personally use dark mode.


👤 nullify88
I use https://github.com/AutoDarkMode/Windows-Auto-Night-Mode to automatically switch Windows and a handful of apps to dark mode / light mode depending on sunset.

I think its counter productive to have dark mode enabled all the time and I can feel my eyes strain when using it during the day. Windows, VS Code, Office 365, Edge and a handful of websites that follow the OS settings switch themes. I wish more laptops or screens had ambient light sensors and I would use that instead to trigger the theme switch. Maybe theres a way to use the webcam?

I also have a blue light filter on my glasses, and have enabled the OS blue light filter for a stronger effect when its night.


👤 tartoran
In addition to the filters and blue light reduction, I noticed that staring at magic eye “stereograms” relaxes my eye muscles, removes headaches in minutes. It works for me, may work for others. Once I lock my eyes on the behind the page plane I move my eyes everyehere on the image without loosing focus, corners too. Helps me tremendously. Got nothing to lose to try it, basically enjoy some magic eye stereograms from time to time. Play with sizes too. Both screen or printout versions work out for me.

Another obvious one is stare out the window but it’s not as immediate as stereograms to me.


👤 silisili
I turned my brightness way down, mainly because the floaters I got in my mid 30s started really annoying me. I use dark mode where I can.

Lastly, I just don't code for long stretches anymore. I usually get up to walk around every 60 or 90 minutes, for my knees and my eyes.


👤 jerrygenser
As others have said, you can add blue light filter either based on app or monitor configs.

If you were eyeglasses, it's worthwhile to pay an extra bit - usually on the order of $50-$100 - to get a blue light filter built directly into your glasses.

Further, my optometrist specifically recommended that I use slightly underpowered prescription. I'm at about 90% of what my glasses prescription could be but he tells me that this means my eyes will strain less. It has seemed to work for me since after a few years of having to increase prescription every 1.5 years or so, it's starting to slow down. Could be anecdotal or caused by aging but something to bring up with your own optometrist if you have one.


👤 ThrowawayTestr
I'm surprised no one's mentioned it. I hear the 20-20-20 rule is effective. Every 20 minutes spent using a screen, look away at something 20 feet away for 20 seconds.

👤 kazinator
1. Use a small font. Use a font so small that you can only read it when your eyes are rested and in relaxed focus. When your eyes are tired and dry, you will have to take a break due to not seeing the code even if you strain and squint.

2. Use bitmapped fonts; avoid the fuzzy-wuzzy antialiased nonsense. (I am currently using a font called knxt by Constantine Bytensky which is almost perfect, save for the comma being too small and confusable for period). Alternatively, if you use antialiased fonts, use an 8K display. On 2K or less, bitmapped.)

My (1) recommendation comes from experimenting I did as a lad at university. I used different font sizes from very small to huge. I found that the large fonts led to fatigue. I tried to analyze why and realized that it was because the large fonts continued to be readable in spite of fatigue. I could go without blinking for minutes at a time, yet be able to read the text, and so didn't pull myself away from the terminal. When you are in "the zone", you tend to push your body's signals aside. You might delay going to the washroom in spite of a full bladder, and ignore dry, straining eyes and discomforts caused by bad posture.


👤 spicysugar
Hey i was in the same place roughly a year ago and i did come up with some measures which i find satisfactory when I reflect upon them.

Looks like people already familiar with the argument have given excellent scientific advice for your lifestyle in general.

But i would like to specifically focus on the things that practically worked for me when it comes to coding.

1. Try going warm when going dark. I suggest Gruvbox themes for it. I personally use a variation of it called Gruvbox material on vscodium.

2. Prefer using the simplified reading mode in browsers whenever feasible.

3. Use a feature like night light and try to balance the brightness alongside to get a perfect condition(subjective) where the text is legible and has enough contrast. My opinion is that having more night light is much better than a lower brightness. Effects of night light go aesthetically unnoticed in dark modes.

4. Use thin fonts. I use fira code light. They are easier to read from what I had studied then.

5. Matt screens are a pleasure for eyes to work with


👤 HTTP418
When working from home sometimes I'll keep cold cucumbers by my desk and put them on my eyes whenever I'm feeling any strain. Usually when my eyes are straining they are also warmer than normal. I guess you can use anything that doesn't cause your face to be covered in water when it warms up.

👤 gremlinsinc
Night Eye chrome plugin + clipon rose tinted blue-light blocking glasses, I have a light phobia, I mean I'm not afraid of the light, but bright light paralyzes me and makes me want to cover my head w/ a blanket lol. Natural light I can deal w/a little better, bright overhead lightbulbs are the worst, soft dimmable programmable lights are the best.

I have glasses for a stigmatism but rarely wear them (my vision is like 19.5/20 or something like that, but that was 4 years ago), except lately I have because of the new clipons I got from Amazon they were like $20 for 2 one's darker than the other. Supposedly it helps get better sleep if worn before bed, but that's not my primary purpose. It's namely so I can just have less light like when I can't avoid a white page in chrome or something.


👤 epirogov
I have found great option for me is grayscale mode in Windows and Linux. For Windows you need to enable Color Filters in settings, then you can use Win+Ctl+C to toggle this feature. This help for me when I tired within a days to see colorful but not interesting content. From this I way out to gray monochrome monitors world, thank you for feature I don't need to by real monochrome monitor for me. But often I make monitor zero bright, zero contrast for most text typing tasks. This really help every day. An last but not least, I use only warm color temperatures.

👤 rg111
I have been a nerd all my life with long reading and computer hours. My eyesight has barely gotten worse.

Here are the things that I do:

- Blue light filter on all screens, whenever indoors. That's 100% of times on most days.

- Lowest possible viable brightness on all devices.

- Ambient lighting. An expensive RGB strip on the back of the monitor works. So does $4 table lamp from Amazon behind the monitor.

- ARC glasses/blue light cutting glasses on 24 hours.

- I take breaks often following a pomodoro cycle. And I go outside in those. I categorically avoid any kind of scrolling or checking on devices (after I read and followed Deep Work by Newport).

- I eat a lot of vegetables.

I got glasses in 2nd standard. And people who got glasses latter than me and many less nerdy than me have thicker glasses now.

I sit in front of a screen for 12-14 hours a day for years. I don't suffer from anything eye-related.


👤 jeffbee
Every 5 minutes, for several seconds, look at something else that is much further away. Every hour, get up and take a 5 minute walk. Don't bring your phone. Generally do much more thinking ahead of time so when you sit down to code it's all over except the typing.

👤 otikik
Code in your own head while taking a walk away from the screen, several days per week if possible.

👤 jerrygenser
There's a 20-20-20 rule where every 20 minutes look at something 20 feet away for 20 seconds. This helps to rest your eyes and reset from the strain of looking a fixed amount in front of your face for so many hours.

👤 iknowstuff
* multifocal contact lenses https://www.reviewofoptometry.com/article/add-multifocals-to...

* I sit by a window, so I end up naturally staring off

* night shift and dark mode https://iovs.arvojournals.org/article.aspx?articleid=2689610

* always with ambient light around me, never in the dark


👤 pengo
I work at home in a low light room. I have my 4K laptop screen at 25% brightness, and the 38" 4K monitor above it at 5% brightness. I eschew dark mode in my IDE and other apps in favour of a light theme. Since making these changes I no longer suffer eye fatigue.

Interestingly when I create music (same monitor but a Mac Mini) I turn the 38" monitor up to 35% because the Mac fonts are harder to read at that resolution that my Linux laptop's.


👤 grepLeigh
Even if you don't wear glasses for distance or reading, consider getting computer glasses. Computer glasses have the blue-light filter mentioned in other posts, with slight magnification that helps your eyes relax while focused on a computer monitor.

Take frequent breaks and focus on objects at different focal depths (stare out a window and count leaves, look for patterns in clouds, mentally trace a pattern across an opposing office building)


👤 pull_my_finger
Try the 20 20 20 rule. Every 20 minutes, fix your eyes on something at least 20 feet away for at least 20 seconds. This is fairly easy to implement if you do pomodoros as you'll be stopping around then anyway. I get up, refill my coffee, stretch my legs, then go and stand at the door for a while and look at the trees or whatever for a little bit before going back and getting back to work.

👤 odiroot
1. Keeping all my displays at low brightness and adjusting the room lighting to more or less match it.

2. Dark mode everywhere I can. Unless an app has completely terrible (e.g. low contrast) dark theme.

3. Desk never facing a wall, rather open room. Let's me rest my eyes at something farther away than my monitor.

I don't bother with f.lux or similar. Find it a bit pointless and annoying. Much better to lower the brightness.


👤 bradlys
Only thing you really need to do is go outside because of the sustained bright light exposure. Everything else is kinda moot.

It’s why it’s important for kids to spend a significant amount of time outside. Your eyes degrade due to low light exposure. Even well lit indoor spaces are incredibly dark compared to the outdoors. Your eyes were made for the outdoors.


👤 32gbsd
Dark, low contrast monitors mostly but you will eventually either become near sited or far sited as your eyes get older.

👤 CyanLite2
Blue Blocker lenses.

Also, I get "Plus One". Talk to your eye doctor. They can do "ADD +1.00" to your prescription to make things larger but still in focus. You won't have to hunch forward either.

Then I make all of my IDE font settings larger. I see less on the screen, but I have less eye strain.


👤 ericpauley
I use a glasses prescription 1 diopter weaker than my regular lenses, and sit about a meter from the display. In this setup, the effective focal distance to the monitor is at infinity (actually a little beyond as my regular prescription is underpowered as well).

👤 jbritton
This article suggests that dark mode maybe protective against myopia while bright mode may induce myopia.

https://www.nature.com/articles/s41598-018-28904-x


👤 kkfx
- blue-light filter glasses (originally from a serious local shop, after have tried the cheapest I found on-line I discovered they are the same)

- monitor backlit to the minimum

- dark themes

- LARGE good-enough monitor with a certain distance (~1m)

I still feel some effects, but do not know anything realistic to do better...


👤 ushercakes
I use https://justgetflux.com/ and have it set to night mode at all hours. I also wear glasses with blue light filtering. No issues with my eyes anymore personally

👤 smrtinsert
I use a decent size monitor but lower dpi than my Mac screen as my latest. In my experience my eyes will exhaust much sooner against the Mac screen than my Samsung to the point of blurring.

👤 jedberg
I use flu.x to set my color temperature to 5900K instead of the default 6900K. Makes a huge difference.

I use dark mode.

I also make sure to look up and outside the window at least every 15 minutes.


👤 lost_tourist
I generally use a timer to get up and move around every 60 minutes to stretch my legs and defocus my eyes.

👤 tonis2
Good lightning is a must for me, my eyes are red pretty quick if i work with bad lights.

👤 yashbhatnagar
Program in breaks and wear blue-light glasses.

👤 nisaacs2
Take a break. Go outside.

👤 jasfi
20mg Lutein per day.

👤 davzie
Code for less hours.

👤 morbidious
Anti-glare glasses

👤 jjtheblunt
i use varying font sizes