Enter two points (x₁, y₁) and (x₂, y₂) to get everything about the line between them: slope, distance, midpoint, angle and the equation y = mx + b — with each formula's substitution shown.
For every 1 unit you move right, the line rises 2 units. A slope of 0 is flat, a negative slope falls to the right, and an undefined slope (division by zero) is a vertical line.
With Pythagoras: distance = √((x₂ − x₁)² + (y₂ − y₁)²). The coordinate differences are the two legs of a right triangle and the distance is its hypotenuse.
Average the coordinates: midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). It is the point exactly halfway along the segment.
The line is vertical: slope is undefined and there is no y = mx + b equation. The calculator reports the vertical line x = that value, plus the distance and midpoint as normal.
Slope: m = (y₂ − y₁) ÷ (x₂ − x₁). Distance: d = √((x₂ − x₁)² + (y₂ − y₁)²). Midpoint: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). Line equation: using point 1, b = y₁ − m·x₁, giving y = mx + b. Angle: θ = arctan(m), in degrees from the positive x-axis.
Inputs: (1, 2) and (4, 8).
Steps: Slope = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2. Distance = √((4−1)² + (8−2)²) = √(9 + 36) = √45 = 6.708. Midpoint = ((1+4)÷2, (2+8)÷2) = (2.5, 5). Intercept: b = 2 − 2×1 = 0, so the line is y = 2x.
Result: Slope 2, distance 6.708, midpoint (2.5, 5), equation y = 2x.
Add this calculator to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the calculator to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.