About this tool
The slope calculator finds the slope of the straight line through two points and writes the line in slope-intercept form. Students use it for algebra and coordinate geometry, and it also helps with rates of change in data. Slope is rise over run: the change in y divided by the change in x, . The y-intercept b is where the line crosses the y-axis.
How it works
Enter the x and y coordinates of two points on the line. They can be whole numbers, decimals or negative values, and the order of the points does not matter, because swapping them flips the sign of both the rise and the run.
The calculator divides the change in y by the change in x to get the slope m, then substitutes the first point into to find the y-intercept. Together they give the line . When both points share the same x value, the run is zero, so the tool reports a vertical line instead of a slope.
Example
The default points are and . The rise is and the run is , so the slope is . The intercept is . The line equation is : every step of one unit to the right raises the line by two units, and it crosses the y-axis at 1.
Negative slopes work the same way. For the points and , the rise is and the run is , so . The intercept is , giving . Substituting returns , which confirms that the second point lies on the line.
Assumptions and limits
The two points must be different. If they share the same x coordinate, the line is vertical, the slope is undefined, and the tool reports the line as x equals that value. It works with straight lines in two dimensions only and does not fit a line to more than two points. Results are decimals, so a slope of 1/3 is shown as 0.333333333333 rather than as a fraction. To get a percent grade or an angle, convert the slope as described in the questions below.
Frequently asked questions
What does a negative slope mean?
The line goes down from left to right: y decreases as x increases. A zero slope is a horizontal line, and a vertical line has an undefined slope. In real data, a negative slope means one quantity falls as the other rises, such as a balance shrinking over time. The larger the absolute value, the steeper the line.
How do you convert slope to a percent grade?
Multiply the slope by 100. A slope of 0.05 is a 5% grade, meaning a rise of 5 units for every 100 units of horizontal run. To turn a slope into an angle, take its arctangent; a slope of 1 is a 45-degree line and a 100% grade.
What is the slope of a line perpendicular to this one?
For a nonvertical, nonhorizontal line it is the negative reciprocal. A line with slope 2 is perpendicular to any line with slope −1/2. Multiplying the two slopes gives −1, which is a quick check. A horizontal line and a vertical line are also perpendicular, even though the vertical one has no numeric slope.
What is the point-slope form of a line?
It is . Expanding it and solving for y gives the slope-intercept form . For the default points, expands to . Point-slope form is handy when you know the slope and one point but not the intercept.
Can I use the slope to predict other points on the line?
Yes, substitute any x value into . With , gives . This only holds for points on the same straight line, so extending real data far beyond the two measured points assumes the trend stays linear.
Link with your values
Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.
| Parameter | Value | If omitted |
|---|---|---|
x1x₁ | number | required |
y1y₁ | number | required |
x2x₂ | number | required |
y2y₂ | number | required |
Examples
?x1=1&y1=2&x2=4&y2=11
Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.
Result elements: [data-result-block="slope_calculator"]