# Calorie to Exercise Calculator

## Why Write a Calorie to Exercise Calculator?

The other day I was somewhere around 60 calories over my calorie goal. Not much, really, and maybe within the margin of error considering how inaccurate my recording can be.

But I thought to myself *What exercise - and for how long - could I do to burn that 60 calories?* With sites and apps like My Fitness Pal I *could* select an exercise, and then increase or decrease the time until I found how long it would take to burn 60 calories.

But not only is that time-consuming - it’s only looking at one exercise at a time. Which, I suppose, just means it would even be more time consuming to look at several different exercises until I found one that I could do in a certain amount of time.

I’m a software engineer (aka programmer) by trade, so I decided I’d do a bit of research. It turns out that each exercise has a number associated with it called a metabolic equivalent of task, or MET. If you know an exercise’s MET, plus a few other bits of information, you can figure out how many calories an exercise burns.

Here’s the equation:

```
METs × 3.5 × body weight in kilograms / 200 = Kcal/min
```

Keep in mind that **kilocalories** are the same as capital-C **Calories**.

Solving the equation for minutes is straight forward:

```
min = Kcal / (METs × 3.5 × body weight in kilograms / 200)
```

So all I need to know is how many calories I want to burn, and how much I weigh, and I can figure out how long I have to exercise for each exercise to burn that many calories. And with exercises that involve a speed - such as running or walking - I can also figure out how far I need to go.

*Fun fact: there are MET values for things that aren’t commonly thought of as exercises as well, including inactivty and yes, sexual activity.*

I’m unsure if My Fitness Pal or similar apps use METs, but it would make sense if they did. Why reinvent the wheel?

If you want to see an exercise not listed above, feel free to make an issue on GitHub, or shoot me a message via my Facebook page.