>
Calculators.Solutions ⬇︎ Click to open the menus
Simple online calculators
Found a bug? Have a suggestion? Contact me
Loading the template
Calculators Solutions : Slope of a line
Fill in all the fields: the result is calculated automatically
A (
,
)
B (
,
)

Slope ➧
Y-intercept ➧
Equation ➧
Results history (All cells are editable)
x1 y1 x2 y2 Slope Y-intercept Equation Note
{y}
Please wait a moment

Calculate the Slope of a Line from Two Points

The slope of a line indicates its steepness: how much the y value changes when x increases by 1. From two points A(x₁, y₁) and B(x₂, y₂), this calculator determines the slope, the y-intercept and the equation of the line in the form y = ax + b.

The slope formula

The slope a is calculated with the formula:

a = y₂ − y₁x₂ − x₁

The y-intercept b (the value of y when x = 0) is then derived with:

b = y₁ − ax₁

How to use it

Enter the coordinates of the two points in the corresponding boxes: x₁ and x₂ for the x-coordinates, y₁ and y₂ for the y-coordinates. The slope, the y-intercept and the equation of the line are displayed automatically as you type.

You can also enter values as fractions (for example 1/2 or -3/4) or with a decimal point. To erase all the data, click the Clear button.

Special case: the vertical line

If both x-coordinates are identical (x₁ = x₂), the line is vertical and its slope does not exist: the displayed result is then Undefined.

Keyboard shortcuts

The calculator's keyboard shortcuts help you work faster:

m ⇝ Clear

f ⇝ Save the calculation to the history

Results history

By clicking Save, each calculation is stored in a table showing the resulting equation and the coordinates of the two points. You can then export it in CSV format to use it in a spreadsheet, or in PDF format.

Example calculation

Take the points A(1, 2) and B(3, 6). The slope is a = 6 − 23 − 1 = 42 = 2. The y-intercept is b = 2 − 2 × 1 = 0. The equation of the line is therefore y = 2x.