Slope Calculator

Enter two points, or a slope and one point, and get the slope, the angle of incline, the distance between the points, the midpoint, the full line equation and the perpendicular slope, with a labeled rise-over-run chart.

What you get
  • Two ways to startTwo points, or a slope and one known point.
  • The full line equationy = mx + b worked out, plus midpoint and distance.
  • Labeled rise-over-run chartThe line drawn with its rise and run legs marked.

What do you know?

Results update as you type

Two known points on the line. The slope is the rise between them divided by the run, and the order of the points does not change it.

Runs entirely in your browser. Nothing you type is sent or saved

Slope guide

What slope measures

Slope, usually written m, is a single number that captures both the steepness and the direction of a straight line. It answers the question: for every one step I take to the right, how many steps does the line go up or down? A slope of 2 means the line climbs 2 units for every 1 unit across; a slope of -0.5 means it drifts half a unit down per unit across. The larger the absolute value, the steeper the line.

Because it is a pure ratio, slope carries no units of its own: a ramp with slope 0.083 is "one unit up for every twelve across" whether those units are meters, feet or miles. That is what makes slope the shared language of graphs, roads, roofs and drain pipes.

Rise over run, worked out

For two points on a line, the slope is the vertical change divided by the horizontal change:

m = (y₂ - y₁) ÷ (x₂ - x₁) = Δy ÷ Δx

rise over run · the order of subtraction does not matter as long as both differences keep the same order

Worked example: points (1, 2) and (4, 8). The rise is 8 - 2 = 6, the run is 4 - 1 = 3, and the slope is 6 ÷ 3 = 2. The distance between the points comes from the Pythagorean theorem on the rise and run: √(3² + 6²) = √45 = 6.70820. The angle of incline satisfies tan(θ) = m, so θ = arctan(2) = 63.43495°. The line equation is y = mx + b, and b = y₁ - m·x₁ = 2 - 2 × 1 = 0, giving y = 2x. A perpendicular line would have slope -1 ÷ 2 = -0.5.

The four slope cases

  • Positive slope (m > 0): the line climbs from left to right. The bigger the value, the steeper the climb.
  • Negative slope (m < 0): the line descends from left to right. Budget lines, depreciation curves and downhill roads all carry negative slopes.
  • Zero slope (m = 0): the rise is zero, so the line is perfectly horizontal. Its equation collapses to y = b, a constant.
  • Undefined slope: the run is zero, so the formula divides by zero and the slope does not exist. The line is perfectly vertical, written simply as x = c, and it has no y-intercept form at all.
Order does not change the slope: computing (2 - 8) ÷ (1 - 4) from the example gives -6 ÷ -3 = 2, the same answer. The two minus signs cancel, which is why either point can be "first". What matters is keeping the y and x differences in the same order.

Slope as an angle and a grade

Slope, the angle of incline and the grade percentage are three dialects of the same measurement. The angle satisfies m = tan(θ), so θ = arctan(m); the grade is the slope written as a percentage. A slope of 2 is an angle of 63.43° and a grade of 200%. Construction speaks in ratios instead: an accessibility ramp built at 1:12 rises one unit per twelve units of run, which is a slope of 1 ÷ 12 = 0.0833, a grade of 8.33% and an angle of arctan(0.0833) = 4.76°. Try the preset buttons above the inputs to see each of these computed live.

The angle reading is most useful for small slopes, where slope and grade feel abstract; the ratio reading is most useful in building codes, which specify maximum rises and runs precisely because angles are harder to measure accurately on site.

Parallel and perpendicular lines

Two lines are parallel exactly when they share the same slope: y = 2x and y = 2x + 7 never meet, because one is the other lifted seven units. Two lines are perpendicular when their slopes multiply to -1, that is, each slope is the negative reciprocal of the other: the perpendicular partner of slope 2 is -1 ÷ 2 = -0.5, and the perpendicular partner of slope -3/4 is 4/3. Horizontal and vertical lines are each other's special case: a horizontal line (m = 0) meets a vertical one (undefined slope) at a perfect right angle, which is why the perpendicular-slope formula breaks down exactly there.

The perpendicular slope is the workhorse of coordinate geometry: it is how you build the shortest distance from a point to a line, the altitude of a triangle and the perpendicular bisector used to find a circle's center from three points.

Using the calculator well

  • Two points or slope plus a point: pick the mode that matches what you have. The two-point mode derives everything from the pair; the slope-and-point mode builds the line equation directly from b = y - m·x.
  • Mind the signs: coordinates below the x-axis and left of the y-axis are entered as negative numbers, and the order rule above means either point can go first, provided the y and x differences stay in step.
  • Vertical lines are not a bug: when the run is zero, the slope genuinely does not exist, and the calculator reports the equation x = c instead of y = mx + b. There is nothing to compute further.
  • Read the chart: the drawing shows the line with its rise and run legs dashed in, so a negative slope, a near-flat line or a steep climb is visible at a glance before you read any number.
  • Check units separately: if your x-axis is time in seconds and your y-axis is distance in meters, the slope is a speed in meters per second. The number is right, but naming its units is your job.

Where slope shows up

  • Ramps and accessibility: building codes cap wheelchair ramps near 1:12, so the slope calculation decides the ramp length a doorway needs.
  • Roof pitch: roofers describe pitch as rise per 12 units of run, which is a slope by another name; a 6:12 roof has slope 0.5 and an angle of 26.57°.
  • Drainage: sewer and drain lines are laid at gentle slopes, commonly around 1:48 to 1:96 for household pipe, so waste flows without the water leaving solids behind.
  • Graphing and data: the slope of a line of best fit is the rate of change, the "per year" or "per dollar" number that makes a trend meaningful.
  • Calculus: the slope of a line tangent to a curve at a point is that function's derivative there, which makes this simple ratio the foundation of differential calculus.

A short history of slope

Slope as we know it dates to 1637, when René Descartes published his appendix La Géométrie and welded algebra onto geometry: every straight line became an equation, and its steepness became a coefficient. Isaac Newton and Gottfried Leibniz sharpened the idea half a century later with calculus, defining slope for curves as the limit of ever-smaller secants, and engineers in the railway age turned it into the grade percentages still posted on mountain routes today. The letter m for slope appeared in English textbooks in the 19th century; nobody is certain whether it was meant for "modulus", from the Latin for measure, and the mystery has outlived every plausible explanation.

Common questions

Subtract the y coordinates to get the rise, subtract the x coordinates in the same order to get the run, and divide: m = (y₂ - y₁) ÷ (x₂ - x₁). For points (1, 2) and (4, 8), that is (8 - 2) ÷ (4 - 1) = 6 ÷ 3 = 2. The calculator does this instantly and also gives the angle, distance and line equation.

Because the run between any two points on a vertical line is zero, and the slope formula would divide by zero, which has no answer. A vertical line rises without moving across, so no finite number describes its steepness. Its equation is written x = c rather than y = mx + b, and it has no y-intercept to speak of.

They are the same measurement in different clothing. Slope is the ratio itself, such as 0.0833; the grade is that ratio written as a percentage, so a 1-in-12 ramp has a grade of 8.33%. Road signs use the percentage form, mathematics uses the decimal form, and converting between them is just multiplying or dividing by 100.

Flip the slope and change its sign: the perpendicular slope is -1 divided by m. A slope of 2 has perpendicular slope -0.5, and a slope of -3/4 has perpendicular slope 4/3. The rule works for every nonzero slope; horizontal and vertical lines are perpendicular to each other by definition, which is exactly where the formula has no value to produce.

No, as long as the y and x differences are subtracted in the same order. Swapping the points flips the sign of both the rise and the run, and the two negatives cancel, returning the identical slope. What breaks the calculation is mixing the order, subtracting y₂ - y₁ but x₁ - x₂, which changes the sign of the answer.

Use y = mx + b and solve for b with any point on the line: b = y - m·x. With slope 2 through the point (1, 2), b = 2 - 2 × 1 = 0, so the equation is y = 2x. The calculator's "slope and a point" mode performs exactly this step and prints the finished equation, including the special forms y = b and x = c.

The angle of incline is the arctangent of the slope: θ = arctan(m). A slope of 1 is exactly 45°, a slope of 2 is 63.43°, and the accessibility standard of 1:12 works out to 4.76°. For steep slopes the angle changes slowly, since arctan approaches 90° only as the slope grows without bound.

No. Every calculation runs in your browser. Nothing is stored or transmitted.

Rise over run, solved in one paste.

Browse all math calculators