Tool/Calculator to find a slope/grade value (of a road, a roof, a construction, a frame, etc.) from its height or width or length or distance etc.
Slope Calculator - dCode
Tag(s) : Geometry
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Slope is a measure of the inclination or decline of land, road or surface. It indicates the variation in height in relation to a distance traveled.
Slope is generally measured in percentage (a slope of 30%, or a rise/change of 30 units for a run horizontal distance of 100 units).
By extension, some call slope, the angle $ a $ (a slope of 15 degrees).
The slope $ p_\% $ (in % percent) is calculated by the ratio of the height $ h $ by the width $ w $ (multiplied by 100 to get a percentage): $$ p_\% = 100 \times \frac{h}{w} $$
Example: Calculate the slope for a vertical distance of 10m and a horizontal distance of 50m: $ p = 10/50 = 0.2 $ or $ 20% $
The slope $ p° $ (in ° degrees) is calculated by trigonometric functions: $$ p° = \arctan \left( \frac{h}{w} \right) \times \frac{180}{\pi} $$
Example: Calculate the slope for a vertical distance of 10m and a horizontal distance of 50m: $ p° = \arctan(10/50) \approx 0.19 \text{ rad} \approx 11.3° $ (multiply radians by $ 180/\pi $ to get a value in degrees)
The formula for converting slope from degrees to percentage is:$$ p° = \arctan \left( p_\% / 100 \right) \times \frac{180}{\pi} $$
The formula for converting slope from percentage to degrees is: $$ p_\% = 100 \tan( p° \times \frac{\pi}{180} ) $$
A positive slope (or grade) indicates that the land rise or is rising in the chosen direction (positive height difference), while a negative slope indicates that the land is falling or falling in the chosen direction (negative height difference).
A grade/slope of 0% means that there is no significant vertical change in the distance traveled. This is equivalent to flat land (no elevation).
The following equations allow us to find $ d $, $ h $, $ w $ from the angle $ a $ (in degrees)
$$ d = w / \cos(a \pi/180) $$
$$ h = d \sin(a\pi/180) = w \tan(a \pi/180) $$
$$ w = h / \tan(a \pi/180) $$
From the slope $ p_\% $ in percentage:
$$ d = w / \cos(\arctan( p_\% / 100 ) ) $$
$$ h = d \sin( \arctan( p_\% / 100 ) ) = w \tan( \arctan( p_\% / 100 ) ) $$
$$ w = h / \tan( \arctan( p_\% / 100 ) ) $$
dCode retains ownership of the "Slope Calculator" source code. Any algorithm for the "Slope Calculator" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Slope Calculator" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Slope Calculator" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Slope Calculator" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Slope Calculator on dCode.fr [online website], retrieved on 2025-04-16,