Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Any scientifically proven techniques to boost concentration?
288 points by amznbyebyebye on Feb 25, 2022 | hide | past | favorite | 186 comments
I feel like I have to be in a very specific head space to write code. It’s like climbing a big hill but in my head. Sometimes it’s effortless and sometimes it’s a slog.

Are there any proven exercises or techniques I can adopt that are proven to boost my ability to focus and get in that clear headspace to write code?

Edit: adding some tips as I try to figure this out. Note: not scientifically proven (to my knowledge)

1. Music. which type depends on the individual.

2. Timing. Dead of night or early in the morning when the world is quiet. Not this isn’t a muscle you can flex at any time, you have to just capitalize on the right time.

3. Long shower

4. Caffeine

5. Get out of the office/house go somewhere else (like a cafe)

6. Take a walk

7. Have a beer

8. Write thoughts down in a notebook without any phones/laptop in sight and then jump to the laptop to implement

9. Meditate

10. Lift weights / exercise to work the demons out and quiet the mind

Exercise (mostly I've seen more intense than walking, but cardio like running, cycling, rowing, etc. - I haven't come across much for resistance training like weightlifting) has been very well studied to improve cognitive ability, as well as mental health (depression/anxiety). Depending on what you mean by proven, it's not gravity, but it's pretty good evidence compared to just about anything in medicine (just look at the numerous citations testing various aspects/study designs/different populations).

Just a few studies (there are countless): https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3951958/ https://pubmed.ncbi.nlm.nih.gov/20065132/ https://pubmed.ncbi.nlm.nih.gov/35153701/ https://ju.se/download/18.4662178a174aa5f82061c573/160103080...

I also read creatine, while used mainly to improve gym perf, helps wirh cognitive ability too.

I've been taking creatine monohydrate for years to improve cognitive function. There has been no visible cognitive effect, but it's greatly reduced exercise injuries.

That's odd. Creatine stores are in muscles. I'm not saying it isn't the case, the body is weird as fuck, but I'd be interested in understanding how that's the case.

It’s because creatine is used by the body to convert sugar into adenosine triphosphate (ATP). ATP is what your body actually uses for energy inside cells for things like contracting muscles and nerve impulses (like in the brain for things such as “thinking”).

ATP can’t be made in the brain, instead it is made by muscles. That’s why exercise and higher levels of creatine are good for cognitive performance and memory.

Wait I don't think this creates the logical connections to validate what he's asking

There are studies on creatine and cognitive performance.

My work performance has increased tremendously since assembling a treadmill desk. The book In Praise of Walking delves into why it works.

Not joking: stop going on the internet. It's scientifically proven to boost concentration. More specifically, do one thing, and only that thing, for a set time period. Do not check your phone, do not even have it in the same room. Do the one thing until time is up.

Since accessing the internet (and sometimes even the Web) is often a part of an IT job, the "one thing" approach is pretty helpful. Keep in mind what are you doing. If you're reviewing a pull request, you only need the Github page, and not the rest of the pages on the WWW.

Also, timeboxing things helps. It's hard to work on one thing indefinitely, it can even induce panic. But if you're using something like the pomodoro technique, you know that when you're feeling a craving to switch, you have, say, 27 minutes left until the next break. It's observable and manageable; you can concentrate during this time, knowing that a relief is nearing. But the relief (like going for more tea / coffee / etc) is also timeboxed, so you don't get distracted forever.

> If you're reviewing a pull request, you only need the Github page, and not the rest of the pages on the WWW.

In Firefox, you can set browser.tabs.tabMinWidth to a large number in about:config, so that fewer open tabs are visible at once, which may reduce distractions.

Or (slightly more complicated) you can keep a fixed number of tabs visible irrespective of window width, by using userChrome.css to apply a style like `tab:not([pinned=true]) {min-width: calc((100vw - 12em) / 3) !important;}`

I'd like to strongly second timeboxing here. This is how all really busy people do it in my experience.

> Since accessing the internet (and sometimes even the Web) is often a part of an IT job

Reading the manual used to be part of an IT job. And for web devs, having a local sandbox is invaluable.

Just doing one thing at once, close all your tabs, facebook, and any other time-wasters. Then I set a pomodoro timer for 60min and work until it's done. Currently using Befocused Pro. That is the best way to focus on something that you are procrastinating on.

I've replaced a lot of my normal web surfing time with putting in some bluetooth headphones and listening to audiobooks. Much more fulfilling than spending hours on the internet where I can't even remember what I did that whole time, and you're freed up to do other things like work out, prep food, clean the kitchen, etc.

Not sure if it has improved my concentration, but it has improved all sorts of aspects of my life in surprising ways. Like I'm now the type of person who doesn't mind hand-washing all the dishes where, in my 20s, I'd let them pile up in the sink—I just do it while listening to a book.

How do you go about this? Audible or something?

I’d like to do this but wouldn’t know how to make it routine (e.g. lining up audiobooks to read, loading them on a phone).

I’d like to see if I can steal your “workflow” ;)

It works. I found myself getting distracted and one day I pledged not to switch tabs or panes when a programming task involves a pause, such as getting a new build. I'd either stare at the screen or switch to a related programming task. This brought out a tremendous difference in my concentration spans.

This is like saying "stop eating too much, you'll lose weight".

You have to eat and you have to use the internet.

What's the solution to not doing it to your own detriment?

No, you do not "have" to use the internet. Internet is very much unlike eating (unless we're talking about eating habit forming trash foods)

The best way to deal with the 'internet' is to have a seperate device - call it an "internet terminal" - connected to the internet - preferably in another room, or completely opposite side of the building.

And thus when a necessity to access a particular piece of information arises, you specifically get up and GO TO the 'terminal' to do that specific information retrieval action.

Sort of like going to a library to pick up a particular book.

Kind of like RMS does when he asks people to email/print him out webpages.

Certianly harder to pull of for people who do web-development related thigns.

Problem is, some of us goes into loops: Check email, check youtube, check hackernews, code a bit or do code review or work meeting, check email, check youtube, check hackernews etc....it can get draining really quickly, esp with the current events going on (covid, war etc). Biggest boost to productivity at this point is to forcibly shut everything out for a few hours. PiHole helps me with this.

A few weeks ago I installed the browser plugin Intention on my workstation. It has been great, having a reminder that I am getting distracted and being given the option to be distracted on purpose for a limited amount of time.

Whenever I go on twitter it messes up my momentum for that whole day. At least that's how it seems.

Do you have a citation for the „scientifically proven“?

Ha - true - but not the answer we are looking for ...

Thanks for the reminder to get off!

Video game music is actually designed to increase your ability to concentrate on the game. I highly recommend listening to some as you're coding. You can get it at Bandcamp [1,2]. Trance music also works, especially Goa Trance.

Binaural beats [3,4] are also worth a try.

[1] https://bandcamp.com/tag/video-game

[2] https://bandcamp.com/tag/video-game-music

[3] https://en.wikipedia.org/wiki/Beat_(acoustics)#Binaural_beat...

[4] http://gnaural.sourceforge.net/

Couldn't agree more, Goa trance/Goa psych is great for this. I usually throw on digitally imported [1] for listening and discovering new genres. My recent favorite is psydub and melodic house.

[1] https://di.fm

And I thought I’m the only freak to listen to goa/psy trance while coding - I’m most likely to get in the flow while listening to it.

That might make some sense. I've been running Cyberpunk 2077 playlist when starting coding sessions. Kind of get me in the mood to start fighting. It might have helped that these audio clips have been mentally linked to real-life fighting. (in the game, of course).

There’s something to this. I’ve noticed an increase in heart rate, possibly a sympathetic reaction with the effect of pumping more blood to the brain? In any case it is not long before beat fatigue sets in and my mind is worse off.

This happens to me with higher BPM music e.g. drum & bass or techno, but with lower BPM and a little melody (but no voices) I can listen for 10-12 hours while coding without beat fatigue.

Dr Huberman from Stanford has a great weekly podcast where he talks about how to improve all parts of your body/mind for various activities(sleep, exercise etc.). Here’s one on improving productivity: https://youtu.be/Ze2pc6NwsHQ

One of the tips from the video that I really love is called the cathedral effect. It was found that having high ceilings increases your creative capacity when doing an activity.

Came here to suggest this episode, it is a gem.


Just joined a Flow Working workshop by Dr. Antoine Larchez and had some interesting results. As a lifelong (functional) procrastinator with diagnosed ADHD, I brought down 2.5h of effortless (once started) work on paper, some of the best in a couple of months if not years.

I have yet to see whether the methods are scaleable and replicable for me, but a lot of the content resonated with me, especially the insight that concentration to flow states is a skill that can be learned and brought down from 20 minutes to just one with training.

It was an interesting mix of fundamentals from Cal Newport (Deep Work), plus mind emptying exercises, concentration meditation, exercise breaks and group work sessions.

I'll probably dig more into it.

What did you do different to get the 2.5 hours of uninterrupted work done?

Basically meditated, emptied my mind by writing down any tasks I'm procrastinating or ruminating on, identified the fears behind them, set a goal, did a quick exercise and then just did it in 50 minute chunks, but with the phone completely off, any windows in single focus and most importantly with the camera on and 10 people watching (== not really watching but doing their own tasks).

Had a pretty sizeable psychological effect though.

I used to do sessions with FocusMate before which worked, but in a bit of a hit & miss. Key differences to this workshop was the length (blocking half a day, uninterrupted) and the guidance through it, taking away brain cycles for managing.

Still a bit unsure how to fully replicate that experience on my own, but just experiening that someone was able to trigger this kind of focus in me, on a dreaded task, on demand, had a profound effect in me to go try it again.

> just experiening that someone was able to trigger this kind of focus in me, on a dreaded task, on demand, had a profound effect in me to go try it again

Thanks. You realized what you're capable of.

As someone who also has adhd and is a functional procrastinator at times saboteur I'm curious if you could elaborate on your "mind emptying exercises"?

This reminds me of an exercise from David Allen's "Getting Things Done" called "Mind Sweeping" or "Brain Dumping": https://gettingthingsdone.com/2015/05/podcast-03-david-allen...

Write, in anyway that feels mentally relieving. Whether it’s a journal or a whiteboard.

A couple of things to add to your list:

Go to bed early - 9-10pm and wake up when your body feels like it for a change. If it’s 4-5 am, you get more hours of dark and focus time and your brain is at peak executive thinking, so you can see the bigger picture and write much wiser code.

Fasting for a bit may keep your focus as well for a while. If you wake up and are distracted from hunger, drink a cup of plain while milk or plain yogurt. The protein and fat will be an instant boost to your brain and you will stay focused until you get hungry again. If you keep to meat, dairy, or sugar-free protein and fat you kan keep your focus all day. Carbs will crash you.

When you feel tired or unfocused, or ready to go to social media, take a nap instead. You can eat some carbs now as they can help you fall asleep faster. When you wake, apply the same principles.

I had to work for my own startup for a while and a squeezed a whole bunch of top quality code out of my brain. Without enough sleep or quality fatty protein, the brain gets distracted more easily or operates only at lower levels of abstraction.

Yes. Fasting can get you into ketosis, which can enhance focus.

Avoiding carbs and sugar prevents insulin spikes and that prevents "brain-fog"

A few more from Dr. Huberman:

ADHD & How Anyone Can Improve Their Focus - https://www.youtube.com/watch?v=hFL6qRIJZ_Y

How to Focus to Change Your Brain - https://www.youtube.com/watch?v=LG53Vxum0as

I've tried to listen Huberman so many times but have hard time focusing. He seems to rattle off a list of things without any emotional hooks to keep the user engaged.

I tried watching the first six minutes of one if the above videos and it was all just fluf or advertising for his sponsors. No actual information. Podcasts in general seem like such a poor and inefficient way to acquire information. A brief article in Wikipedia that can be the jumping board for further explorariob is always so much better for me.

Also, you can install Sponserblock so that such segments are automatically skipped on youtube.

The adverts are at the beginning. Just skip forward if you don’t want to listen to them.

These podcasts are actually very dense with information once you get past the adverts.

Same. Use the time guide provided under the video, makes it easy to skip ads or sections you are not interested in.

Clever -- I'll use it. Hadn't noticed it before.

Exactly my experience. I have a feeling that he talks way to much and without a pause throwing large number of unconnected points leaving you bamboozeled on what to actually start with, what is the most proven and would give best bang for the buck.

I normally have a hard time watching long "monologue" videos but I feel like Huberman usually does a good job of keeping my attention. He speaks with eloquent intonations and maintains a piercing eye contact with the camera. I admit his videos can be a bit tedious sometimes but I just frame them as "classes", which makes them easier to bear.

He could for sure add in some sugar to help the medicine go down, but it would make the already long videos longer.

His videos are very long. A lot there but I haven't been able to get through one yet. 2.5 hours is long. Could be 3 or 4 videos.

I am only 2 mins into the first video but I am hyped - thanks for posting this!

I guess it didn't work then, lol.


Enjoy! I recommend you start from the oldest videos and work your way forward. He often mentions to past videos and some his content builds on top of older content. It is time well spent. His demeanor/cadence & carefulness on choice of words is very clear and appreciated. His videos also have bookmarks so it is easy to find things in the future if you want to refer back to something.

I’m not sure if it makes sense to try to find a “scientifically proven” technique if all you want is something that works for you. What works for a large group of people in a controlled scientific study does not necessarily work for each individual in that study, let alone for you.

You could do a scientific study on yourself, though. Figure out some objective way to measure your own concentration, and then try various interventions one at a time to see which intervention correlates with the best concentration. You could also try combinations of interventions—having a beer while taking a shower?—to see if you can get an even stronger effect.

I’ve never done such an experiment on myself, as planning and implementing the experiment would distract me so much that I wouldn’t be able to concentrate. So I just exercise for a while every morning. That seems to work—for me.

I think, what most people want is a pill that makes them less distractable.

Ritalin is that pill. I know a bunch of devs that take it to code through the whole night.


1. It usually requires a prescription.

2. While it lets you hyper-focus on one task for hours, if you not careful that task could be rearranging your cutlery.

thats a good way to burnout on coding my friend.

Yes, probably.

I can only speak for myself, but the only thing that boosts my concentration is to buckle down and concentrate - which rules out most of the above. It usually takes a couple of hours before the effect is noticeable. (I'm not claiming to be good at it, but I have learned what works for me.)

The other thing is to notice when I am no longer able to concentrate any more, as it is no longer productive to keep going. When that happens, any of the above might be helpful, but that list is missing the most important one: get enough sleep.

Your list is mostly of solitary (or not explicitly social) activities, but socializing is also helpful for me.

I've found that reading helps a lot, even if it's difficult to maintain the focus at first it gets better. My brain was so hooked on the dopamine hits of constant online chat, phone notifications etc. Now I wake up and read a book for an hour before starting the day (I turn off phone / laptop and put them in a drawer) - it makes a big difference.

I can't find relevant studies, but there's a few scientists who say that reading improves focus: https://www.ncu.edu/blog/reading-improves-memory-concentrati...

Fast. Like more than 48 hours water only.

First of all it kinda puts you in this “survival” state where while not feeling hungry per say, you’re on high alert and can concentrate like crazy.

And after you finish you feel rejuvenated and excited. Amazing experience and can’t recommend it enough. Done it several times already (4 days fasts) and still having the same initial effect.

After listening through all of the science in Lifespan (the book and the podcast) have started the “only eat in the evening” routine. Like I skip breakfast and lunch.

Still in my first week so its kinda hard, but after another week or two my glucose levels are supposed to stabilize and I would not be feeling the pangs of hunger and highs and lows of sugar spikes after a meal and brain fog after the insulin response has sucked all of the sugar from my blood (and brain).

Its that what I’m really after - steady brain performance throughout the whole day. Will see if I adapt and that actually happens!

This is what I do too! I do only dinner two days a week, no other meals on those days. Must work, I built fastcomments this way :)

Also naps! 20min naps are a nice reset to fix concentration issues. I wrap my head in a blanket so I fall asleep fast and set a timer.


Before going to a water fast, especially for a 2 whole days, talk to your doctor. Not everyone can fast, even for shorter times, and you might not know you are in that group. Ancedote: I have a friend that was hospitalized for doing a much shorter fast - daytime fast for religious reasons. As far as he knew, he was healthy enough for it and he was young at the time.

Or just really ease into it, and get to know how your body responds. And learning what to eat (and how much) when you break your fast is even more important.

For example, the latest studies show that multi-day water fasts are much harder on the female body than the male body, and can sometimes cause their hormone levels to go out of whack, so they don't recommend going longer than 12 hours when you're first starting out.

Folks, please seek actual medical advice rather than something on the internet. Fasts can hurt you, and are a backbone of some eating disorders. No matter how much you ease into it.

I have done intermittent fasting, but I lose too much weight while doing so. I really liked the benefits. Especially fasted cardio feels so good.

I'm already fairly slim (1.90m and <80kg) and become a complete stick man after doing this. Anybody know how to do this and how to stay in shape at the same time.

> Especially fasted cardio feels so good.

I noticed this too, if you mean the after effect. It almost got me a little worried though, since the good feeling is probably caused by a release of endorphins, which should usually get released as a response to pain. But I'm not sure.

Just to add, it is possible to gain weight while doing intermittent fasting. You just have to eat more :) Maybe add a meal so you don't eat 3x a day but 4x. The other tactics is to add 50g of some nuts to 2-3 meals a day, like walnuts, almonds, cashews...

Based on consistently feeling as you describe in your opening sentence for over two decades in many different life stages and concept, let me suggest a reframe:

The good news is that "sometimes it's effortless". Consider yourself blessed. For a lot of people that is never true and though they may even achieve some professional success by grinding, it will be joyless and likely not lead to real career satisfaction.

Now in terms of optimizing your coding output, don't focus on minmaxing this as if you were an assembly-line manager trying to squeeze out your next ounce of performance. Instead recognize that coding is a creative craft that depends hugely on your state of mind. Focus on finding ways to recognize and harness the energy overall, but recognize you can't force it. This comes in two parts:

First, if you are procrastinating diagnose that by practicing self-awareness at all levels. For me it can range from something as simple as eating the wrong lunch all the way up to existential crisis about how I'm living my life, and everything in between. This is obviously non-trivial, but it can be hugely important. A lot of folks mention exercise here—and I agree—but I would broaden it to include ones overall physical and mental health. By addressing those things holistically one establishes the conditions to allow inspiration to strike.

Once that is established then you need to recognize and harness the energy when it comes to you. It might be on a schedule, it might not. You might have an understanding boss who gives you carte blanche to organize your own deliverable schedule, or you might need to some stakeholder jiujitsu (up to and including finding a new job) in order to carve out space to make your process work for whoever is putting money in your pocket. The point though, is not to adopt some external productivity narrative (I was brought up with the puritan work ethic) but to instead recognize and optimize for the tao of your own abilities.

I used to avoid music with lyrics, but (for me anyway) I’ve realized I can concentrate just fine when there are lyrics as long as I’m listening to songs I already know. I usually put on a playlist that’s maybe an hour or two long and just let it repeat all day.

Action movie and game soundtracks tend to be great for this.

I suspect it’s because they needs to have an emotive effect without distracting you from the story.

On a mostly-plant and a few fish diet: I supplement zinc on an empty stomach, and 750mg EPA+(a little DHA) Omega 3 oil early in the day and find both aid focus, the second more directly.

https://news.ycombinator.com/item?id=24696601 https://www.healthline.com/nutrition/7-supplements-for-vegan...

There are many incremental improvements that can make a small difference, but in my opinion the most important thing is to optimize your environment first and foremost.

One of the most effective strategies I've learned isn't necessarily cheap, but it works: Get two computers. One is your work computer. You only work on it. One is your play computer. You only play on it. If you struggle with self-control, use extensions to block or limit your time on sites like HN, Reddit, Twitter, and others on the work computer.

For me, physically moving between the two computers helps reinforce the separation. If visiting HN is an alt-tab away, it's easy to drift off when there's a lull in work or I have to wait for a compile. If I have to actually get up and move to waste time, I will put deliberate thought into it and, most of the time, not do it.

If you have the space, creating a separate home office that is in a different room from your play computer is golden. That's a lot to ask, obviously.

For a more accessible alternative, consider isolating your distracting activities to only your phone. That's what I do most of the time. I only use the phone distractions while I'm walking, which helps wake me up in the process.

Totally agree. I even go with three. One work gave me, one for my own hard mental work and one for everything else.

For me, I am just not going to play on my personal work computer after going through the trouble and space to set all this up.

I think Sam Altman had the same answer to this question lol

I’ve gone the caffeine route before, and it works but only until the crash. The heart palpitations aren’t worth it, IMHO.

I’ve had a subscription to Brain.fm for a bit over a year now. Supposedly it doesn’t work for everyone but I find the act of picking a 60 minute Deep Focus block, probably just as much as the music itself, really helps me keep my head down.

Not scientifically proven, but I used to listen to and love these free playlists: https://musicforprogramming.net/latest/

I’ve found that sometimes I need some accountability / social element to help me actually accomplish work. It’s also related to point (5) about going somewhere else, or as Cal Newport puts it, doing a “grand gesture” to signal to yourself that you value getting the thing done, and now you’ve incurred some cost to set yourself up, you better do it.

To help achieve this effect while working remotely, I’ve used https://www.flow.club/ and recommend it

It helps you: (1) actually block time off in your calendar to do focused work (2) set your intention for that chunk of time (3) create an accountability mechanism by telling the people in your session your goals (4) creates cognitive dissonance if you let yourself get distracted (since you told people what you would be doing, and have to tell them at the end of the session what progress you made)

In my experience, the first step is to get the physical basics right (sleep, exercise, nutrition/hydration). This is already hard for most people, but can bring you to 100% of your theoretical mental performance as the baseline.

To go beyond that, a daily routine of 2x20min meditation is somewhat proven to increase your mental capabilities slowly over time.

Also background Music (like Trance or game soundtracks) have some instant effect, I personally have great results with Endel.io - highly recommend!

I don’t believe it’s scientifically validated, and I don’t have a direct link off hand, but check out Trataka, which is staring at a fixed object for a set amount of time (e.g. a candle or an image with a dot).

HealthyGamerGG YouTube channel has videos on it.

Apparently the yogis have been doing it for 1000s of years.

Netra Trataka to be specific(Netra- Eyes). My dad has been practicing yoga for the last 30 odd years(he is 75 this year) survived a near fatal Heart attack(occlusion) but doing well now with the help of couple of stents and Yoga!. This stuff works. For the real.

Meditation works well for me.

I have a cushion next to my desk and whenever I can't focus or don't know what to do next, I sit for ~5-10 min with eyes closed and usually the next best task becomes apparent. I then visualize it clearly and think about the sequence of steps needed to accomplish it.

If I don't do that, I usually find myself wasting extra time before I arrive at the next task, or I feel more low-energy / unfocused that I would have otherwise.

Regular exercise pairs well with this to keep your baseline energy up.

-Definitely sleep,


-removing distractions ie a clean room.

- Caffeine.

- optimized by vitamins b6 b12 magnesium and c . Have Tested levels prior to correct dosage vitamin intake

- being relaxed / ie having a weekend of doing nothing

- good nutrition ie not McDonald’s

- Red Bull but only in extreme situations and very seldom

- good sex

-avoid alcohol and anything similar such as cigarettes etc

I've literally improved my concentration at work in the past 2 weeks. Started travelling to a wifi cafe 25mins away by subway. I listen to post-rock music while coming and going on good headphones. The bass and thumping guitar grooves clear my head. The deadline to get out of the house and clear demarcation make it easier to get into the flow zone. I get more work done in 4 hours than I used to get done lounging around my house in 8.

I've tried most of the things in your list. By and large they don't really help with concentration. The most effective thing I've found is 20mg of Adderall. Not thrilled about that, but it is what it is.

Is what it is... but in my opinion/worldview: if there are bounds to how much concentrated work you can get done per hour/day/week, then you shouldn't need to chemically enhance/alter that. You're free to choose to, but you make it sound like you feel obliged to for work.

Even if one can get exactly 2 hours of work per week done, well, some people just have a disability and not all disabilities are obvious or visible. Modern societies should make up the difference. If someone is simply unable to, I'd be happy to pay those extra 5% taxes to make it possible that they have a normal life by doing what they can and no more and no less.

I'm not sure if this is the right forum for such opinions as, from a European standard, the US has very little like this, but I guess there's no point only ever preaching to the choir / staying within the bubble. This is just how I see it.

This is a great music source: https://musicforprogramming.net/latest/

Start right when you wake up after a coffee and shower. Don't give your brain any time to get interested in anything else.

Write high level skeleton code / notes to get the juices flowing

You can try to game your mind. Set a timer and say, I'll do this in 20 minutes. It works well for me.

Also having people code on a second monitor is somehow inspiring, like Andreas Kling :)

Discipline/schedule helps! But don't let the schedule prevent you from taking advantage of when you're feeling creative.

I also posted advice elsewhere in this thread.

I've been taking L-Tyrosine, CDP Choline and sometimes Aniracetam. My mood is sunny and remakeably sustained for the entire day.

I'm even a bit too concentrated, working too long and hard.

For me I have noticed that either one hemisphere is ready to create or the other. Example: if my mind is cold for writing. Then drawing is hot. But if sketching is cold, then writing is hot. And yes. Caffine helps everything.

Note: often you can work in the same problem either visually or with text.

Some of the comments here are really nice. I want to add the Endel app with it's soundscapes has helped me concentrating too: https://endel.io/

In a similar vein, there’s one called brain.fm which I’ve used for years now and it gets me in the zone every time.

8 hours of sleep every day. You lose time, but get back double the brain power.

Ritalin, I guess? Not exactly a technique but since you included caffeine.

See a psychiatrist about a possible ADHD diagnosis and any associated medications that could help.

No phones in sight (unless you code phone apps I guess). No notifications. And I write down any thoughts that my brain wants me to get into for later.

This (no phones, no notifications) has singlehandedly been the most effective step I have taken for better concentration.

I struggled to find a description of it on the web (everybody gets hung up on secondary details like 'light a candle' and 'read a sacred text') but basically you can

(1) set a timer for some specific time (say 5-10 minutes to start, could be more once you get experienced; it's important to use the timer so you don't need to think about when to stop.)

(2) meditate by closing eyes, focusing on the breath, relaxing, for a short time. (practice this by itself first if you are starting out) eyes closed is important because the point is to get your brain producing alpha waves.

(3) focus on some object (could be a thing in the your environment, could be something you visualize) and whenever your mind wanders from the object you put your attention on the object and tell yourself "that is interesting but this is more interesting". it does not matter if you are eyes open or closed at this point because the concentration state involves the brain producing beta waves.

What you are describing is "mindfulness" exercises; basically a modern take on meditation.

I have the app "Meditation Studio" which consists of some softly-spoken people talking you through breathing exercises and relaxation - would recommend for anyone wanting to try these techniques.

... except I hate the word "mindfulness". There is a specific person I know who talks about "mindfulness" and then walks into an open pit.

I don't think there's much sense in hating it. It has a real and interesting meaning, but it's just rare to hear anyone provide it.

The problem is that understanding it rests on something most people have never even heard of, much less looked into themselves: that experience does not actually work how they think it does. Experience seems panoramic, i.e. continuously seeing, continuously hearing, etc. But that's not the way it actually is. Experience actually consists of a very rapid series of micro-messages from the sense bases, and those are stitched together by the mind to provide the illusion of panoramic awareness.

Once that's understood, you can give the real definition of mindfulness: remembering to know what kind of message the mind is currently knowing. This will be like watching attention flicker between knowing information about touching, seeing, hearing, etc. A person is being mindful when they're watching how mind's attention is moving.

The most important part is to do it every day.

what's the next part? I'm sure I can handle what you described. Am I done, lather rinse repeat?

Cold showers in the morning!!

Unsure if it's scientifically proven. But there is abundance of literature if you Google for it.

I've seen the results in myself. From being a very passive in meetings, drowsy, and almost ADHD like behavior to being able to hold my focus and concentration till end of business and past. Key is doing it in the morning, evenings didn't work well.

Exercise. After Covid I had a long period of time with low focus; I slowly recovered spending on average more than 30 minutes per day cycling (quite intense) for about 6 months. Walking may also help, I think in my case the combination of disconnecting + exercise made a difference. During cycling I was never thinking about work. In the winter I do pushups and lift weights, it is something I can do at home, it is also exercise and time off. It takes less than 30 minutes per day in total, in several rounds over 3-4 hours; my coffee break is now a pushups break.

I also noticed that I can write good code only 3-4 hours a day at most and not every single day. Luckily for me, I am not a developer, but the highest concentration and productivity can be achieved and maintained for relatively short periods of time, not 8x5.

Alcohol does not work well. It helps disconnect, but constant alcohol intake leads to even more alcohol and health problems.

Electric stimulation is clinically proven to improve cognition. Like literally put clapms on your ears.

Caution: adverse effects.

I’m a morning person. Taking a mid day nap gives me two mornings - which for me means much more focus and concentration.

I know OP asked for scientifically proven data, but I think for a question like this we are all different and learning about yourself and your body counts just as much as science.

Since you (OP) mention knowing "two states" which («sometimes») present themselves kind of "randomly",

have you tried logging when you are fit and less fit («effortless and [...] slog»), and attempt logging potential external factors - sleep (time, quality, duration etc.), nutrition (dishes, hydration, sugar etc.), internal states (emotional, mental concern, generic feedback etc.), etc. - and see what seem to be more and less correlated?

You may realize what is facilitating you and what is hindering you - that you may work better after a good night sleep, or by having disposed of some class of preoccupations etc.

You should probably just keep yourself in an optimal working state, as the general rule. (And work in a fitting environment.)

I believe it's something that needs to be trained, where it helps that you are feeling well physically, and also that there are some things that are actually detrimental to concentration ability because you train the opposite.

Spend time focused, build more of that ability. Spend time clicking from news headline to news headline while receiving notifications of everything under the sun, build more of that.

All the things people list either make you physically better (like exercise and good sleep), make you focus, or make you do without the constant distractions for a while.

Magnesium citrate before bedtime.

It will improve your sleep quality tremendously which will then improve your concentration naturally. A rested mind has an easier time getting into the zone.

Buddhism and Zen can also help. No need to become a master, simply understanding and applying some of the basic concepts can help mind state significantly. This can also boost concentration by quieting the mind.

Also check out:

TMS Therapy or Transcranial Magnetic Stimulation. It is brain stimulation technology. Very interesting and lots of research behind it on pubmed.

I'm not sure about any thing to really improve your concentration, but you could start by identifying things that are undeniably bad for your concentration and removing them?

I prefer nicotine over caffiene, since it calms the body, relaxes it (including the joints and bowels) and allows you to focus on the task at hand without any distraction. Theres also many different ways of taking nicotine (from cigs and vaping to gum and snus to patches). YMWV but a lot of people i know like nicotine for this exact reason

A couple of years ago my first child was born. I agreed with my wife to watch him first thing in morning while she worked out at the gym. That hour always teed me up to be very productive afterwords.

During that hour my mind drifted to the code it wanted to write. I’d begin to think about the classes and methods I wanted to make progress on.

Now when I’m blocked I take an hour, play with my kids and after find myself very productive.

Another way to boost concentration is by removing distractions.

I use RescueTime to stop myself getting distracted and set focus times. While working I will inadvertently start Google to research something and before I know I am wasting time on news, youtube, twitter and what not. Apps like RescueTime help you avoid such distractions by specifying focus time during which it will block access to distracting websites.

>It’s like climbing a big hill but in my head. Sometimes it’s effortless and sometimes it’s a slog.

Is this something that you need to "fix"? Maybe it's your body telling you that you're dedicating too much time/mental resources to work and not enough time to the other aspects of your life.

You can't "push through" burnout; only recognise the early warning signs and back off.

Looking for something external, trick, app or whatever, and generally relying on science for concentration is conceptually the wrong approach.

Could you please elaborate?

I guess the poster may have meant that concentration is a skill you develop - an internal quality - and any seeker should keep in mind that there are no excuses: you have to "actually do it", not e.g. attempt getting it from the outside while internally remaining alien.

When you learn acrobatics, you may research about the shoes and haircut etc. that hinder the least and facilitate the most, but it will remain an ability, a skill, not a prosthesis, not an externally enabled state.

Moreover, it may have meant that since concentration is also a negative state (to gain concentration avoid its disturbances), you have to declutter, not to add further - to remove elements, not to pose them.

Moreover, it may have meant that to learn riding a bicycle, you "do it" (you climb the bike and attempt action), you do not «rely[] on science». The "science" is inside (natural cybernetics, feedback based skill building), not explicit outside.

For me its some times music, but mostly comedy channels on low volume, so i have some background noise that filters out surrounding noise.

I've been having trouble focusing as well as I could for very long at a time, so I'm going to take the whole summer and do something about it.

I should be just fine once I've made it through concentration camp . . .

I don't know if it is scientifically proven or not. It just works for me. I just use the pomodoro technique while listening to only this music every time I want to concentrate to get something done.


The "Pomodoro Technique" perhaps? Don't know if it’s scientifically proven to be effective...

> A goal of the technique is to reduce the effect of internal and external interruptions on focus and flow.


L-theanine (present in green tea) shows interesting results in alpha wave brain activity: https://apjcn.nhri.org.tw/server/APJCN/17%20Suppl%201/167.pd...

I think there was a post on hn about l-theanine before.

I have a very subtle yet bad reaction to L-theanine.

I have a noticeably positive response to taking Acytel L-carnitine. One pill at night before bed. Taking half the dosage on an empty stomach gives best results, though makes ones stomach a little queasy.

Serious, not trying to be a smartass: uninstall everything except phone app and email from your smartphone.

B12, and pretty much most of the additives in energy drinks designed to help push energy into concentration...

Maybe a good handful of nutropics, but most are anecdotal or don't work for everyone.

Good vitamin regime ie D if you don't get enough sun, C if you don't get enough fruit and veg and so on ...

Some moderate physical exercises do help but I also find that cooking helps me to be more relaxed after a day of coding work. Maybe because it needs a totally differnt kind of focus like chopping and much more (actual)hands-on which mean my coding brain can be shutdown afterwards.

I kinda feel I can code better when mildly sedated - eg late at night, after a beer. If I'm thinking too much I get distracted.

If I know I wont get interrupted is much better than not getting interrupted. eg if no one is in the house I can concentrate more than if they're there.

I used to end up working in the middle of the night as it combined this feeling of exhaustion and solitude. I can't really do it anymore for multiple reasons, but I try to at least get the solitude or physical tiredness through exercise.

I've noticed lately that "not being interrupted" is good, but "knowing deep in your soul that you can't be interupted" is better.

I think Cal Newport or someone was where I originally saw this idea spelled out, and it made a lot of sense of routines that I'd adopted subconciously and allowed me to plan them more explicitly.

I'm currently looking for a way to automate the pause of all incoming comms until the end of a pomodoro period.

I wake up in the morning and play video games online for about 15 minutes. It wakes me up, it engages me, forces me to focus. I've been able to cut back all caffeine in the morning, only having some later in the day.

Any specific games? Genres?

Something competitive. I play Star Wars Battlefront 2. It's a pretty casual game but it's competitive so you have to focus up and try if you want to win.


I'm currently on Etifoxine. I've noticed when combined with caffeine & magnesium supplements in the morning, it gives me a super calm laser focus for about 6 hours; no fog or sleepiness.

Lots of posts with nootropics mentioned. Just experiment with them on an every other day, or up to a 2 week on-2 week off cycle. Everyone's enzyme kinetics are different, and homeostasis is a thing...

Theanine and caffeine are a magical pair.


Matcha has both of these.

As does green tea

Amphetamines and other stimulants are huge cognitive boosters

Counterpoint: I have found that stimulants (caffeine is about as strong as I get these days) work for short periods of time, then become a net negative. Over the course of a week I'd get more done by having absolutely no stimulants, not even caffeine. Even for short-term work crunches they can be detrimental because they increase stress levels, which can lead to mental paralysis.

Yes having baseline constant energy levels is arguably the best strategy over high highs and subsequent low lows

Sleep well, exercise and have a good diet.

Try to decrease inflamation in the body if you have any.

Ps. I know its easier said than done and requires quite a bit pf self-discipline.

> Music. which type depends on the individual.

I listen to music all day. But when I really need to concentrate, the music has to go off.

I only have that problem with new music. Music I know by heart melds with and attenuates the background.


This Harvard guy is good:


And this Stanford guy is good too. This may not be the best one of his podcasts for addressing the exact goal but it's still relevant. https://hubermanlab.com/optimizing-workspace-for-productivit...

I'm calling myself out here, but, get enough sleep. it's huge for concentration.

Hindu sages used Brahmi, Saffron and Rosemary. There is a whole school of thought on it called Ayurveda in Hinduism.

For me, reading chapter of sci Fi book, currently Expanse, gives me nice vibe to concentrate on coding

Breathe deep, and in clean air. Simple advice but easy to miss, lots of buildings get a bit polluted.

My meditation teacher used to run peak performance courses for executives, judges, and others, and the main thing he taught was concentration meditation.

If you sit still for a moment and try to concentrate on something either internal (the sensation of your breath, the tip of your finger) or something external (something in your visual field, a sound) you'll notice you get lost in thoughts almost immediately. There is a strong habit of wandering in your mind. But you can train the opposite habit through meditation.

Most people can't concentrate for more than a few seconds before getting uprooted by their wandering minds. In the Tibetan Buddhist tradition they compare the mind to a stampeding elephant pulling you around wildly in every direction. You can imagine what is possible with being able to concentrate as long as you want on whatever you want.

In concentration meditation, you keep bringing the mind back to the object of concentration whenever you notice your mind wandering. You also focus more deeply on the object, getting more absorbed in its details while avoiding dullness. Doing this even 5 minutes a day for a week should pretty noticeably start changing your experience.

1. Adderall.

2. Practising interrupting distractions: if you open HN, try to make your first act closing it


Interesting that you have both a CNS stimulant and depressant on that list.

However stupid that may sound, using corded headphones helps me a lot.

Yeah, big ones.

And the right music.

Effectively put you in another room. Later the separation becomes a learned response.

I have 3 tips: exercise, ice baths, sleep.

On Exercise:

I did 'exercise' wrong for years.

Exercise produces 2 types of pain, 'good pain' (panting, muscle fatigue), and 'bad pain' (injury or achy joints). How much 'good pain' you experience is completely up to you, but it is absolutely essential that you minimise 'bad pain'. Simple reason: it is incredibly distracting when you're trying work!

To minimise 'bad pain'; 1. take 3-10 minutes to gently warm up the entire body before working out, 2. take 5-30 minutes to 'warm down' the entire body after working out (this will reduce delayed onset muscle soreness and joint aches). 3. take some protein and water 0-30 minutes after a workout.

TL;DR if you are sore from exercise it will distract you, negating some/all of the cognitive benefits of exercise, so be strict about ensuring that doesn't happen.

On Ice Baths:

One other huge tip, do an ice-bath once per 14 days, at a minimum. You don't have to go super cold: 10, even 15 degrees celsius is fine. How? If you don't have a bath (I don't) search amazon for 'portable bath' (there'll be heaps for under $50), use a $2 kitchen thermometer to take the temperature as you add ice (grocers, bottle shops, any markets will sell large bags of ice - buy 2 or 3). 10 minutes in a cold bath can give you a sense of incredible calm and concentration for the whole day. It also relaxes them muscles.

On Sleep:

I feel like 'everybody's different' is kinda true here, but learn your body and be very objective about how much your cognition drops when you're tired. If you're making mistakes while working tired, you're creating more work that you or someone else will have to fix. So trading off 1 hour of work for 1 more hour sleep is often extremely economical.

Staying hydrated makes a big difference.

Give "The Now Habit" a read

dont look at your phone while youre waiting in lines etc.

meditate instead.

its like a free lunch for building concentration.

caffeine + headphones and music

Wellbutrin. Similar to Adderall but a lot easier to get legitimately and isn't fleeting with time.

Unplug your ethernet cable.

Let yourself work.


By analogy, say you're a manager at a scientific-lab. You're already behind on deadlines for publishing papers; you're getting flack for it. You need the folks in lab-coats to write those papers, but they keep procrastinating... no matter what you freakin' do, no matter how many times you physically drag them to the computer to type their papers, every time you walk away for 10 minutes and come back, the scientists are back at their labs doing experiments and whatnot. How do you get them to stop it with the distractions and do their work?

As crazy as it may sound, maybe you should let the scientists do their experiments. Because, maybe, those experiments are somehow more conducive to writing papers than typing the papers is.

And it is weird, right? I mean, if you want papers, you type them! Obviously, right?! Everything else is just a distraction.. and maybe that's okay when you're not behind-schedule, but right now they should really be writing instead of experimenting.


You're a scientist in a lab. You're trying to do your work, but your manager's freaking out about missed publication deadlines. Every time you're trying to get some data to write about, they keep demanding that you just get to writing!

They don't understand. You try to tell them that you need to do other things before writing, and they ask why: you explain how the significant of the quadrangle isn't 7-epsilon beta invariant boson electric guitar, but they act like you're saying gibberish. Stressed, they impress upon you the fact that they need you to write stuff up and quit it with the distractions.

What do you do?

Your manager, frustrated, asks other managers what to do to make you work. The other managers suggest that your manager go exercise, have a beer, or take a vacation. Your manager doesn't see exactly how those things might help, but they try it. ...conveniently, they're not bugging you anymore and now you can work!


Point: You're not doing all of the work. Much of it's being done by, e.g., subconscious parts of your brain. And sometimes there's more to it than you might consciously experience.

If you want to be a good manager, there's some learning how to help the rest of yourself work. And perhaps even to realize that you might not even know how to do your own work.. sometimes you're leaning on other intelligences, even if they're within your own brain, and sometimes the work you'd want them to do might be more involved than you may appreciate.

So don't Ctrl+Alt+Del the OS-updates, disk-defrags, virus-scans, garbage-collector, backup-transfers, etc. -- at least, not as a standard practice. But also try to avoid stressing the same already-stressed processes while you're waiting; don't have the scientists fix the fax-machine, nor start moving a lot of big files around while the drive's defragging.

And if it helps, imagine that your brain is a country, and you're a non-authoritarian top-level executive (like a US president). Sometimes raising/lowering all taxes might help a bit, but those are rather blunt, unrefined tools to address some specific performance-concern. Instead, if you want to be an effective-leader -- whether if it's of a country or of your own mind -- you've got to grow your awareness of what's going on inside and apply more nuanced tactics to help things along.

Because even when it's "you", it's not all just the conscious-you doing the work -- you're more akin to a manager than a laborer, if you're an executive of your own mind.


Bonus analogy: You've bought a self-driving car from, say, Tesla. You told it to be nearby, so that it can pick you up when your meeting finishes. However, it's now late. Should you, say, take remote-control of it and hit the gas? Because, surely, it should just drive to you -- and if it's not doing that itself, then it's buggy and you should hit the gas. Not like it could be delayed due to something beyond your awareness, like it being stuck in traffic, and what's the harm in hitting the gas when it's going too slow?


In short, sometimes working means doing things that might not seem like work to your conscious-mind, or at least letting your brain do those things while you support it, like a good manager supports their employees.

Generally speaking, the more advanced/involved a process is, the more non-deterministic the run-time will tend to be. Constant-time operation might be more plausible for the simplest tasks, and a manager might more reasonably try to get employees to keep doing their job when it's a simple task, like pulling a lever in a factory. But just like complex distributed optimizations can be far more variable (and even unpredictable) in their run-times compared to, say, adding two primitive-integers, more complex creative/involved work can be more non-deterministic in its run-times.

Lions Mane mycelium

While I can't attest to this helping me focus, I can confirm that it does something.

I used to take it in the morning and evening. After stopping for a bit and restarting, I noticed I was waking up super tired and having intense dreams. I stopped taking it in the evening and confirmed that other people have had the same experience.

FYI I take it in a tincture, and I have not experimented with different brands or preparations.

Link the tincture brand for posterity

https://xkcd.com/323/ - see: Ballmer Peak


jack off. after that I'm good at writing code. you can as well use empirical method to proof if this technique works.





- Sleep

- Breathing

- Cardio


unpopular opinion: half a cup of wine. any procrastination is gone!

Does it really make a difference? I have no problem with the idea, but I never saw an improvement in focus.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact