What you get from two points
Drop in two (x, y) coordinates. The calculator returns:
- Slope (m): rise over run, the standard slope-intercept m
- Distance: straight-line distance between the points (Pythagorean)
- Angle: angle of the line from the positive x-axis, in degrees
- Midpoint: the (x, y) point exactly halfway between the inputs
- Equation: the line in slope-intercept form: y = mx + b
All four come from the same two points. Handy for homework, surveying, mapping, and any time you have two coordinates and want the line through them.
Slope formulas
Slope is rise over run:
m = (y₂ − y₁) / (x₂ − x₁)
Three special cases the calculator handles correctly:
- Vertical line (x₁ = x₂): slope is undefined or “infinite”, the calculator displays ∞ and shows the equation as x = constant.
- Horizontal line (y₁ = y₂): slope is 0, equation is y = constant.
- Diagonal line at 45°: slope is exactly 1 (or −1 going the other way).
Distance formula
The distance between two points uses the Pythagorean theorem applied to the differences:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
This is the straight-line (“Euclidean”) distance, which is what you want for most geometry problems. For driving directions or geographic distances on a curved Earth, you’d use Haversine or great-circle formulas instead.
Line equation in slope-intercept form
Once you have the slope, you can find the y-intercept (b) by plugging in either point:
b = y₁ − m × x₁
The line is then y = mx + b. The calculator displays this fully filled in. For vertical lines (where m doesn’t exist), it shows x = c instead.
Midpoint formula
The midpoint is just the average of the coordinates:
M = ((x₁ + x₂)/2, (y₁ + y₂)/2)
Handy for finding the center of a line segment, which comes up in geometric proofs and computer graphics constantly.
What people use this for
- Algebra/geometry homework: the most common case
- Surveying: computing the slope of land between two surveyed points
- Roofing/construction: pitch calculations (rise/run with units)
- Game development: movement vectors between two screen positions
- Statistics: slope of a regression line through two data points (this calculator only handles two points; for many points you’d need linear regression)
Slope as a percentage (grade)
Civil engineering often expresses slope as a percentage rather than a unitless number. To convert:
percent = m × 100
A slope of 0.05 is a 5% grade. Steep highway grades are 6-8%; railroad max grades are around 4%; residential streets cap at about 12-15% in most US cities.
Frequently asked questions
My points are negative, does that matter? No. The formulas work for any real numbers. Negative slopes mean the line goes down as x increases.
What if both points are the same? The slope and direction are undefined. The calculator will show NaN or 0, sanity check that your two points are actually distinct.
Why does the angle look weird sometimes? The angle is computed via atan2, which returns angles in the range (−180°, 180°]. A line going from (0,0) to (−1, 1) gives 135°, while (0,0) to (1, −1) gives −45°. Both lines have the same physical direction but different signed angles based on which point you call “first.”
Can I use this for 3D? The calculator handles 2D only. For 3D, distance generalizes (add z² under the square root), but slope between 3D points isn’t a single number, it’s a direction vector.