Find the gradient (slope) of a line instantly from two points or a linear equation. Calculate the angle, y-intercept, and full equation of the line with step-by-step breakdowns.
Gradient & Slope Calculator
Calculate the gradient from points or an equation
Enter the coordinates of two distinct points on the line.
Your Gradient Results
Slope, angle, and line equation
Enter two points or a linear equation, then click Calculate to find the gradient, angle, and equation of the line.
A Closer Look at the Gradient Calculator Full Walkthrough
What this calculator does
Many visitors arrive wanting a quick answer about gradient, then stay to explore variations. The Gradient Calculator makes that easy because you can change a single value and watch the outcome update straight away.
Who it helps
This tool is useful for teachers, parents helping with homework and school and college students. Each group approaches gradient with different priorities, yet the same careful inputs lead to a result everyone can rely on. Common situations include teaching a concept visually, revising before an exam and verifying a long calculation. In each case, a quick check of gradient helps you move forward with more confidence.
Getting accurate results
A few habits make gradient far more reliable. First, use brackets to avoid ambiguity. Second, keep full precision until the end. Finally, run your numbers twice with slightly different assumptions so you can see a range of possible outcomes rather than relying on a single figure.
Mistakes to avoid
Even careful users sometimes trip over entering values in the wrong order, or end up using degrees instead of radians. Build a short pause into your routine to look for them, and your figures for gradient will hold up much better.
Reading your result
After you calculate, look at the number in context. Gradient and maths are the kind of details that can shift the picture, so keep a note of the inputs you used and revisit them if anything changes. Bookmark this page so the Gradient Calculator is always one tap away when you need it again. The layout is designed for readability, so you can use the Gradient Calculator comfortably on a small screen while on the move. If you are unsure about a value, try a low and a high estimate and see how far apart the answers are.
A note on accuracy
Please treat the outcome from the Gradient Calculator as a helpful estimate. Your own circumstances may differ, so verify key figures with a trusted source before relying on them for a major decision.
Gradient & Angle Reference
Common gradient values and their corresponding angles with the positive x-axis.
| Gradient (m) | Angle (θ) | Line Type |
|---|---|---|
| 0 | 0° | Horizontal |
| 1 | 45° | Diagonal (Up) |
| √3 ≈ 1.732 | 60° | Steep (Up) |
| Undefined | 90° | Vertical |
| -1 | 135° (or -45°) | Diagonal (Down) |
| -√3 ≈ -1.732 | 120° (or -60°) | Steep (Down) |
What a Gradient Means: Rise, Run, Ratio, Percent and Degrees
A gradient is simply how much height you gain for every unit of distance you travel. If a slope rises 1 metre over a run of 12 metres, its gradient is 1 in 12, written as the ratio 1:12. The same slope can be written as a percentage (rise ÷ run × 100) or as an angle in degrees. All three say the same thing in different words, and the calculator above converts between them.
Ratio: rise : run, for example 1:12 means 1 unit up for every 12 units along. Percent grade: rise ÷ run × 100, so 1:12 is 8.33%. Angle: the angle of the slope, found with tan&supminus;¹(rise ÷ run), so 1:12 is about 4.76°. A gradient of 1:1 is 100% and 45° — for every metre forward you climb a metre.
Ratio, Percent and Degrees Conversion Table
Every value below is computed from the same formula: percent = 100 ÷ n and angle = tan&supminus;¹(1 ÷ n) for a ratio of 1:n.
| Ratio (1:n) | Percent grade | Angle |
|---|---|---|
| 1:2 | 50.00% | 26.57° |
| 1:3 | 33.33% | 18.43° |
| 1:4 | 25.00% | 14.04° |
| 1:5 | 20.00% | 11.31° |
| 1:6 | 16.67% | 9.46° |
| 1:8 | 12.50% | 7.13° |
| 1:10 | 10.00% | 5.71° |
| 1:12 | 8.33% | 4.76° |
| 1:15 | 6.67% | 3.81° |
| 1:20 | 5.00% | 2.86° |
| 1:30 | 3.33% | 1.91° |
| 1:60 | 1.67% | 0.95° |
Worked Example 1: A Wheelchair Ramp
A front door sits 500 mm above the path. At the gentlest Part M gradient of 1:20, the ramp run must be 500 mm × 20 = 10,000 mm, or 10 metres — exactly the longest single flight Part M allows, with a 500 mm rise. At the steepest allowed gradient of 1:12, the run is 500 mm × 12 = 6 metres, but it cannot be one straight flight: at 1:12 a flight may be at most 2 metres long with a 166 mm rise, so the 500 mm rise needs three short flights (166 mm + 166 mm + 168 mm) with level landings between them. That is why real ramps zig-zag: the rules trade length for rest stops.
A single step of 166 mm is the classic case: at 1:12 it needs a run of 166 mm × 12 = 1,992 mm, or about 2 metres of ramp for one step.
Worked Example 2: A Driveway
A driveway rises 1.2 metres over a run of 12 metres. The gradient is 1.2 ÷ 12 = 0.10, which is a ratio of 1:10, a percent grade of 10% and an angle of tan&supminus;¹(0.10) = 5.71°. That is steeper than any Part M ramp (the steepest allowed is 1:12, or 8.33%), which is fine for a driveway — cars cope with 10% easily — but it shows why the same slope would not pass as an accessible route.
Worked Example 3: A Roof
A roof rises 3 metres over a horizontal run of 6 metres. The gradient is 3 ÷ 6 = 0.5, a ratio of 1:2, a percent grade of 50% and an angle of tan&supminus;¹(0.5) = 26.57°. Roofers usually talk in degrees or in pitch (rise over span), so this roof is a 26.57° pitch — a fairly steep domestic roof.
Worked Example 4: Gradient Between Two Points
Find the gradient of the line through (−2, 1) and (3, 11). Gradient = change in y ÷ change in x = (11 − 1) ÷ (3 − (−2)) = 10 ÷ 5 = 2. As a ratio that is 1:0.5, as a percent grade it is 200%, and as an angle it is tan&supminus;¹(2) = 63.43°. The same formula works for any two points: subtract the x-values, subtract the y-values, and divide.
Worked Example 5: Baldwin Street, the World's Steepest Residential Street
Baldwin Street in Dunedin, New Zealand, is recognised by Guinness World Records as the world's steepest residential street. At its steepest point, about 70 metres below the top, the slope is about 1:2.86 — a 35% grade, or about 19°. For every 2.86 metres you travel horizontally, you climb 1 metre. The top 161.2-metre section climbs 47.2 metres, an average gradient of 1:3.41, or about 29.3%. The street is only about 350 metres long in total, rising from 30 metres to 100 metres above sea level. Guinness briefly gave the title to Ffordd Pen Llech in Wales in 2019, then returned it to Baldwin Street in April 2020 after remeasuring along the centreline (34.8% against 28.6%).
UK Part M Ramp Limits: How Steep Can an Accessible Ramp Be?
Approved Document M (Volume 2, Table 1) of the Building Regulations 2010 sets the maximum gradient for a ramp flight by its length. The longer the flight, the gentler it must be, because wheelchair users tire and find it hard to stop on the way down. No flight may have a going longer than 10 metres or a rise of more than 500 mm.
| Going of a flight | Maximum gradient | Maximum rise |
|---|---|---|
| 10 m | 1:20 (5.00%) | 500 mm |
| 5 m | 1:15 (6.67%) | 333 mm |
| 2 m | 1:12 (8.33%) | 166 mm |
For goings between 2 m and 10 m you may interpolate: 1:14 for a 4 m going and 1:19 for a 9 m going are the examples given. Any approach with a gradient of 1:20 or steeper must be designed as ramped access, and landings between flights must be level, with a maximum gradient of 1:60 along their length and a maximum cross-fall of 1:40.
Glossary of Gradient Terms
Rise: the vertical height gained. Run (or going): the horizontal distance covered. Gradient (or slope): rise ÷ run. Ratio: gradient written as 1:n. Percent grade: gradient × 100. Angle: the slope's angle above horizontal, in degrees. Fall: the same idea as rise, but downwards — drains and pipes are described by their fall. Landing: a level rest platform between ramp flights. Cross-fall: the sideways slope across a path or landing, which sheds rainwater.
How to Calculate the Gradient of a Line
Gradient = change in y ÷ change in x, often written m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (1, 2) and (4, 11), the gradient is (11 − 2) ÷ (4 − 1) = 9 ÷ 3 = 3.
Using y = mx + c
In the equation of a straight line, m is the gradient and c is where the line crosses the y-axis. Parallel lines have the same gradient, and the gradients of perpendicular lines multiply to give −1.
Gradients of roads and slopes
A road sign showing 10% or 1 in 10 means the road rises 1 unit for every 10 units travelled horizontally.
Gradient Calculator FAQ
Everything you need to know about calculating gradients, slopes, and linear equations.
In mathematics, the gradient (also known as the slope) of a line measures its steepness and direction. It is defined as the ratio of the vertical change (rise) to the horizontal change (run) between any two points on the line. A positive gradient means the line goes uphill from left to right, while a negative gradient means it goes downhill.
To calculate the gradient from two points (x1, y1) and (x2, y2), you use the formula: m = (y2 – y1) / (x2 – x1). First, find the difference in the y-coordinates (the rise), then divide it by the difference in the x-coordinates (the run). This calculator performs this calculation automatically.
If your linear equation is in the slope-intercept form (y = mx + c), the gradient is simply the coefficient of x (the value of m). If the equation is in the general form (Ax + By = C), you can rearrange it to y = (-A/B)x + C/B, meaning the gradient is -A divided by B.
A positive gradient indicates that as the x-values increase, the y-values also increase; the line slopes upwards from left to right. A negative gradient indicates that as x-values increase, y-values decrease; the line slopes downwards from left to right.
The gradient (m) of a line is equal to the tangent of the angle (θ) it makes with the positive x-axis. The relationship is expressed as m = tan(θ). Conversely, you can find the angle using the inverse tangent function: θ = arctan(m). An angle of 0° means a gradient of 0 (horizontal), and 90° means an undefined gradient (vertical).
A gradient is undefined when the line is perfectly vertical. In the formula m = (y2 – y1) / (x2 – x1), a vertical line has the same x-coordinate for all points, meaning the denominator (x2 – x1) is zero. Since division by zero is mathematically undefined, vertical lines do not have a gradient.
Once you have the gradient (m), you can write the equation of the line using the point-slope form: y – y1 = m(x – x1), where (x1, y1) is any point on the line. By rearranging this, you get the slope-intercept form: y = mx + c, where c is the y-intercept (the point where the line crosses the y-axis).
Yes, a gradient of zero means the line is perfectly horizontal. In this case, there is no vertical change (rise = 0) as you move along the line, so m = 0 / run = 0. The equation for a horizontal line is simply y = c, where c is a constant.
Subtract the y-values, subtract the x-values in the same order, then divide the first answer by the second.
It is the negative reciprocal. If one line has gradient 2, a perpendicular line has gradient −½.
