Slope Calculator: Two Points & Slope-Intercept Form

 

Find the slope and equation of the line through two Cartesian points, or interpret a line already written as y = mx + b. The calculator distinguishes horizontal lines, vertical lines and identical points.

Use ordinary decimal numbers with up to six decimal places. Switching methods clears the entries. Coordinate axes must use consistent scales for geometric interpretation.

JavaScript is required for the calculator. The formulas and examples below remain available.

How to calculate slope with two points

Slope m = (y2 - y1) / (x2 - x1), provided x2 differs from x1. Subtract the coordinates in the same order for both axes. The numerator is the signed vertical change and the denominator is the signed horizontal change.

For x1 = 1, y1 = 2, x2 = 4 and y2 = 8, the changes are 6 and 3, so m = 2. The intercept is b = y1 - m x1 = 0, giving y = 2x.

Slope-intercept form: y = mx + b

In y = mx + b, m is the slope and b is the y-coordinate where the line crosses x = 0. Select Slope-intercept form (y = mx + b) and enter Slope (m) -0.5 and Y-intercept (b) 3. The result is y = -0.5x + 3: y decreases by 0.5 for every increase of 1 in x.

Vertical lines, horizontal lines and repeated points

Two points with equal x but different y define a vertical line x = constant. Its slope is undefined and it cannot be written as y = mx + b. It has no single y-intercept; when x = 0 it coincides with the y-axis. Two different points with equal y define a horizontal line with slope zero. Identical points do not define a unique line.

Positive and negative slope

A positive slope means y increases as x increases; a negative slope means y decreases. Reversing both point labels leaves the slope unchanged because both differences reverse signs. Slope zero is distinct from undefined slope. On charts with different units, slope has units of y per unit of x; it is not automatically a dimensionless physical gradient.

Limits and related tools

Inputs range from -1000000 to 1000000 with up to six decimal places. Browser arithmetic is approximate, not symbolic algebra. This tool does not parse arbitrary equation text, draw a graph or certify ramp, roof or drainage design. For straight-line length and midpoint, use the Distance Between Two Points Calculator. For right-triangle sides and angles, use the Right Triangle Calculator.

Privacy

Calculations run locally. This calculator does not save or transmit entries. The hosting site may use separate analytics or advertising services.

Step-by-step slope guide

Read How to Calculate Slope from Two Points and Write y = mx + b for worked examples, intercept calculations and the distinction between zero and undefined slope.

Comments

Popular posts from this blog

How to Calculate Mulch Needed: Cubic Yards and Bags

How to Calculate Billable Hours: Minutes, Rates and Billing Increments

How to Calculate Macros: Calories, Percentages and Grams