Slope, Distance & Midpoint Calculator

Find the slope, distance, midpoint, angle and line equation between two points, plus the perpendicular slope and intercepts.

Updated · Free · Runs in your browser

Slope (m) —
Distance —
Midpoint —
Equation of the line —
Angle of inclination —
Grade —
Perpendicular slope —
Intercepts —
    Was this calculator helpful?

    The formula

    Slope m = (y₂ − y₁) ÷ (x₂ − x₁)
    Distance d = √((x₂ − x₁)² + (y₂ − y₁)²)
    Midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2)
    Line: y = mx + b, where b = y₁ − m·x₁
    Angle = arctan(m);  perpendicular slope = −1/m;  grade = m × 100%

    Worked example

    1. Points (1, 2) and (7, 10):
    2. Slope = (10 − 2) ÷ (7 − 1) = 8/6 = 4/3 = 1.3333.
    3. Distance = √(6² + 8²) = √100 = 10.
    4. Midpoint = (4, 6).
    5. b = 2 − 4/3 × 1 = 0.6667, so y = 1.3333x + 0.6667.
    6. Angle = arctan(4/3) = 53.13°; perpendicular slope = −0.75.

    Slope: rise over run

    The slope of a line measures how steep it is: the change in y (the rise) divided by the change in x (the run) between any two points. A slope of 2 means the line rises 2 units for every 1 unit across; a negative slope means it falls from left to right; a slope of 0 is a horizontal line; and a vertical line has an undefined slope because the run is zero. The calculator shows the slope as a simplified fraction when the inputs are whole numbers, which is often what textbooks expect.

    The distance formula

    The distance between two points comes straight from Pythagoras' theorem. The horizontal and vertical differences form the two legs of a right triangle, and the distance is the hypotenuse: d = √(Δx² + Δy²). For the points (1, 2) and (7, 10), the differences are 6 and 8, so the distance is 10, the classic 6-8-10 right triangle. In three dimensions, add the z difference squared under the square root. For distances on the Earth's surface between latitudes and longitudes, use our GPS distance calculator instead.

    The midpoint formula

    The midpoint is the point exactly halfway between the two points, found by averaging their x-coordinates and their y-coordinates. It's used to find the centre of a line segment, to bisect lines in geometric constructions and to find the centre of a circle when you know the two ends of a diameter. To find a point a different fraction of the way along, such as one third, multiply the differences by that fraction and add them to the first point.

    The equation of a line

    Once you know the slope m, the y-intercept b follows from either point: b = y₁ − m·x₁. The line is then y = mx + b, the slope-intercept form. Other forms are equally valid: point-slope form, y − y₁ = m(x − x₁), and standard form, Ax + By = C. The x-intercept, where the line crosses the x-axis, is −b/m. Two lines are parallel if they have the same slope, and perpendicular if their slopes multiply to −1, so the perpendicular slope is the negative reciprocal.

    Slope as an angle or a grade

    Slope can also be expressed as an angle, arctan(m), or as a percentage grade, m × 100. A slope of 1 is a 45° angle and a 100% grade. Road signs warning of a 10% hill mean the road rises 10 m for every 100 m travelled horizontally, an angle of about 5.7°. Wheelchair ramps in many countries are limited to a 1 : 12 slope (8.33%). For ramps, drainage and grading on building sites, the construction slope calculator converts between ratio, percent and degrees.

    Parallel lines

    Lines with equal slopes never meet unless they're the same line.

    Where these formulas are used

    Coordinate geometry underpins mapping, computer graphics, physics and data analysis. The slope of a distance–time graph is speed, and the slope of a best-fit line shows how strongly two variables are related. Game developers use distance formulas to detect collisions, and engineers use them to lay out sites. To solve two line equations together and find where lines cross, use the linear equation solver, and for triangles formed by three points, the triangle calculator.

    Frequently asked questions

    How do you find the slope between two points?
    Subtract the y-values and divide by the difference in the x-values: m = (y₂ − y₁) ÷ (x₂ − x₁). For (2, 3) and (6, 11), m = 8 ÷ 4 = 2.
    What is the distance formula?
    d = √((x₂ − x₁)² + (y₂ − y₁)²). It's Pythagoras' theorem applied to the horizontal and vertical differences between the points.
    How do I find the midpoint?
    Average the coordinates: ((x₁ + x₂)/2, (y₁ + y₂)/2). The midpoint of (0, 0) and (8, 6) is (4, 3).
    What does an undefined slope mean?
    The line is vertical: the x-values are equal, so the run is zero and you can't divide by it. Its equation is x = constant.
    How do I convert slope to degrees?
    Take the arctangent of the slope. A slope of 0.5 is arctan(0.5) = 26.57°.

    ↑↓ to navigate · Enter to open