Being a programmer is not a very healthy profession - long hours of sitting in front of a computer, with impending deadlines just over the cubicle. This takes a toll on the body and mind.

So what tips do you have for programmers in order to stay healthy?

  • 1
    @TomWij: Really? I thought if I didn't make this a community wiki then I would have been flamed with "You're just asking this to get reputation!"
    – gablin
    Commented Sep 20, 2010 at 9:30
  • 10
    The same way anyone with a desk job stays healthy! This isn't really programmer-related? Commented Sep 20, 2010 at 9:39
  • 10
    I deny the premise of the question. Programmer's don't stay healthy ;)
    – Joren
    Commented Sep 20, 2010 at 14:38
  • 1
    @Joren: My co-worker who runs her own Tae-Kwan-Do studio would disagree with you. (Ooh, that's my tip! Run your own martial arts studio! Uhm, might not be generally applicable, though....)
    – BlairHippo
    Commented Sep 20, 2010 at 14:40
  • 3
    How do elephants stay healthy?
    – Job
    Commented Jan 8, 2011 at 1:34

17 Answers 17

  • Join a gym that is close to work
  • Walk/Bike to work
  • Drink a lot of water at work (increase your water intake, and force you to take break to use the washroom, win-win situation)
  • +1 for this most certainly.
    – user2358
    Commented Sep 19, 2010 at 22:35
  • +1 for Walk/Bike to work. You sit down all day at work, why do it when you travel too. I'd go as far as selling your car, then you have no other option to get home ;)
    – Jon Hadley
    Commented Sep 20, 2010 at 8:00
  • +1 for drinking water, I wondered where you were going with the water and then you say "force you to take a break" that is just great.
    – Chris
    Commented Sep 20, 2010 at 14:11
  • Eat well: Not going for fast food a lot and drinking water or other healthy drinks can help. Variation!

  • Take pauses: Preferable using the pomodoro technique... After every 25 mins, take a 5 min break.

  • Keep yourself fit: In your free time you could go jogging, if boring do sport or take dance lessons.

  • Sit well behind your computer: 90 degree angles, adjusted heights, sit straight, ...

  • Sleep well: Helps in a lot of aspects: Being healthy, energy, less stressed/tired, productivity, ...

If you are a perfectionist you could implement the pomodoro technique, watch your calories,
think about improvements in your daily activities (eg. stairs instead of elevator, try to do things less lazy), ...

  • 2
    Try to sleep well with two kids mate :).. Commented Sep 21, 2010 at 9:29
  • doesn't being perfectionist increase your stress level :p ? Commented Jan 9, 2011 at 12:13
  • @Matthieu: Depends on in which way you are a perfectionist, it might help you or break you. :-) Commented Jan 9, 2011 at 12:17

A lot of people propose cardio here, but I will take a different route and recommend strength training. Compared to the former it has the following advantages:

  • Improved posture and strength: When you get stronger sitting, walking and standing with good posture will become a lot easier, will feel more natural and you will start to do it without constantly reminding yourself. Other common task like house holding or carrying objects will get a lot easier as well.

  • Permanent fat loss: Strength training will increase muscle. And one of the benefits of increased muscle is an increase in the number of calories your body naturally burns at rest. In addition to this your body will burn calories during the weight lifting session and will require additional calories to repair your muscles after it. These three effects in combination work really well: When I started to lift weights I became a lot stronger and leaner within a few months without changing my diet habits at all.

  • Less time consuming: 3 x 45 minutes per a week is enough.

  • Increased motivation: Pure cardio tends to be boring and repetitive. If you take strength training seriously you will try to lift more weight, perfect your technique and try to break your own records every workout (and if you just started to lift weights, you will most likely break them every workout). If you are a gamer, you probably know this kind of motivation from RPGs, where your character get stronger from level to level.

  • Various other benefits: Strength training increases endurance, bone density and testosterone levels. It also strengthens your joints, lowers cholesterol and improves your sleep.

  • It will make you look good: Strength training will not only make you leaner, it will add muscles to your body as well. You won’t become a body builder or anything close to that. You will look athletic and in shape.

If you want to start with strength training, I recommend you to read Stronglifts as an introduction. It is a great site that will offer you everything you need as beginner: Workout programs, articles about exercise technique and nutrition advice.

  • 1
    +1, though do note there's nothing either/or about strength vs. cardio. As long as you're in workout clothes and sweating anyway, why not hop on the treadmill for fifteen minutes?
    – BlairHippo
    Commented Sep 20, 2010 at 14:26
  • 4
    @BlairHippo: I agree. This was not meant as an either/or post. Aerobic and anaerobic training have their strengths and weaknesses and a combination of both is great. I was just pointing out the advantages of strength training, because hardly anybody knows about them.
    – xsl
    Commented Sep 20, 2010 at 14:49
  • I'm glad you posted this - my personal experience is that cardio is horrendously boring, and I simply find strength training to be a lot more enjoyable. I make sure I do some form of it 4-6x a week. Commented Sep 20, 2010 at 15:09
  • How exactly is lifting a piece of metal more exciting/interesting than going outside and seeing people and places?
    – Rook
    Commented Sep 21, 2010 at 1:23

I'm 54 and weight is a problem. I run 3 - 4 days a week... try to do some kind of workout every day. I also have to watch my calories - try to stay under 2300 a day. Seems to work. I find that I can concentrate better for longer periods with exercise.

My advice would be to do something every day. Walk, ride a bike, strength training. Some of us need variety. Use physical activity for your break from the machine. Once you're in the habit, you won't even think about it and you might even like the way you feel.

  • One thing I'd add is that when you are doing your physical activity, make sure you "turn off your brain" by listening to music or watching tv or something else that allows you to get into the exercise.
    – Jeff Siver
    Commented Sep 20, 2010 at 4:19

The same goes for programmers as it goes for pretty much everyone else ... watch your intake (most people today - even the skinny ones - take lots more in then they need) and do some kind of physical activity (swimming, running and cycling for example).

Now, most would say ... I haven't got the time for that. - but it is all questionable. For, programming is first thinking, typing second (or third) - you haven't actually got to be at your computer all of the time to do your work, as long as you can think of it (this has some issues with certain people, but if you show you're good at what you do they usually agree that they don't have to make you sit on your chair all the time, for you to do your job) and have the mental capabilities to visualize it in your head (most do).

... all there is to it, really. People are ment to move and have been moving for several millenia now ... no magic in that area (in regards to food, diets, whatever) will let them stay healthy if they sit on their respected ones all they long.

p.s. Laptops help ... you can work in several places (e.g. from the garden at home, ... can easily rearrange your office at work ... Hell, you can go to the mountains in your car, just find a nice place, lay somewhere and enjoy the scenery and work ...)

  • Totally agree with you for "For, programming is first thinking, typing second (or third)"
    – David Gao
    Commented Nov 21, 2012 at 18:32

Read The Hacker's Diet. It presents an engineer's approach to exercise and food intake.


Use an adjustable-height desk if you can get one. Being able to work standing up if you feel like it is a great help.

  • I never knew you could do this. Excellent.
    – user2528
    Commented Sep 21, 2010 at 0:12
  • +1 for this answer. I have a GeekDesk and love it. Also sometimes use a little mini-stepper underneath it, like some folks do with a treadmill. Works great! :)
    – Jamo
    Commented Sep 22, 2010 at 19:20
  • You also need a chair that supports you standing up for hours instead of slumping in the chair.
    – user1249
    Commented Jan 8, 2011 at 8:56

There is some great advice already listed in these replies. I wrote a post outlining some of the things I tried when I decided I had to improve my health and lifestyle. I hope it's OK to post a small extract here:

Eat smart

This is the most important point in this post.

Nothing else will have as big an effect over the way you feel, your mindset or your successes.

I began to eat lots of fibre-rich, high-quality foods, especially those that are only made up of a single ingredient (i.e. veggies, fruit, nuts).

I forced myself to cut out processed foods, too. It was tough (very tough!) but I realised if I wanted to make any progress, I had to do tough things.

Also, be aware of your sugar in-take. It’s criminal that many ‘low-fat’ foods are then pumped full of sugar because sugar makes you fat. Sugar is best avoided the majority of the time (fruit doesn’t count!).

One thing to remember is that any changes need to be sustainable. Introduce changes over time and you’re more likely to stick to them.

Drink more water

If you’re anything like I was, you’re not even thinking about drinking water… In fact, you’d happily drink anything but water (coffee, can of coke etc).

Seriously, avoid liquid calories like the plague if you’re looking to lose weight. They won’t fill you up so you’ll always be wanting more, it’s expensive and it’s not good for you – and you’ll end up with teeth like mine!

Start to graph your weight

“What gets measured, gets managed.” - Peter Drucker

Tracking your weight can be a huge motivator for anyone looking to make gains. If you do this every day, you can graph changes over time to make sure you’re heading in the right direction.

Do the right kind of exercise

Often when people say they want to 'get in shape', they mean that they’re going to drive to the nearest gym (which is usually at least 15 minutes away) where there’ll spend anything up to 2 hours pounding away on the treadmill. For what?

So that they don’t feel as guilty about all the junk food they’ll eat when they get home?

I tried bodyweight exercises combined with interval training. I could get more done in less time.

Also, be aware that you don’t need to train five days a week. In the beginning, it’s useful to aim for two or three as long as you’re staying active on your off days (and by staying active I mean walk around more, play sports, jog if you can’t resist it!).

Get more sleep

This was the toughest change I had to make and it probably will be for you, too.

Everybody knows how important it is to get enough sleep but the trouble is it is so easy to go without. There’s always another hour to squeeze in some more work but then we’re left scrabbling around in the morning, rushing into another day. When I realised it didn’t have to be this way, it was a massive weight off my shoulders.

Make it social

If you make your fitness goals public then not only will you get support and assistance from others, you’ll get accountability.

I managed to convince a mate that we’d begin exercising together. All of a sudden, it became a lot tougher to drop out. Try it. They will be somebody you know desperately waiting for someone to take the lead.


Ask your boss for one of these ;)

alt text

  • That's pretty neat, but it wouldn't work for me. Even walking creates enough of a disturbance when I'm trying to think or busy looking at lots of data in a grid in a small font or typing. For watching video it's fine.
    – Bernard Dy
    Commented Jan 8, 2011 at 16:42
  • i love this walkstation. Commented Jan 29, 2011 at 11:58

Over my last school semester (6th semester of Electrical Engineering) I managed to stay somewhat in shape by doing intense 20 minute workouts daily or every second day. Also, cutting out fast food and any kind of soft drink (soda, etc).

  • In 20 minutes you barely deplete your blood reserves of glucose. Try extending these workouts to at least 40 minutes to really see the difference. You'll start to burn actual fat and also give your body a sign, it needs to increase its glycogen reserves.
    – Mchl
    Commented Jan 8, 2011 at 14:09

Zed Shaw has written a good article on common programmer health problems.


Drink a lot of water, dont eat a lot, snack on junk food evenly or less then snacking on fruits/veg in the fridge (many times i have them precut).

I do that and i LOSE weight and i walk < 1hour a day. This is impossible? Well almost. I break even much of them time the days i go out and walk the streets i come home 1/2 pound lighter. I always feel energies and the water helps (I drink 3L a day bro ;P. No joke)


BREATHE WELL.. Learn some breathing Yoga..


I am telling the above as a lot of other things like Cardio/Sleep/Diet have already been mentioned. I was once a Gym freak so I know the benefit of all these but at a much later age I was introduced to Yoga and noticed that breathing patterns really improve your productivity. How about the fact, that if you breathe well you might sleep a couple of hours less and have more energy throughout the day.


They write an intentional bug in The Matrix that subtracts all calories from Jolt Cola from their daily intake. And you always thought it was because of the caffeine!


Lot's of good advice in previous answers. But I think young people have a false sense of security when it comes to health and don't realize that if you don't have good habits now, it will be tough to change when you get older. If you like to run, keep running.

  • A sad +1 on this one too. (Things I wish I'd done differently...)
    – Jamo
    Commented Sep 22, 2010 at 19:21

Two words: Treadmill desk. It took some doing to find the right cheap treadmill on Craigslist and figure out how to fit it with a desktop, and I'm still getting used to it, but already my nagging back problems are becoming less nagging. And I don't have any more trouble fitting exercise into my work day than I do fitting work into my work day.

  • I really have problems with that last thing.
    – Mchl
    Commented Jan 8, 2011 at 14:11
  • Unless you have a medical condition my advice might be of help. Make sure that you use the treadmill atleast 20 minutes a day somehow running makes the back more flexible. If possible do stretching exercises as well, keep the treadmill and stretching around 10-12 hours apart. Be careful with heavy weights unless you become very strong.
    – Geek
    Commented Jan 8, 2011 at 18:04
  1. Set concrete, measurable fitness and diet goals.
  2. Track progress daily.
  3. Share with others.

Tracking everything not only satisfies my "data junkie" side, but sharing it with others - and having them encourage me and keep me honest - is a huge motivation. This approach has allowed me to make some incredible gains in my fitness and health despite sitting in front of a computer 10 hours a day.

To use myself as an example, I do Crossfit (by far the most effective way to exercise I've ever found), set goals each year on my blog and track every single workout on a messageboard. For diet, I currently just try to follow the advice in In Defense of Food and eat only whole/unprocessed food in a roughly Zone Diet 40/30/30 breakdown, although a couple years ago, my diet goals included losing 43lbs, which I managed to do in ~8 months.

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