Slope, Distance and Midpoint Calculator
Enter the coordinates of two points. The calculator gives the slope of the line through them, the distance between them, their midpoint, the equation of the line and its angle with the x-axis.
Your numbers
How we calculate it
With dx = x2 − x1 and dy = y2 − y1, the slope is dy ÷ dx, the distance is √(dx² + dy²) and the midpoint is ((x1 + x2) ÷ 2, (y1 + y2) ÷ 2). The line is y = m × x + b, where m is the slope and b = y1 − m × x1.
A vertical line has dx = 0, so its slope is undefined and its equation is x = a number. The angle is measured from the positive x-axis, from 0° up to 180°. For (1, 2) and (4, 6) the slope is 1.3333, the distance is 5, the midpoint is (2.5, 4) and the line is y = 1.3333x + 0.6667.
Assumptions and limits
- The written line equation is rounded to 4 decimal places.
- The two points must be different.
- Coordinates can be negative or decimals.
Frequently asked questions
How do I find the slope between two points?
Divide the change in y by the change in x. From (1, 2) to (4, 6), y changes by 4 and x by 3, so the slope is 4 ÷ 3.
What is the slope of a vertical line?
It is undefined, because the change in x is zero and you cannot divide by zero. The line is written as x equals a constant.
How do I find the midpoint?
Average the x values and average the y values. The midpoint of (1, 2) and (4, 6) is (2.5, 4).
Related calculators
- Pythagorean Theorem CalculatorEnter any two sides of a right triangle and leave the third empty.
- Quadratic Formula CalculatorEnter the coefficients a, b and c of a quadratic equation to get its roots, the discriminant and the vertex of the parabola.
- Roof Pitch CalculatorEnter the rise and run of your roof to get the pitch ratio roofers use, the angle in degrees and the factor for converting flat area to actual roof surface.
- Percent Change CalculatorEnter a starting value and an ending value to see the percent increase or decrease and the absolute difference.
Worked example (a fixed example using the starting numbers, it does not change as you type)
Inputs: Point 1: x = 1; Point 1: y = 2; Point 2: x = 4; Point 2: y = 6.
- Slope 1.3333
- Distance 5
- Midpoint (2.5, 4)
- Line equation y = 1.3333x + 0.6667
- Angle with the x-axis 53.13 degrees
- Change in x 3
- Change in y 4
Embed this calculator
Add this calculator to your own page. Paste the code where you want it. The small link keeps credit to the source.
More math calculators
- Percentage Calculator
- Percent Change Calculator
- Percent of a Number Calculator
- Standard Deviation Calculator
- GCF and LCM Calculator
- Quadratic Formula Calculator
- Fraction Calculator
- Prime Factorization Calculator
- Factorial Calculator
- Exponent Calculator
- Square Root Calculator
- Percent Error Calculator
- Ratio Calculator
- Roman Numeral Converter
- Pythagorean Theorem Calculator
- Triangle Calculator
- Area Calculator
- Circle Calculator
- Volume Calculator
- Logarithm Calculator
- Number Sequence Calculator
- Factor Calculator
- Rounding Calculator
- Scientific Notation Calculator
- Long Division Calculator
- Basic Calculator
- Random Number Generator
- Half-Life Calculator
- Matrix Calculator
- Big Number Calculator
- P-Value Calculator
- Density Calculator
- Molarity Calculator
- Molecular Weight Calculator