Slope Calculator
Calculate slope, y-intercept, and line equation from two points
Enter the coordinates of two points on a line and click Calculate slope to find the slope, y-intercept, line equation, angle, and slope classification.
Understanding slope, the y-intercept, and the equation of a line
A straight line in the coordinate plane is completely described by its slope and one point on the line. When two points are known, both the slope and the y-intercept can be calculated, and from those two values the full equation of the line in slope-intercept form can be written. This slope calculator takes two coordinate points as input and returns the slope, y-intercept, line equation, the angle the line makes with the x-axis, and a classification of the slope type.
To use the calculator, enter the x and y coordinates of both points. The coordinates can be any real numbers, including negative values and zero. After clicking Calculate slope, the result displays all five pieces of information about the line in a single panel.
Slope (represented by the letter m) is defined as the rise over the run: m = (y2 minus y1) divided by (x2 minus x1). Rise is the vertical change between the two points and run is the horizontal change. For example, if the first point is (1, 3) and the second is (4, 9), the rise is 9 minus 3 = 6 and the run is 4 minus 1 = 3, giving a slope of 6 divided by 3 = 2. This means the line rises 2 units vertically for every 1 unit it moves horizontally.
The y-intercept (b) is the value of y where the line crosses the y-axis, at x = 0. Given the slope and one point, the y-intercept is found using the point-slope relationship: b = y1 minus m times x1. From the example above, b = 3 minus 2 times 1 = 1. The full equation is therefore y = 2x + 1.
The slope-intercept form y = mx + b is the standard way to write a linear equation. It immediately communicates both the slope (the coefficient of x) and where the line crosses the y-axis (the constant term). Any point on the line can be verified by substituting its x-coordinate into the equation and confirming that the result equals the y-coordinate.
The angle the line makes with the positive x-axis is the arctangent of the slope. For a slope of 2, the angle is arctangent(2) which is approximately 63.43 degrees. This angle is always between -90 and +90 degrees (exclusive) for any finite slope. For a vertical line (undefined slope), the angle is exactly 90 degrees.
Slope classification: positive, negative, zero, and undefined
A positive slope means the line rises from left to right as x increases. This is the most common orientation for lines representing growth, increase, or upward trends in data. A negative slope means the line falls from left to right. Lines with negative slope represent decrease or inverse relationships. A slope of zero means the line is perfectly horizontal: y is constant regardless of x. These are lines of the form y = c for some constant c. An undefined slope means the line is perfectly vertical: x is constant regardless of y. These are lines of the form x = c. For a vertical line, the calculator returns a special message rather than a numeric slope, since the slope formula requires dividing by the run, which is zero for vertical lines.
The absolute value of the slope tells you the steepness of the line. A slope of 0.1 is nearly flat. A slope of 10 is very steep. Two lines are parallel if and only if they have the same slope. Two lines are perpendicular if the product of their slopes equals -1 (equivalently, one slope is the negative reciprocal of the other). These relationships are fundamental in geometry when working with grids, graphs, and coordinate proofs.
Practical applications of slope calculations
Slope has direct physical meaning in many contexts. In civil engineering and road design, gradient or grade is the slope of a road expressed as a percentage: a 5% grade rises 5 units for every 100 units of horizontal distance. Building codes specify maximum ramp gradients for wheelchair accessibility. Roof pitch is expressed as a slope ratio. The slope of a water main or drain pipe determines whether water flows under gravity.
In economics and finance, the slope of a graph indicates the rate of change. A demand curve with a steeper slope indicates a less elastic relationship between price and quantity. A stock chart with a steep positive slope over a period indicates rapid price growth. In physics, the slope of a distance-time graph is velocity, and the slope of a velocity-time graph is acceleration.
In data analysis and statistics, linear regression finds the line that best fits a set of data points. The slope of that line is the regression coefficient, which tells you how much the dependent variable changes for each unit increase in the independent variable. Understanding slope intuitively — as the rate of change between two variables — is one of the most transferable mathematical skills across quantitative disciplines.