Slope Calculator - Two-Point Slope, Angle, and Line Equation
Use this slope calculator with two coordinates to find the slope, slope percent, angle in degrees, line distance, and the y = mx + b line equation quickly.
Slope Calculator
Results
What Is Slope Calculator?
A slope calculator finds the slope of a straight line through two given points (x1, y1) and (x2, y2) and turns that one number into the slope as a decimal, the slope as a percent, the angle the line makes with the positive x-axis, the distance between the two points, and the line equation y = mx + b. The same idea shows up in algebra, coordinate geometry, physics, and construction, so one tool that returns every form of the answer is enough for most problems.
- • Algebra and coordinate geometry homework: Find the slope of a line through two points and write y = mx + b in one step.
- • Physics and engineering graphs: Convert a slope on a position-time or voltage-time graph into a rate, an angle, or a percent grade.
- • Construction and grade checks: Translate two elevation points into a slope percent and an angle for ramps, driveways, or drainage.
- • Data analysis quick check: Compute the slope of a best-fit line through two anchor points before running a full regression.
When the goal is the percent grade in accessibility, drainage, or roof work, the slope percentage calculator reads a rise and a run directly, so you do not have to find two coordinates first.
How Slope Calculator Works
The slope of a straight line is the ratio of vertical change to horizontal change between any two points on the line. The page takes your two coordinates, applies that ratio, and derives the percent, angle, distance, and y-intercept from the same result.
- x1, y1: x- and y-coordinates of the first point on the line.
- x2, y2: x- and y-coordinates of the second point on the line.
- m: Slope of the line; positive when the line rises left to right, negative when it falls, 0 when the line is horizontal, and undefined when the line is vertical.
The percent output is the decimal slope times 100, the angle is the arctangent of the slope converted to degrees, and the distance is the Euclidean length of the segment. The y-intercept comes from substituting one point back into y = m x + b and solving for b.
The same formula covers negative slopes, horizontal lines, and the vertical case: when x2 equals x1 the slope is reported as undefined, the angle is 90 degrees, and the distance is the absolute difference in y between the two points.
Worked example: points (1, 2) and (4, 8)
x1 = 1, y1 = 2, x2 = 4, y2 = 8.
m = (8 - 2) / (4 - 1) = 6 / 3 = 2.
Slope m = 2, slope percent = 200%, angle = 63.4349 degrees, distance = 6.7082, line equation y = 2x + 0.
The line rises 2 units in y for every 1 unit in x, which matches the rise-over-run picture (rise 6, run 3).
According to Wolfram MathWorld, the slope of a straight line is the tangent of the angle the line makes with the positive x-axis, and for two points (x1, y1) and (x2, y2) on the line the slope equals (y2 - y1) divided by (x2 - x1).
Once the slope is known, the slope and intercept calculator writes the line in y = mx + b form for you, including the y-intercept derived from one of the input points.
Key Concepts Explained
Slope shows up under several names, and each one tells you a slightly different thing about the same line. These four concepts cover the cases you will run into most often.
Rise over run
Rise over run is the geometric picture behind m: how far the line goes up (rise) for each unit it moves across (run).
Positive vs negative slope
A positive slope means the line rises as x increases, a negative slope means it falls, and a zero slope is a horizontal line.
Slope-intercept form y = mx + b
Slope-intercept form writes the line as y = mx + b, where m is the slope and b is the y-intercept. Once you know the slope, b = y1 - m * x1 gives the full equation.
Undefined slope (vertical line)
When x2 equals x1 the denominator in the slope formula is zero, so the slope is undefined and the line is vertical. The angle is 90 degrees and the line is x = a constant.
The y = mx + b form is what a linear function graphing calculator plots from a slope and y-intercept, so the equation you get here is the same equation that tool reads as input.
How to Use This Calculator
Enter the x and y coordinates of the first point, then enter the coordinates of the second point. The slope calculator updates the result panel as soon as any field changes, so the slope, percent, and angle refresh in real time.
- 1 Enter the first point: Type the x1 and y1 values of the first point on the line. The defaults of 1 and 2 are a useful starting example.
- 2 Enter the second point: Type the x2 and y2 values of the second point on the line. Make sure x2 is different from x1 so the slope formula has a non-zero denominator.
- 3 Read the slope, percent, and angle: The result panel shows the slope m, the slope percent, and the angle the line makes with the positive x-axis, all updated in real time.
- 4 Read the distance and y-intercept: Use the distance to confirm the segment between the two points and the y-intercept to write the line in y = mx + b form.
- 5 Copy the line equation: The line equation field shows the same line written in y = mx + b form, so you can paste it into a homework answer or a spreadsheet.
A study desk has two corners at (0, 0) and (120, 75) on a coordinate grid measured in centimeters. Enter those four numbers and the calculator returns a slope of 0.625, a slope percent of 62.5%, an angle of about 32.0054 degrees, a distance of about 141.0672 cm, and the line equation y = 0.625x. That is the line of the diagonal support beam across the desk.
When the two points are anchor points on a graphed data set rather than the only data, the linear regression calculator fits the line through a full set of points and returns the same slope as part of the regression equation.
Benefits of Using This Calculator
The result tells you exactly which number is the slope and what it means in percent, angle, and line-equation form, all in a single pass.
- • Direct two-point calculation: Returns the slope, percent, angle, distance, y-intercept, and line equation from two coordinates in a single pass.
- • Percent and angle in one view: Shows the slope as a decimal, as a percent grade, and as an angle in degrees, so the same input is ready for algebra, physics, and construction work.
- • Slope-intercept form included: Builds the y = mx + b line equation from the slope and one of the input points, so you do not have to solve for b by hand.
- • Horizontal and vertical line handling: Reports a slope of 0 for a horizontal line and an undefined slope with a 90 degree angle for a vertical line.
- • Real-time recalculation: Updates the result panel as soon as any of the four coordinate fields change.
Rerun the calculation whenever a new pair of points is given. The output is reproducible because the formula is the same rise-over-run division regardless of the order of subtraction.
For batch work, copy the coordinate pairs into a spreadsheet and run the calculation for each row. The same formula also feeds the line-of-best-fit work, so a long table of (x, y) rows is the natural next step beyond a single pair.
Factors That Affect Your Results
A few characteristics of the input pair change the readability of the result, even when the underlying math is the same.
Sign of the slope
A positive slope means the line rises as x increases, a negative slope means it falls, and a zero slope is a horizontal line.
Magnitude of the slope
Slopes close to 0 are nearly horizontal. Slopes close to 1 rise at 45 degrees. Slopes larger than 10 push the angle toward 90 degrees and the percent grade into the thousands.
Equal x coordinates
When x2 equals x1 the slope is undefined, the angle is 90 degrees, and the line is x equals the shared x-coordinate.
Equal y coordinates
When y2 equals y1 the line is horizontal, with a slope of 0, a percent grade of 0%, and an angle of 0 degrees.
Equal points
When both points are equal, no line can be drawn. The calculator refuses to compute and asks for two distinct points.
- • The calculator handles a single pair of points at a time. For batch work, copy the pairs into a spreadsheet and apply the formula to each row.
- • The result is rounded for display only. The internal value uses the full double-precision division, so chaining the slope with a follow-up calculation should use the unrounded rise-over-run result.
- • The calculator does not handle complex points. The two points must be real coordinates.
When the input pair comes from elevation points, the slope percent matches the percent grade used in accessibility ramps and drainage. The angle in degrees matches the angle a roof pitch calculator converts to in one step.
When the slope is very large or very small, the result panel keeps full double-precision in the background; only the displayed number rounds for legibility. Use the unrounded value when chaining the slope into a follow-up calculation.
According to Khan Academy, the slope of a line through two points is (y2 - y1) divided by (x2 - x1); when x2 equals x1 the slope is undefined and the line is vertical, and when y2 equals y1 the slope is 0 and the line is horizontal.
According to Omni Calculator slope page, the slope m = (y2 - y1) divided by (x2 - x1) is the rise over run between two points and is the same as the tangent of the angle the line makes with the positive x-axis, so the same formula returns the slope, the slope percent, the line angle, and the line equation in slope-intercept form.
On a real construction project, the slope percent and the roof pitch in inches per foot describe the same rise-over-run ratio (multiply the slope percent by 0.12 to convert it to inches of rise per foot of run), and the roof pitch calculator converts the pitch to degrees and to a slope ratio in one step.
Frequently Asked Questions
Q: What is a slope calculator?
A: A slope calculator finds the slope of a straight line through two given points and returns the slope as a decimal, the slope as a percent, the angle in degrees, the distance, and the line equation y = mx + b. A slope calculator is the fastest way to convert two coordinates into the slope, the line angle, and the slope-intercept form of the line.
Q: How do you find the slope of a line from two points?
A: Subtract the y-coordinates to get the rise, subtract the x-coordinates to get the run, and divide rise by run. The slope formula is m = (y2 - y1) / (x2 - x1). For the line through (1, 2) and (4, 8), the slope is (8 - 2) / (4 - 1) = 2.
Q: What is the slope of a line that goes through (0, 0) and (3, 6)?
A: The slope is (6 - 0) / (3 - 0) = 2. The line rises 2 units in y for every 1 unit in x, so the slope percent is 200% and the angle is about 63.43 degrees.
Q: What does an undefined slope mean?
A: An undefined slope means the line is vertical, which happens when x2 = x1. The line is written as x equals a constant, and the angle with the x-axis is 90 degrees.
Q: How do you convert slope to an angle in degrees?
A: Convert a slope m to degrees with the arctangent function: angle in degrees = arctan(m) * (180 / pi). A slope of 1 is 45 degrees, a slope of 0 is 0 degrees, and a slope of 2 is about 63.43 degrees.
Q: How do you find the y-intercept once you know the slope?
A: Substitute the slope and one of the points into y = m x + b and solve for b. With m = 2 and the point (1, 2), 2 = 2 * 1 + b, so b = 0 and the line is y = 2x.