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

50 points by lajosbacs ↗ HN
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?

92 comments

[ 6.8 ms ] story [ 153 ms ] thread
> Blue light is a type of light that is emitted by the sun and by electronic devices, and it has been shown to cause strain on the eyes and disrupt sleep patterns.

I thought the issue for macular health wasn't "blue light" in particular, but high-intensity light energy in general: https://pubmed.ncbi.nlm.nih.gov/29044670/

You write very similar to chatGPT.
(comment deleted)
Dark, low contrast monitors mostly but you will eventually either become near sited or far sited as your eyes get older.
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.

My case exactly! Also mid 30's and I also have floaters unfortunately and according to my trustful ophtalmologist, there is little to be done about it.

It is not that I have a problem per se, but this condition made me realize that my eyesight won't get any better and since I depend on it for a living, well.

Same! It's one of those things nobody tells you about apparently. I remember being on a plane and looking out the window and seeing them everywhere all of a sudden, and naturally thinking something was majorly wrong. Rushed to the eye doc when I got home, he just did a few checks, shrugged, and said it's normal.
I had this realization while in snowy mountains. All is white and suddenly I thought that I had a lock of hair in my line of sight.
Turning brightness down is not recommended. You will experience more vision problems if you do it for long. Decreasing brightness decreases your field of vision, makes it harder for your eyes to focus and will worsen your nearsightedness or increase risk of getting it.

For more context, my eyes became much healthier after I increased the brightness of my monitor to 60% (250nits) since last 4 months. Before then I used to regularly use it at 10% (40nits). My power numbers were getting worse and I even had high IOP, which has improved now.

I've suspected this. Do you have any references?
What I wrote was based on my own observations. I tried looking up

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6201904/ This talks about IOP changes on using smart phones. And it increases more when done in low light.

I saw a lot of links for myopia in children and links to light exposure https://www.aao.org/editors-choice/sunlight-exposure-reduces... https://iovs.arvojournals.org/article.aspx?articleid=2705915 These articles are talking about overall exposure - spending time outdoors and find it to be of statistical importance.

https://webvision.med.utah.edu/book/part-viii-psychophysics-... See the section on illumination

"For recognition tasks, visual acuity is greatly affected by the level of background luminance. (Graph)

One theory put forward by Hecht is that within the rod population and within the cone population, there are differing sensitivities which are distributed randomly. Therefore, at high luminance, all cells are active for a high level of visual acuity. At low luminances, only cells sensitive to that level of luminances are active and because they are distributed randomly, the retinal mosaic is coarser thus a lower level of visual acuity is achieved (Graham, 1965).

Another possible explanation is that under limited quantal availability, quantal capture is more probable in the para-central and peripheral retinal due to greater spatial summation. Since photoreceptors density in this area is low, resolution is poorer. As light levels increase, quantal capture occurs more successfully at the central retinal (macula and fovea). A higher level of visual acuity is achieved due to the high photoreceptor density. "

I am not sure what all of these terms mean but I guess some good sources for you to check out. Do share if you find something interesting.

Do you think the floaters were caused/related by your time watching the screen or something else?
The eye doc said it was just some pieces of the inner eye drying with age, and normal.

I don't believe they were screen related, I just hated seeing them. I either got used to them after a couple years, or maybe the pieces have settled out of sight, as they don't bother me much anymore.

>The eye doc said it was just some pieces of the inner eye drying with age, and normal.

Same thing happened to me around my late 20s and my doctor said the same thing (so n=2 now).

I think mine were. I strained my eyes really bad over days of work, and then one day before going to sleep rubbed them. When I opened the eyes, I seen a brown clot in the middle of vision which after a month of treatment with eyedrops fell apart into lots of floaters / worms. 2 years later most of them dissolved, but some remain and vision is blurred a bit. It also turned out that most people I asked have floaters too, but if there aren't many, they're filtered out by brain. If you aren't looking for them specifically, they aren't visible. They are hard to unsee though once you seen them, so better not to try. )
Thanks @afidrya, what kind of treatment did you get?

Maybe it helps with mine.

Eyedrops name of which I don't remember, but I can try find if needed as they're commonly prescribed in Russia for this condition. I wouldn't recommend them though as turning a single clot into long wormy things was scary and annoying. I seen similar complaints from others who were prescribed these eyedrops. I'm not sure if they helped with dissolving the floaters, as I had smaller recurrence recently and not used any eyedrops and it's still slowly going away. Btw, if floaters are in the center, try moving the eyes up and down 10 times in succession - most of them should stick outside of vision.
I had bad floaters for a while, but either they healed or I learned to subconsciously ignore them.
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.

I'm waiting for new lenses/frames as we speak, and I made a mistake two years ago in accepting the "blue light filter" coating that they were pushing. It was horrible - everything was green, especially my peripheral vision. It ruined my experience off the computer. So I took the glasses back to the optician under warranty and requested they be remade without the filter coating. My experience immediately improved and I was satisfied with those lenses. Never again will I opt for that ridiculous blue light coating.

The blue light bugaboo is a hobby horse of my psychiatrist and other quacks. It really makes little difference, because the intensity of the light coming from your monitor or your smartphone is negligible compared to sunlight/daylight. What matters ten times more than blue light is what you are doing on that computer at night: are you engaging in bitter social media arguments? Playing twitch AAA games? Are you watching YouTube with a ton of fast talkers and ads and quick edits? That will amp up your hormonal imbalances and disrupt your sleep patterns surer than the color of light wavelengths coming into your retinas.

>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.

Is there any evidence that they work? Most implementations I've seen are essentially colorless, so I find it hard to imagine that they're blocking that much blue light.

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.

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.
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)

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.

> I personally use dark mode.

Why? I never use dark mode and never have eye problems. Sometimes sits for like 20 hours coding. All I do is keep the room well lit. I'm in my 30s.

I remember having eye straing a few times like a decade ago, but I guess that was from over eating sugar or something. If you have eye strain I'd guess it has some other reason than the screen or how you treat your eyes. Or maybe you need better glasses.

Edit: Dark mode would cause your pupils to dilate, maybe that is the reason for the eye strain people here see? Bright room with bright room keeps pupils small and maybe reduces strain.

Regardless of bright or dark mode, the screen intensity needs to be appropriate for your environment.
But we evolved to live during the day. Our eyesight get sharper in darkness thanks to pupil dilation, which mean people would feel it is better to read code in a dark room, but since we evolved to look at things in the sun maybe keeping the pupils dilated and eyesight sharp is the cause of the strain.
(comment deleted)
The parent comment's advice is good. There are problems with your reply and the replies to it. People are confusing "eye strain" with the long term permanent eye issues of myopia and macular degeneration. "Eye strain" has no long term effects, and there's no such thing as overuse of eye muscles causing soreness. And people confuse all sorts of things, like headaches from neck muscle overuse, with eye strain.

Eye dryness is the only real "eye strain" related issue that can have permanent effects. Ironically the advice of "rest your eyes to relax the muscles" might be helpful because it helps your eyes re-wet, as your blink rate lowers when engage in close up activity. The advice itself is based in the nonsense that the muscles can wear out.

> I remember having eye strain a few times like a decade ago, but I guess that was from over eating sugar or something

No, it wasn't, and I'm always surprised when people look for conclusions like this. Most of the replies in this HN post are anecdotal "here's what I do," and very few have an understanding of the actual issue and question.

I personally use dark mode because it’s comfortable. If you keep the room well lit there’s no problem.
One Arm length?

One hand length is like 6 inches lol

I think that has to be it. A hand is 4 inches, no?
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).
Good lightning is a must for me, my eyes are red pretty quick if i work with bad lights.
Code for less hours.
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.
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.

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.
> Every hour, get up and take a 5 minute walk. Don't bring your phone.

Good for my brain too. It is a must to get up and walk around. Looking at things, yes, but also thinking different thoughts.

Back when I worked in an office and when tobacco smoking was still a big, not shameful, thing, I would "adopt a smoker". I would pick a cigarette smoker and say "when you go smoke let me know" and I would go outside with them.

These days it is an ingrained habit and I get up and bounce around for five minutes or so every hour or so.

Every 5 minutes is a bit much, 20 or 30 minutes woudl be a lot more reasonable 20-20-20 rule and all that.
That's why the break timers have preference panes, I suspect. I find that having something go ding! every 5 minutes when I am on-task keeps me from getting distracted and reminds me to cut off any weird side quests earlier.
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.
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.

If all one learns to do is only "asking the right questions", then how would you know if what the AI has produced are "the right answers" ?
Well I mean, if at the end of the day the primary game is engagement, I don't think the right answer really will matter any more, at least in the broader context of a discussion forum.
You kicked yours off assuming you knew the answer. OP kicked theirs off with the root problem
Yeah, fair enough. I think I'm more used to posting on Reddit, where I think there's an expectation that you're offering something, in exchange for the information that others will provide. So I feel kind of dirty just asking people directly for information, but I guess I'm just wired to a different engagement model. It's also probably why I find News Hacker more intimidating.
You're very good.

No, I have not seen your post. I was coding away and genuinely was thinking about my eyesight and started adjusting my ambient lightning. Then I realized that I actually have no idea what I'm doing, so I have decided to write an Ask HN.

I wrote the title but was too lazy to find good wording of the subtitle (is one needed anyway?), so I had it generated with GPT3. I adjusted it by deleting one sentence.

What is interesting, is I've been feeding in prompts from /r/writingprompts on Reddit to see what gets generated. And the stories, while somewhat impressive, all have a certain feel to them kind of like they are formulatic. Or they have story flow errors or parts that can really fit any writing prompt.

Now, lately, when reading /r/writingprompts I every once in a while come across a response that reads very much like ChatGPT generated it. I guess the feel of the AI generated responses is somewhat like what you would get when a junior high schooler is asked to write a story and hasn't had much experience yet.

This is an interesting frame, to me. Like consulting an oracle; the priesthood must know how to ask the right question, to ensure accurate and irony-free prophecy.

Seems to me to be part of some kind of duality in models of epistemology; knowledge construction, vs. knowledge discovery through "search" of the hypothesis space?

I will say I've been wondering in general whether ChatGPT is going to break HN by being used to make HN sounding answer or questions to things.

Although at the same time if no one notices and continues to enjoy the reading, then maybe no one is harmed?

In my gut I would be very sad if ChatGPT content started flooding in

Anti-glare glasses
They work great, but are terrible for video calls as they reflect the light back so your eyeglasses look like "mirrors" to others on the video call.
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.

Asked the same question to an eye doctor. He said to look away for the screen periodically, at a different distance so your eyes must change focus. It is this focus change that keeps them exercised.

He said his patients with the healthiest, aged eyes are those who knit. They are constantly looking closely then away, closely then away, ad naseum.

I too have seen eye doctors that extrapolate incorrect conclusions from anecdotes. I'd consider looking for a different eye doctor.

Reducing focus in peripheral vision may help slow the progression of myopia (nothing can reverse it), so the advice might be ironically helpful even though it's based on complete misunderstanding of how the eye works. Again, it has nothing to do with muscle use nor the action of your lens changing focus.

Could you please explain, what your original comment means. Holding objects close to our face would cause an increase in our eye power? But again you also mention should reduce focus on peripheral vision which would be achieved by holding close to eye. What is the suggestion here pls? Sorry I am ignorant and really want to know.
Something I've heard in this vein was the 20/20/20 rule. Look 20 feet away for 20 seconds every 20 minutes.
hasn't the "blue LED light messes with your sleep" been proven to be a myth?
There's something about threads about eye health that lead to a lot more people completely guessing at science and biology, like yourself. I don't know why it's such a poorly understood subject, and why so many people guess at it.
> Blue LED light may be toxic to your retina with long term exposure.

I wasn't aware of this. Do you mean LED light specifically? Is it in some way inherently different from the much more intense blue light of the sun? I don't see how light from one source can be any more damaging than from another source; it's all just the same EM radiation.

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.

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.

Yep, taking short visual breaks fairly often is what did it for me. One thing I did was install bird feeders just outside a window of my office (WFH), which gives me a reason to glance away from the screen at a longer focal distance. Also, birds are neat, so that's fun.
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.

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.