Skip to content
DeviceCheckHub

Slope Calculator

The slope of the line through two points, exactly, with its equation in every form, the angle, distance, midpoint and a graph.

Your line

Whole numbers, decimals and fractions such as 2/3 all work.

Enter two points.

Step by step

  1. Enter two points to see each step.

Divide the segment AB in a ratio

Enter the line first.

How to use the slope calculator

  1. Enter the coordinates of two points on the line, (x₁, y₁) and (x₂, y₂). Or choose “A point and the slope” if you already know the slope.
  2. Read the slope as an exact fraction and a decimal, then the equation of the line in slope-intercept, point-slope and standard form, the intercepts, the angle and the grade.
  3. See the distance and midpoint between the points, the slope of parallel and perpendicular lines, a graph, and every step of the working. Below, you can find the point that divides the segment in any ratio.

The slope formula

The slope of a line measures how steep it is: how much y changes for each step of 1 in x. Between two points on the line, it is the change in y divided by the change in x:

m = (y₂ − y₁) / (x₂ − x₁)

The change in y is called the rise and the change in x the run, so slope is often remembered as rise over run. It doesn’t matter which point you call the first, as long as you subtract in the same order on the top and the bottom.

Slope is the rate of change of a linear relationship. The Common Core standards for grade 8 ask students to “determine the rate of change and initial value of the function from a description of a relationship or from two (x, y) values” (standard 8.F.B.4). The rate of change is the slope, and the initial value is the y-intercept.

A worked example: (−2, 3) and (4, −1)

  1. Slope: m = (−1 − 3) / (4 − (−2)) = −4/6 = −2/3.
  2. y-intercept: put (−2, 3) into y = mx + b: 3 = (−2/3) × (−2) + b = 4/3 + b, so b = 5/3.
  3. Slope-intercept form: y = −(2/3)x + 5/3.
  4. Point-slope form, using (−2, 3): y − 3 = −(2/3)(x + 2).
  5. Standard form, multiplying by 3 to clear the fractions: 2x + 3y = 5.
  6. Distance: √(6² + (−4)²) = √52 = 2√13, about 7.211. Midpoint: (1, 1).

Positive, negative, zero and undefined slopes

The equation of a line in three forms

All three describe the same line. The calculator gives each one exactly, keeping fractions as fractions rather than rounding them.

Slope as an angle and a grade

The angle a line makes with the x-axis is the inverse tangent of its slope: θ = tan⁻¹(m). A slope of 1 makes a 45° angle, and a slope of −1 makes −45°. On roads and ramps, slope is usually given as a grade, the slope as a percentage: a road that rises 6 feet over 100 feet of distance across has a slope of 0.06, a 6% grade.

Parallel and perpendicular lines

Parallel lines have the same slope. Perpendicular lines have slopes that are negative reciprocals of each other, so they multiply to −1: a line with slope 2/3 is perpendicular to any line with slope −3/2. A horizontal line is perpendicular to a vertical one. The high school geometry standards ask students to “prove the slope criteria for parallel and perpendicular lines and use them to solve geometric problems (e.g., find the equation of a line parallel or perpendicular to a given line that passes through a given point)” (HSG-GPE.B.5). The calculator gives the perpendicular line through your first point.

Distance and midpoint

The distance between two points comes from the Pythagorean theorem, with the run and rise as the two shorter sides of a right triangle: d = √((x₂ − x₁)² + (y₂ − y₁)²). The midpoint is the average of the coordinates: ((x₁ + x₂)/2, (y₁ + y₂)/2). Geometry standard HSG-GPE.B.7 uses these to “compute perimeters of polygons and areas of triangles and rectangles, e.g., using the distance formula.” The calculator gives the distance in simplest radical form, such as 2√13, as well as a decimal.

Dividing a segment in a ratio

Standard HSG-GPE.B.6 asks students to “find the point on a directed line segment between two given points that partitions the segment in a given ratio.” To divide AB in the ratio r : s, go r/(r + s) of the way from A to B, in both x and y. For A (0, 0) and B (10, 5) in the ratio 2 : 3, that is 2/5 of the way: (4, 2). The midpoint is the ratio 1 : 1.

Slope in everyday life

Any steady rate is a slope. If a taxi charges a fixed fee plus a price per mile, plotting the fare against the miles gives a straight line: its slope is the price per mile and its y-intercept is the fixed fee. Two fares, such as $12 for 4 miles and $20 for 8 miles, are two points; the slope is (20 − 12)/(8 − 4) = 2 dollars a mile, and the fixed fee is 12 − 2 × 4 = 4 dollars.

Your data stays on your device

Everything is worked out in your browser. Nothing you type is sent anywhere or stored.

Frequently asked questions

What is the formula for slope?

Slope m = (y₂ − y₁) / (x₂ − x₁): the change in y divided by the change in x between two points on the line, often called rise over run. For (1, 2) and (4, 8), m = (8 − 2) / (4 − 1) = 6/3 = 2.

What does an undefined slope mean?

A vertical line, where both points have the same x. The run is 0, and dividing by 0 is undefined, so the line has no slope as a number. Its equation is x = a number, such as x = 3. A horizontal line is different: its slope is 0.

How do I find the equation of a line from two points?

Find the slope m first, then put one point into y = mx + b and solve for b. For (−2, 3) and (4, −1), m = −2/3, and 3 = −2/3 × (−2) + b gives b = 5/3, so y = −(2/3)x + 5/3.

What is the slope of a perpendicular line?

The negative reciprocal: flip the fraction and change its sign. A line with slope 2/3 is perpendicular to lines with slope −3/2, and the two slopes multiply to −1. Parallel lines have the same slope.

How do I turn a slope into an angle or a grade?

The angle with the x-axis is the inverse tangent of the slope: a slope of 1 is 45°. The grade is the slope as a percentage: a slope of 0.05 is a 5% grade, rising 5 units for every 100 across.

Is anything I type saved or sent?

No. Everything is worked out in your browser and nothing you type is sent anywhere or stored.

Last updated · About DeviceCheckHub