Slope and Line Calculator
Enter two points and this calculator returns the slope, the y-intercept, the equation of the line, the distance between the points, their midpoint and the angle the line makes with the x-axis. Every value updates as you type.
How to use the slope calculator
- Type the x and y coordinates of the first point.
- Type the x and y coordinates of the second point.
- Read the slope, equation, distance, midpoint and angle from the result cards.
Examples
Slope from two points
Point 1 = (0, 0), Point 2 = (2, 4)
Slope = 2, equation y = 2x, distance ≈ 4.4721
Vertical line
Point 1 = (3, 1), Point 2 = (3, 9)
Slope is undefined, equation x = 3
Frequently asked questions
How do you calculate the slope from two points?
Slope is the change in y divided by the change in x: m = (y2 − y1) / (x2 − x1). It tells you how steep the line is and whether it rises (positive) or falls (negative) from left to right.
Why is the slope of a vertical line undefined?
A vertical line has two points with the same x value, so the run (x2 − x1) is zero. Dividing the rise by zero is undefined, so there is no slope and the line is written as x = c instead of y = mx + b.
How is the equation of the line found?
Once the slope m is known, the y-intercept is b = y1 − m·x1, which gives the equation y = mx + b. A horizontal line becomes y = c and a vertical line becomes x = c.
How are the distance and midpoint computed?
The distance between the points is sqrt((x2 − x1)² + (y2 − y1)²) from the Pythagorean theorem. The midpoint is the average of the coordinates: ((x1 + x2) / 2, (y1 + y2) / 2).
What does the angle mean?
The angle is the direction of the line measured from the positive x-axis, computed with atan2(rise, run) and shown in degrees. A 45 degree angle means the line rises one unit for every unit it moves right.
Is my data sent anywhere?
No. Every calculation runs in your browser, so the coordinates you type are never uploaded or stored.
Related tools
Linear Equation System Solver
Solve a system of linear equations with 2 or 3 unknowns. Enter the coefficients and constants to get x, y and z, or detect no or infinite solutions.
Triangle Calculator
Find a triangle's area from base and height or from three sides with Heron's formula, and solve right triangles with the Pythagorean theorem.
Ratio Calculator
Solve a proportion A:B = C:D by leaving one value blank, or simplify a ratio to its lowest terms. Free, fast and works in your browser.
Area Calculator
Find the area of a circle, square, rectangle, triangle, trapezoid, parallelogram, ellipse, sector or rhombus. Free and runs in your browser.
Arithmetic Sequence Calculator
Find the nth term, the sum of n terms and the full term list for any arithmetic or geometric sequence. Enter the first term, step or ratio, and n.
Average Calculator
Find the mean, median, mode, range, sum, count, min and max of a list of numbers. Paste values separated by commas, spaces or new lines.