DEV Community

Cover image for Why do programmers wear headphones? For the same reason that you can’t juggle.
Andrew Lucker
Andrew Lucker

Posted on • Originally published at on

Why do programmers wear headphones? For the same reason that you can’t juggle.

Some call it eliminating distractions. Some call it flow. Tuning out of your immediate surroundings has been shown to increase focus on internal thinking processes. In this post I’ll dive into both the neurological components as well as folk-advice surrounding this phenomenon.

Working memory is a well studied component of brain physiology and normally associated with the prefrontal cortex. If you, for example, try to memorize a list of random words and repeat them from memory, then you will likely try to put them into working memory. However, this probably won’t allow you to remember more than a few words at a time. Working memory has a very limited capacity.

Memory athletes get around this limitation by using a technique usually called memory palaces. This allows them to offload the majority of memory requirement to spatial memory, which is very closely associated with working memory. These athletes “walk around their internal concept of a palace and “place certain words or objects into a location where they will remember it at the right time. When used correctly this technique can add huge multipliers to the ability to remember what would otherwise be random information.

Programmers use a similar technique to remember and navigate code. However there are limitations, namely that working memory is not completely removed from the picture. Working memory is full of all the things that you are consciously aware of at any given time. That dog sniffing around, the music your deskmate is listening to, the meeting on your schedule, and everything else that you may be worrying about. These things fill your working memory, and are a huge drag on any attempt to work with the code in your head. Too many simultaneous distractions will effectively block any attempt to reach the glorious flow state of mind.

Studies have also shown that once an individual is knocked out of a flow state of mind, it can take up to 20 minutes to get back. Losing concentration can have significant impacts on worker productivity. This is where headphones come in: for programmers wanting to tune out of distraction and stay in the flow, music is a great release and safety measure. On another note, this problem is sometimes less significant in senior programmers, because their understanding of a project or environment has since moved from spatial short-term into spatial long-term memory; the effect being that it is much easier to recall these memories without going into a trance.

So to reiterate: programmers are easily distracted, headphones eliminate some distractions, thus headphones make programmers happy. Personally I have music on almost all the time, with or without code. I just love music.

This post was originally published on

Discussion (53)

_bigblind profile image
Frederik 👨‍💻➡️🌐 Creemers

I like this cartoon when explaining this to people:

cfvonner profile image
Carl Von Stetten

Yup. I pinned this cartoon right outside the entrance of my cubicle. Of course, now people interrupt me to ask what it means.

onecuteliz profile image
Elizabeth Jenerson

Lol - damnit! 😂

aalindg profile image
Aalind Gupta

I was expecting that. Haha!

richscrich profile image
Rich Clarke

That's my every day

tpetrina profile image
Toni Petrina

I use headphones, but without music. Music is too engaging, but having headphones prevents some unnecessary conversations and dampens the environment sounds a bit.

anthonysdi profile image

Have you tried Betawave music (low key music engineered to increase beta waves in the brain) or Classical music (nonvocal music can still be a great "white noise")?

Another option is to listen to soundtracks from video games. The music for them is engineered to keep the player engaged and not distract from the game.

meonlol profile image

Game music is a good idea. I'll try that today.
If I really need to concentrate I use one of the sound engines from
I like the "cafe restaurant" one, which perfectly drowns out colleagues talking, even without noise canceling headphones.

Thread Thread
jeansberg profile image
Jens Genberg

Wow, that site is awesome! Thank you for posting this.

acethagemini profile image
Ali Suleiman

Very true! I actually do this everyday, listening to soundtracks from video games. It keeps me focused. Sometimes I feel like I'm in a completely different world, my own world where I'm the star of the show! :D

Thread Thread
epigene profile image
Augusts Bautra

Absolutely! Lately I have been listening to these "homework edit" versions of popular soundtracks, especially Skyrim. This rocks

samr1 profile image

thanks for the tip, I'll try it next week :)

leonardosnt profile image
Leonardo Santos

What soundtracks do you recommend?

Thread Thread
anthonysdi profile image

If I gravitate to game sound tracks I go to Mario tracks; I don't know why I'm sure there are better ones, that's just my taste.

You can go to youtube and search for game sound tracks and find some that work for you.

cdenby profile image
Chris Denby

I have to agree. Being a programmer with a degree in theory and composition, any music is going to engage far too much to be considered white noise.

But I do have noise blocking headphones that I can wear in shared environments.

richscrich profile image
Rich Clarke

I find tuneful music distracting, I start listening to it. But Industrial or similar helps me to concentrate. It's usually music other people find unlistenable.

vashful profile image

I agree. I also do it often. Play 1 track then nothing for some time

mg30rg profile image
Schleer György

When I have to focus I usually listen to Desert/Stoner rock (strictly instrumental). One of my friends who is more into electronic music prefers minimal techno for the same reasons. Active noise filtering works best if there is some sound in your headphones.

If music absolutely bothers you, there are whitenoises on YT. My favorite is "10 Hours Of Relaxing Planet Earth II Island Sounds - Earth Unplugged", but if that is still too concrete there is my other favorite "CELESTIAL WHITE NOISE | Sleep Better, Reduce Stress, Calm Your Mind, Improve Focus | 10 Hour Ambient".

jlhcoder profile image
James Hood

Great post! I have a hard time listening to regular music while programming, because I find I start focusing too much on it instead of my work. However, I discovered within the last few months and it's been super helpful.

t4rzsan profile image
Jakob Christensen

After 20 years of coding with a headset, I have ended up with a very annoying tinnitus. And I never really played loud music.

All I can say, don't use a headset. Today, you may think that you are invincible. But eventually you may pay for it.

Great writeup though :-)

pungiish profile image

Well now I'm paranoid.

ben profile image
Ben Halpern

A quick Google search shows a lot of references to idea that it takes "20 minutes to get into flow state", but I haven't come across any original sources. If you know of any sources on this idea, I'd be interested in seeing it. I believe it from experience, but would love to see more literature on this topic.

Great post, Andrew.

alexdreptu profile image
andrewlucker profile image
Andrew Lucker Author

That depends how far you want to go back :)

Wikipedia references Buddhist and Taoist texts that are literally NNNN BC. I would say though that what we call "flow" in a refined scientific sense was a product of "positive psychology" studies in the 1980s. Positive psychology is the opposite of diagnosing people with disorders, rather helping them find ways to avoid bad states and generally improve patient well-being.

daisychubb profile image
Daisy Chubb

Great post!
I wish my pod-mate would understand that and not tap me on the shoulder to tell me stories about his daughter's swim meet. Perhaps I'll send him this post...

edwin_r_c profile image
Edwin Ramirez

Like a work mate of mine that every time he comes up to this office floor he just HAS to interrupt EVERYONE just to say hi and shake hands. It doesn't matter if you´re in half a remote meeting or completely concentrated in your code.

daisychubb profile image
Daisy Chubb

Oh wow! I find with people like this it can be hard to get in the flow if you feel like they are coming in soon. Almost being "on alert" - it's nice to have friendly co-workers but that's a bit much!

ben profile image
Ben Halpern

Can you elaborate on "pod-mate"? What exactly is a "pod" referring to? I'm curious.

daisychubb profile image
Daisy Chubb

For sure! Similar to what Jordan said, my current workplace reserves these small cubicles (they call pods) for student co-ops and contractors. There is really only room for 1 person, but I guess since they call it a 'pod' they can squeeze 2 in ;)

jsutcodes_84 profile image
Jordan Sutton

Where I work its a group of 4 people in a large hexagon shape "cubical"

jaimemateo profile image
Jaime Mateo

This is one of the main reasons I love programming, which is listening to my music all the time. I'm a music nerd and I always have a bunch of new releases waiting... Though sometimes it can be distracting, for example while reading something new you need to understand at first (for example reading React articles and tutorials at the moment).

I'd like to share a playlist I made for coding. It's mostly electronic mellow beats, hope you like it:

codemouse92 profile image
Jason C. McDonald

I showed this to my former psych professor. He said (among other things) that you really should cite Mihaly Csiksentmihalyi on this one - that's basically the guy that coined "flow" to begin with. Also, while the distractions are competing for your working memory, they are not all in working memory at the same time.

All in all, though, I agree about the importance of having "auditory control" over your environment. I tend to listen to RED or Switchfoot when I'm working.

rjpsyco009 profile image
Ryan Norton

Are you kidding me? I love RED and switchfoot is my favorite band!
I'm going to meet them in about 2hours before the concert!

legolord208 profile image
jD91mZM2 • Edited on

Oh I wish. Sadly everything even remotely touching my ear starts to hurt after a tiny bit.
In a loud environment and no headphones... what happens? I end up writing really bad code. Ugh.
EDIT: For example, delete_channel( I mix up unrelated things.

luisventura profile image
Luis Ventura

I feel like I am on the opposite side of the spectrum. My family has music-oriented heritage, and this impacts my abilities to use music as an environment filter. I listen to EVERYTHING! Every string slide and pluck, every gasp for air before singing, every low-bitrate distortion and even editing errors on some songs. It's very distracting to say the least. In the other hand, my father as a musician and physician as well, makes use of this bionic hearing to auscultate his patients with extreme accuracy of diagnosis.

thetuftii profile image
Claire Pollard

Fantastic article Andrew. I can't function without headphones and music whilst coding. Although sometimes I'm unsure if it's just the routine of putting them in which is a subliminal message to my brain just saying "hey, time to crack on now" or if it's genuinely an aid to focusing and blocking out external noise whilst coding...

_knutaf profile image

I know there's science behind it, but when I put my headphones on at work, it feels like I'm retreating into a cave, and it feels good. Sometimes I feel like putting up the hood on my sweatshirt too, but it's generally too hot for that.

andrewjbyrne profile image
Andrew Byrne

Nice article Andrew. I have sensory processing problems that I only understood more recently because my young son suffers from the same issue. Like father, like son :-). I' affected by most senses but noise while coding is rough. While coding my concentration level rises and, as it does, all sound around me becomes mega-amplified. Rain falling on my attic bedroom when I was younger would tap, taP, tAP, TAP louder as time passed.

Over the years headphones have helped and, believe it or not, I play more or less the same tracks that I've been playing for over two decades. Those, plus a Neil Young station on Pandora. So, it is like white noise but I find the difference is that when things are going well I can code to the songs. Radiohead's "The Bends" for those times, for example, when I plough through some code refactoring.

Keep up the great writing!

symbiatch profile image
Sami Kuhmonen

No. What would make us happy is if someone once listened to us and removed the actual problem. Headphones are a bandaid and I'm sad that someone actually has the nerve to say thy make people happy.

Why would you be happy? Why wouldn't you demand a problem free work environment? Sure your boss probably whines but so what? That's what should be done. That's what would help and make people happy.

Headphones. Sheesh.

markrendle profile image
Mark Rendle ❄

I can juggle, but I still wear headphones when I'm coding.

antonfrattaroli profile image
Anton Frattaroli

I listen to video game music. Either longplays or OSTs. Deus Ex, Secret of Mana, Drakkhen, Arcana, Morrowind in my YouTube recent videos.

mortoray profile image
edA‑qa mort‑ora‑y

I listen to music to drown out the distractions in my own head. All those momemts while waiting for the computer to do something, or working through a long problem, gives my brain an opportunity to reflect on something other than programming. The music is a constant fallback -- I immediately focus on the music rather than the bills I need to pay. The transition to/from music and programming is easy enough that I can stay in the flow.

yuvalitzchakov profile image
Yuval Itzchakov

Definitely. A good pair of headphones is an important tool for the craft!

javierg profile image
Javier Guerra

I can't wear headphones while working... or almost any time. I feel trapped, I like to hear noises around me, people chatting or cars passing by, my brain blends everything into white noise I guess... but I need air around my ears. If I listen to music, it has to be on speakers. I have a gift to be able to ignore people. They call me rude, but now everybody accepts it.

amrutprabhu profile image
Amrut Prabhu

Yes. This is true for me. I usually listen to music when I need to concentrate and not loose my flow of thoughts. There is no specific music that one needs to listen to. Only any music which you like and helps you concentrate.

Really nice post. Cheers :)

djviolin profile image
István Lantos • Edited on

If you wear headphones without any sound, just to separate the outside world, don't do it. Wear an ear protection instead (and don't care about your colleagues, at least they will know now what's the deal). There are sounds in the 16-20Khz range which you cannot hear already (due to aging), but still can damage your ears. Consider some "funny" guys whose hiding these high pitch sounds in videos or programs...

tinmanjk profile image
Ivan Petrov

how about proposing a legislation for banning open space offices for development work? :)

nobios profile image
Everson Santos Araujo

Maybe it's simply "all programmers just love music", and we create these studies so we can keep listening music...

tmr232 profile image
Tamir Bahar

Headphones are on because of open-space. I want the music playing. As long as no-one touches me or calls my name, I can usually maintain focus.

philspitler profile image
Phil Spitler

I have a weak hypothesis that great programmers have clinical ADD. Hyperfocus is legit. That's me.

hawicaesar profile image
HawiCaesar • Edited on

Love the article! There are days when I put on my headphones and forget to set the music. So the sound of silence is better than someone distracting me hehe...Am I the only one? Hope not.

amrullah profile image
Amrullah Zunzunia • Edited on (Fan + Brown noise) combination is great in masking surrounding disturbances, while not being distracting on its own

pratikaambani profile image
Pratik Ambani

Me too, but with no music most of the time. 😇