# General Cycling Discussion - Hill calculation formula

Bikeforums.net is a forum about nothing but bikes. Our community can help you find information about hard-to-find and localized information like bicycle tours, specialties like where in your area to have your recumbent bike serviced, or what are the best bicycle tires and seats for the activities you use your bike for.

View Full Version : Hill calculation formula

TheRCF
09-22-05, 09:15 PM
Okay, I now have some data on my hills, but I need to be able to translate it into a grade percentage.

If I understand it correctly, going up hill for 5 miles with a 1 mile increase in elevation, would result in an angle of 20 degrees. If the increase were 2.5 miles, the angle would be 45 degrees. I know this isn't quite right since you should compare the horizontal distance, which would be a little less than the diagonal distance, but I suppose for bike angles of climb, that is not a major factor.

But how do you get the percentage of the grade? Isn't that different?

Fat Boy Biker
09-22-05, 10:02 PM

number of verticle (units) (usually feet)
---------------------------------------
number of horizontal (units) (same as above)

so for a 1 mile stretch of road if you gain 528 feet

528 ft
you have grade = ---------------- = 10% pretty steep climb
5280 ft

Steve
-numbers make us happy

SirScott
09-22-05, 10:03 PM

Take the inverse tangent of the elevation divided by the horizontal to get the angle. To have a 45 degree angle (or 100% gradient), your elevation gain will equal your horizontal distance. In your example, arctan(1/5) = 11.31 degrees.

Gradient is simply rise divided by run. So 1 mile / 5 miles = 0.2 = 20% gradient = steep.

CastIron
09-22-05, 10:27 PM
You lost me at "inverse tangent". Is there a field expedient (idiots) formula to use?

JavaMan
09-22-05, 10:31 PM
When you ride 5 miles up a hill, 5 miles is not the horizontal distance!

The angle (not the grade) of the slope is ARCSIN(1 mile/5 miles) = 11.537 degrees

The grade is just the TAN of the angle. TAN(11.537) = .204 or 20.4%

I uploaded a spreadsheet to do this a while back if you can find it.

TheRCF
09-22-05, 10:35 PM
Okay, let me see if I understand this.

Gradient, which is a PERCENTAGE is the vertical distance divided by the horizontal distance?

But this formula gives the ANGLE: arctan(verticla/horizontal) = a result in DEGREES?

If I have that right, I have two questions. First, which figure, percentage or degrees is most often used in hill descriptions (I think it is percentage)?

Second, since I'm trying to set up formulas for calculating the hills, I ran into a problem. Using Excel spreedsheet, it seems that "arctan" is not a term it recognizes. I found Atan, AtanH, and Atan2, but none of them seems to give a result like you show for the 1 mile vertical on a 5 mile ride. Any ideas on what the formula should be in excel?

SirScott
09-22-05, 10:41 PM
Okay, let me see if I understand this.

Gradient, which is a PERCENTAGE is the vertical distance divided by the horizontal distance?

Correct.

But this formula gives the ANGLE: arctan(verticla/horizontal) = a result in DEGREES?

Correct

If I have that right, I have two questions. First, which figure, percentage or degrees is most often used in hill descriptions (I think it is percentage)?

Second, since I'm trying to set up formulas for calculating the hills, I ran into a problem. Using Excel spreedsheet, it seems that "arctan" is not a term it recognizes. I found Atan, AtanH, and Atan2, but none of them seems to give a result like you show for the 1 mile vertical on a 5 mile ride. Any ideas on what the formula should be in excel?

ATAN returns the answer in radians. To convert into degrees, multiply by 180 / PI().

SirScott
09-22-05, 10:44 PM
When you ride 5 miles up a hill, 5 miles is not the horizontal distance!

You are right, but it makes a difference in our case of 0.2 degrees and 0.4% gradient (and will always make a negligable difference in biking terms since the elevation gain <<< traveled distance unless you're doing sick, sick climbs). For doing quick and easy gradient calcs on the fly, rise over (fake) run is good enough for government work!

JavaMan
09-22-05, 10:48 PM
OK, I found the post I was talking about - I did not upload the spreadsheet after all, but just posted the formula in spreadsheet form.

This is the correct formula. RISE is in feet, DISTANCE is in miles.

Put it into a spreadsheet for future use.

Fat Boy Biker
09-22-05, 11:02 PM
Ok, JavaMan is getting hardcore with the significant digits. And I can dig that. So here is a way to use Excel to get down to the decimal points.

You need to know the (D)istance you travel up the hill (well will call that T and put that number in cell A1)
You also need to know the (E)levation gain from the bottom of the hill to the top of the hill (we will call that E and put that number in cell B1)

The formula for percent grade in cell C1 should look like this =B1/(SQRT((A1*A1)-(B1*B1))) format this to percent to 2 places

My previous example of 582ft elevation on a 1 mile hill should give the following results:

T=5280 ft in cell A1 // A1=5280
E=528 ft in cell B1 // B1=528

Using the formula above Cell C1 = 10.05%

Steve
-accuracy always counts, but it can be a bit boring

Fat Boy Biker
09-22-05, 11:07 PM
OK, I found the post I was talking about - I did not upload the spreadsheet after all, but just posted the formula in spreadsheet form.

This is the correct formula. RISE is in feet, DISTANCE is in miles.

Put it into a spreadsheet for future use.

Shoot! Beat out by JavaMan.

Steve
-there's more than one way to skin a hill cat

TheRCF
09-22-05, 11:07 PM
OK, I found the post I was talking about - I did not upload the spreadsheet after all, but just posted the formula in spreadsheet form.

This is the correct formula. RISE is in feet, DISTANCE is in miles.

Put it into a spreadsheet for future use.

Okay, I have SirScott's formula working and we already know there is a small built-in error.

So the question becomes: Is your formula more accurate?

One of the nice things about computers is that once set, even a complicated formula can just be copied and pasted as necessary so I might as well go with whatever is best.

But while waiting for comments on the most accurate figures, I sure appreciate all the help.

Just saw another post by Fatboy but I'll have to check it out more later.

Fat Boy Biker
09-22-05, 11:25 PM
Okay, I have SirScott's formula working and we already know there is a small built-in error.

So the question becomes: Is your formula more accurate?

One of the nice things about computers is that once set, even a complicated formula can just be copied and pasted as necessary so I might as well go with whatever is best.

But while waiting for comments on the most accurate figures, I sure appreciate all the help.

Just saw another post by Fatboy but I'll have to check it out more later.

JavaMan will have to explain his formula. My formula is more accurate than the simple elevation/distance. You can see in my example the real answer is 10.05% (rounded) and the close answer was 10%. Believe me, .05% wont make any difference, but as Sir Scott said, the steeper the hill, the more inaccurate it becomes. But trust me, if you can climb a 20% grade, you are the man in my books.

Steve
-isn't math fun

P.S. My formula calculates the real horizontal lentgh using c squared = a squared + b squared, where the distance up the hill is c and the elevation gain is a, and the real horizontal distance is b. Then I used the elevation / real horizontal distance to get the "real" grade.

TheRCF
09-23-05, 12:33 AM
Okay, using Fatboy's formula - hopefully I finally did it right after a number of errors in my setup kept giving weird results - the steepest hill I think I've climbed covers three short blocks and the steepest part is 8.63. The average for all three is 7.07.

The distance is just 1065 feet. I've climbed it a few times with my old bike, which has a triple crank, but I have yet to make it with my newer bike (double crank). I've gotten half way up, but that's about it. I'm so slow, I have to worry about falling over so I can't make lock into the pedals - I'm afraind I'd start to fall and not be able to unclip successfully.

Fat Boy Biker
09-23-05, 01:11 AM
...the steepest hill I think I've climbed covers three short blocks and the steepest part is 8.63. The average for all three is 7.07.

8 and 7 percent is pretty step. I did 2.5 miles on the back side of the Royal Gorge that I think averaged 10% with a few sections around 12. It was hard. One technique I saw other people use (this was on an MS-150 ride) was zig-zaging. I couldn't make that work. I just used my smallest gear. 30x25. I have a pretty standard road tripple.

Good luck with those hills.

Steve
-up, up and away

Longhorn
09-23-05, 08:57 AM
My biggest hill is 10.7% over about three blocks (using Google Earth to determine distance and elevation change) and I have to zigzag up it, even on my electric bike! I can't climb standing on the pedals and my heart rate went through the roof when I zigzagged up it on my Trek, even with a 32 granny gear.

cruzMOKS
09-23-05, 12:36 PM
To figure grade at one point. Use a 4' level and the # of inches from the street to the
bottom of the level (with the bubble leveled) divided by 48 = % slope.

If it is 4" from the street to the bottom of the level your equation is: 4/48 = .08333 which
would be 8.3% slope.

If you are using a 2' level you would divide by 24

TheRCF
09-23-05, 02:26 PM
My biggest hill is 10.7% over about three blocks (using Google Earth to determine distance and elevation change) and I have to zigzag up it, even on my electric bike! I can't climb standing on the pedals and my heart rate went through the roof when I zigzagged up it on my Trek, even with a 32 granny gear.

Before getting the Delorme Topo USA software, I tried that - but a bunch of places, the numbers made no sense. I would check a place right along the beach and it would say I was 20 or more feet high! Even over the ocean - you know, like SEA LEVEL - it would say I was well above that. Places that I knew should be going downhill would show increasing elevation!

Longhorn
09-23-05, 02:55 PM
Well, I just got one of these

http://www.evdeals.com/images/Parts/incl_red.jpg http://www.evdeals.com/images/Parts/incl_both.jpg
so I'll doublecheck my Google Earth results.

CastIron
09-23-05, 04:25 PM
You lost me at "inverse tangent". Is there a field expedient (idiots) formula to use?

So all that would be a 'NO' then?

Cranks
09-23-05, 05:22 PM
8 and 7 percent is pretty step. I did 2.5 miles on the back side of the Royal Gorge that I think averaged 10% with a few sections around 12. It was hard. One technique I saw other people use (this was on an MS-150 ride) was zig-zaging. I couldn't make that work. I just used my smallest gear. 30x25. I have a pretty standard road tripple.

At the San Francisco Grand Prix earlier this month, sections of the course were up to 15% grade (29.4 ft. climb over 196.6 ft, according to DeLorme Topo - but I think it might be more on the order of 11% or 12%. Isn't there some rule of thumb about how steep streets can be for cars?). Some of the guys chose to zig-zag it (obviously not bunched up in the peloton) and they climbed faster than the guys who went straight up the hill.

I've got one section of a ride in Seattle - 41.9 feet rise over 298.2 ft, which should calculate to a 295.2 ft actual distance? It's part of a bigger hill, but it's a killa.

TheRCF
09-23-05, 06:41 PM
Well, I just got one of these

http://www.evdeals.com/images/Parts/incl_red.jpg http://www.evdeals.com/images/Parts/incl_both.jpg
so I'll doublecheck my Google Earth results.

I gather that thing tells you what the grade is at a particular spot? If so, it might not match up at all - or just match up by luck. I've never had a grade where the steepness stayed the same all the way up. The longer the hill, the more likely you have lots of changes. Which one you use for a measurement will determine your result.

JavaMan
09-23-05, 08:12 PM
JavaMan will have to explain his formula. My formula is more accurate than the simple elevation/distance. You can see in my example the real answer is 10.05% (rounded) and the close answer was 10%. Believe me, .05% wont make any difference, but as Sir Scott said, the steeper the hill, the more inaccurate it becomes. But trust me, if you can climb a 20% grade, you are the man in my books.

Steve
-isn't math fun

P.S. My formula calculates the real horizontal lentgh using c squared = a squared + b squared, where the distance up the hill is c and the elevation gain is a, and the real horizontal distance is b. Then I used the elevation / real horizontal distance to get the "real" grade.

The horizontal length you calculated using Pythagorus is not necessary to find explicitly. The inverse sin or ASIN of (elevation gain/distance up the hill) gives you the angle of the hill. Since you now know the angle, you just take the TAN of that angle to get the grade. Then multiply by 100 for percent. That's the formula. RISE is in feet, DISTANCE is in miles.

SSP
09-23-05, 08:40 PM
If anyone's interested, I've included a "Climbing Calculator" in my CycliStats (http://www.cyclistats.com) training diary program. It calculates the grade of any hill, and allows you to estimate how much time the climb will take. It also calculates your "rate of climb" (in feet or meters climbed per hour).

And, yes, I think it's a pretty neat tool, especially if you ride much in the mountains.

CastIron
09-23-05, 09:56 PM
MAC friendly?

SSP
09-23-05, 10:39 PM
MAC friendly?

Sorry...no.

I've looked into porting the software to the Mac, but it would be a huge project (I estimate around 1000 hours). Given the Mac's small market share, and my other time committments (a full time job, a new relationship, and my bikes), I just can't justify the effort at this time.

However, I've heard rumors that with Apple's recent decision to use Intel chips, it may someday be possible to run Windows programs on Mac's.

TheRCF
09-23-05, 10:46 PM
The horizontal length you calculated using Pythagorus is not necessary to find explicitly. The inverse sin or ASIN of (elevation gain/distance up the hill) gives you the angle of the hill. Since you now know the angle, you just take the TAN of that angle to get the grade. Then multiply by 100 for percent. That's the formula. RISE is in feet, DISTANCE is in miles.

Well, I'm confused, but all I need is someone to let me know which, of all these formulas posted, give the most accurate result.

Right now, instead of the one quoted above from you, I'm using this one:

=(ATAN((Rise/Distance)*180/PI()

All info is in feet. So, is your's better?

Also, using the Delorme software to give the average grade (apparently only uses whole numbers), it shows the steepest short block of my three steepest I've ridden is 15%. Near as I can tell, the software must be using the formula of the rise/distance (gradient). According to the formula for degrees listed above, it would be about 8.6 degrees.

Hope I haven't gotten confused over all these things!

SSP
09-23-05, 11:10 PM
Well, I'm confused, but all I need is someone to let me know which, of all these formulas posted, give the most accurate result.

Right now, instead of the one quoted above from you, I'm using this one:

=(ATAN((Rise/Distance)*180/PI()

All info is in feet. So, is your's better?

Also, using the Delorme software to give the average grade (apparently only uses whole numbers), it shows the steepest short block of my three steepest I've ridden is 15%. Near as I can tell, the software must be using the formula of the rise/distance (gradient). According to the formula for degrees listed above, it would be about 8.6 degrees.

Hope I haven't gotten confused over all these things!

FWIW, DeLorme software is notorious for overestimating the amount of climbing. I suspect it's because their software interpolates too much up and down between their data points, and also because their software follows the hill contours, rather than the actual road contours (which tend to smooth out all the minor ups and downs).

In my experience, their estimates for total climbing are typically 10-25% too high.

As for formula - the simplest one (Elevation Gained / Distance Ridden) x 100 is about as accurate as the more complex formula. For most road grades, the difference is entirely negligible (and well within the margins of error for the data).

JavaMan
09-23-05, 11:51 PM
Well, I'm confused, but all I need is someone to let me know which, of all these formulas posted, give the most accurate result.

Right now, instead of the one quoted above from you, I'm using this one:

=(ATAN((Rise/Distance)*180/PI()

All info is in feet. So, is your's better?...

My formula gives the exact result. The others are approximations.

Which is better? That's up to you!

TheRCF
09-23-05, 11:53 PM
That's good to know - but if I understand you correctly, the error would be in the distance traveled? I can, of course, measure that on my rides. The critical issue for me would be the starting elevation and the final elevation. I can do the other calculations myself.

I understand your point about the "simplest" formulas being, essentially, good enough, especially considering inherent error on any climb. But I figure that since the computer is doing all the work, might as well be as accurate as possible. The inherent errors could go either way so it is still a benefit to use the best formulas.

Thanks.

Bob

SSP
09-24-05, 12:01 AM
My formula gives the exact result. The others are approximations.

Which is better? That's up to you!

But the difference is negligible, especially given the inherent inaccuracy in "elevation gained".

For instance, a climb of 5 miles, with a 7% grade will have 1,843 feet of climbing.

But, the simpler formula (1843 / (5 x 5280)) x 100 yields 6.98% grade...virtually the same, and much easier to calculate if one is just using a calculator.

However, I understand your committment to accuracy, which is why I use the "Atan" formula in the Climbing Calculator in CycliStats (http://www.cyclistats.com).

SSP
09-24-05, 12:07 AM
My formula gives the exact result. The others are approximations.

Which is better? That's up to you!

The "approximations" are nearly identical for most climbs, and much easier to calculate with a calculator.

For instance, assume a climb with 1843 feet of elevation gain in 5.0 miles of riding.

The more accurate "Atan" formula shows that the average grade is 7.00%.

But, the "approximation" (Elevation Gained / Distance Ridden) x 100 shows an average grade of 6.98%. Given the inherent inaccuracy in the "Elevation Gained" variable, the approximation is every bit as accurate as the "Atan" formula.

That said, I understand your obsession with numerical accuracy, and that's the formula I use in my CycliStats (http://www.cyclistats.com) Climbing Calculator.

SSP
09-24-05, 12:08 AM
The "approximations" are nearly identical for most climbs, and much easier to calculate with a calculator.

For instance, assume a climb with 1843 feet of elevation gain in 5.0 miles of riding.

The more accurate "Atan" formula shows that the average grade is 7.00%.

But, the "approximation" (Elevation Gained / Distance Ridden) x 100 shows an average grade of 6.98%. Given the inherent inaccuracy in the "Elevation Gained" variable, the approximation is every bit as accurate as the "Atan" formula.

That said, I understand your obsession with numerical accuracy, and that's the formula I use in my CycliStats (http://www.cyclistats.com) Climbing Calculator.

Arrrgh! Sorry for the double post - I checked 4 times after posting the first reply, and it seemed to have gone missing.

Trsnrtr
09-24-05, 07:49 AM
As a retired highway engineer, much of what I've read here is nit-picking.

First off, highway grades are frequently a combination of grades or in the case of old roads, erratic grades at best. Using topo maps will yield an average grade but won't account for those short stretches of leg searing pitch or transitional vertical curves. Measuring points with a level or other gradient device is only accurate at that point and may change a 100' up the hill.

In other words, significant digits past a whole number, or a tenth at the most is all that one can accurately expect without surveying equipment. Having said that, either formula given in previous posts will yield a percent grade more than accurate enough for real-life purposes.

I had a cyclist in my area ask me the grade of a local road and I went out with a 10' level and an engineering rule to take some quick and dirty measurements. I measured the 1/2 mile grade in three places and got grades of 7.8, 9.2, and 10.5. All that in less than 1/2 of a mile on a relatively new road. So is it a 7.8 or a 10.5% grade? Is it an average of the three? Regardless of what one calls its grade, it's still going to ride the same. :)

TheRCF
09-24-05, 01:19 PM
Yeah, those grades do keep changing - I particularly hate the switchbacks on the long 5 mile climb I sometimes do when I'm on the inside of the curve. They can really be tough compared to the rest.

Ultimately, the main thing I want to be able to do is make comparisons to others, even if less than perfect. I mean, think how many times people talk about how they had this "big" hill or "long" hill or "steep" hill, etc - even comments about how strong the wind is.

At least with distance, you can get some specific numbers from a few posters. But few really know the changes in elevation they are doing. Still, sometimes a person will give the percent grade and now that I can at least approximate my grades, I can tell how I compare a bit better.

This may mean more to me than to some others because I'm almost always riding alone so I don't get to make direct comparisons to other riders.

Thanks for the insights.

Bob

Colonel
09-24-05, 01:47 PM
Hi All,

I had this really accurate and scientific type graph that I knocked up in paintshop that describes exactly what you are after, but it didn't want to attach, so here's the science behind the math, behind the graph:

You take the Length of the hill climbed (L) , divide it by the Time In Total Seconds (TITS) , multiply by the Average Speed Sustained (ASS) , divide by the Average Number of Spanners in a Sidchrome Toolkit (ANSST) , minus the time taken to drink a standard beer (BEER) . I draw your attention to the vital element of the equation here - beer.

GRADE = ((((L / TITS) * ASS) / ANSST) - BEER)

And that's the science behind the math behind the graph. I hope this clears things up.

Colonel

p.s. Just in case I need to spell it out for some - this is commonly referred to as HUMOUR, and yes, I understand that the OP wanted answers, and he already has them in spades. And to you maths nerds out there - don't question the formula, it is infallable.
p.p.s. I like the cyclistats climbing calculator - it looks sexy.

SSP
09-24-05, 02:07 PM
p.p.s. I like the cyclistats climbing calculator - it looks sexy.

Thanks, Colonel!

I focused on climbing this season, and added that tool to the program when I was doing some planning for the

KevinF
09-24-05, 07:29 PM
I've got one section of a ride in Seattle - 41.9 feet rise over 298.2 ft, which should calculate to a 295.2 ft actual distance? It's part of a bigger hill, but it's a killa.

I have to know -- how are you measuring these distances to tenths of a foot? 0.1 feet = 1.2 inches.

Cranks
09-24-05, 10:23 PM
DeLorme TopoMap. Don't know what they use to specify an exact spot - maybe the middle of an intersection? Take it with a grain of salt...

MarkS
01-13-06, 01:43 PM
MAC friendly?As an exercise in Java, I've written an experimental program to calculate hill distance, rise, elevation, climbing rate, duration, etc. The good news is that it is written in Java and should run anywhere. The bad news is that it is written in Java 1.4 and you will probably need the latest JVM (1.4 or above) available from http://java.com/en or from Apple (for Macintosh users).
Anyone interested can PM me with their email address.

Artkansas
01-13-06, 04:12 PM
Here is a website that will do the math for you.
Slope and Distance Calculator (http://www.1728.com/distance.htm)