Slope Calculator to Find Slope and Y-Intercept of a Straight Line

Slope Calculator Sign

This calculator will find the slope, y-intercept, and angle of a straight line when two points on the line are known.

Plus, the calculator also finds the distance between the two entered points, formulates the equation of the line, and even shows its work as to how it arrived at the slope and the line equation.

Finally, the calculator will attempt to graph the straight line formed by the two points (may not work for large coordinates or in older web browsers).

Read more ...

Also on this page:

Slope Calculator

Calculate the slope and properties of straight line from 2 points, plus create and graph the line's equation.

Learn More

Selected Data Record:

A Data Record is a set of calculator entries that are stored in your web browser's Local Storage. If a Data Record is currently selected in the "Data" tab, this line will list the name you gave to that data record. If no data record is selected, or you have no entries stored for this calculator, the line will display "None".

DataData recordData recordSelected data record: None
Point 1:Point 1 (X1,Y1):Point 1 (X1,Y1):Point 1 (X1,Y1):
X1:
-
/
X1 decimal:
Y1:
-
/
Y1 decimal:

Point 1 (X1,Y1):

Enter the X and Y values of the first point. The values can be in the form of a decimal or a whole number.

If you need to convert mixed numbers and fractions to decimals, expand the description to reveal a mini fraction-to-decimal calculator. Enter the whole number (if none, leave blank), the numerator, and the denominator and calculator will make the conversion and enter the decimal into the corresponding calculator field.

Point 2:Point 2 (X2,Y2):Point 2 (X2,Y2):Point 2 (X2,Y2):
X2:
-
/
X2 decimal:
Y2:
-
/
Y2 decimal:

Point 2 (X2,Y2):

Enter the X and Y values of the second point. The values can be in the form of a decimal or a whole number.

If you need to convert mixed numbers and fractions to decimals, expand the description to reveal a mini fraction-to-decimal calculator. Enter the whole number (if none, leave blank), the numerator, and the denominator and calculator will make the conversion and enter the decimal into the corresponding calculator field.

Δ X:Change in X:Change in X (X2 - X1):Change in X (X2 - X1):

Change in X (Δ X):

This is the difference or change between X2 and X1 and is often referred to as the run. If X2 is to the left of X1, the run will be a negative number. If X2 is to the right of X1, the run will be a positive number.

Δ Y:Change in Y:Change in Y (Y2 - Y1):Change in Y (Y2 - Y1):

Change in Y (Δ Y):

This is the difference or change between Y2 and Y1 and is often referred to as the rise. If Y2 is below Y1, the rise will be a negative number. If Y2 is above Y1, the rise will be a positive number.

Slope m:Slope m:Slope m:Slope m:

Slope m:

This is the rise (Δ Y) divided by the run (Δ X). If the slope is positive, it means the line is going up from left to right. If the slope is negative, it means the line is going down from right to left. The higher the absolute value of the slope, the steeper the line.

Angle θ:Angle θ:Angle θ:Angle θ:

Angle θ:

This is the angle the line forms with the X-axis, which is based on the arctangent of the slope.

Distance d:Distance d:Distance dDistance d:

Distance d:

This is the distance between the entered points. For a vertical line, the distance is the absolute value of the change in Y. For a horizontal line, the distance is the absolute value of the change in X. For all other lines, distance is calculated using the distance formula (Pythagorean theorem to calculate the length of a side of a triangle, a.k.a, the hypotenuse).

Y-intercept b:Y-intercept b:Y-intercept b:Y-intercept b:

Y-intercept b:

This is the point at which the line crosses the Y-axis, which is calculated by multiplying the slope by the result of -1 x X1.

Equation:Line equation:Equation y = mx - b:Equation y = mx - b:

Equation y = mx - b:

This is the calculated equation of the straight line that passes through the entered points. m stands for slope and b stands for Y-intercept.

If you would like to save the current entries to the secure online database, tap or click on the Data tab, select "New Data Record", give the data record a name, then tap or click the Save button. To save changes to previously saved entries, simply tap the Save button. Please select and "Clear" any data records you no longer need.

Related Calculators

algebra calculator

Help and Tools

Learn

How to calculate slope of a straight line from two known points, and formulate the line's equation.

How to Calculate Slope From Two Points

The formula for calculating the slope of a straight line from any two points on the line is as follows:

Slope Formula
m =Y2 - Y1
X2 - X1

To solve the slope formula, choose any two points on the straight line and designate one of them to be point #1 and the other to be point #2 (regardless of which point you choose for which designation you will still get the same answer).

After designating the two points ...

  • The X value from point #1 becomes X1.
  • The Y value from point #1 becomes Y1.
  • The X value from point #2 becomes X2.
  • The Y value from point #2 becomes Y2.

From there you simply substitute the values into the slope formula to solve for m (slope).

Example Problem

Find the slope of a straight line passing through the points (-2,-1) and (4,5).

For this example, we will choose (-2,-1) to be point number one, and (4,5) to be point number two, which means ...

  • X1 = -2
  • Y1 = -1
  • X2 = 4
  • Y2 = 5

From there we simply substitute the variables in the slope formula and solve it, like this:

Slope Solution
m =Y2 - Y1
X2 - X1
m =(5) - (-1)
(4) - (-2)
m =6
6
m =6/6, or 1

To see how the opposite designation yields the same result, this time we will choose (4,5) to be point number one, and (-2,-1) to be point number two, which means ...

  • X1 = 4

  • Y1 = 5

  • X2 = -2

  • Y2 = -1

Solving the formula give us:

m =(-1) - (5)
(-2) - (4)
m =-6
-6
m =6/6, or 1

So you see, it doesn't matter which point you designate as #1 or #2.

Two Cases to Be Aware Of

If the X coordinates are the same for both points, you will end up with a zero as the denominator. In turn, this means that the slope will be undefined since you can't divide a number by zero. Of course, all this really means is that a line with an undefined slope is a vertical line.

Conversely, if the Y coordinates are the same for both points, the slope will be zero (0 divided by any number is 0). A slope of 0 indicates a horizontal line.

Formulating the Line Equation

Once you have solved for the slope of the line running between the two points, you can then formulate an equation that will find the Y value for any X value, using the following formula:

Straight Line Equation
y - y1 = m(x - x1)

Using our first example, you would formulate the line equation as follows:

y - y1 = m(x - x1)
y - (-1) = 1(x - (-2))
y = 1x - ((2) + (-1))
y = x + 1

Using the second example, you would formulate the line equation as follows:

Straight Line Equation
y - y1 = m(x - x1)
y - (5) = 1(x - (4))
y = 1x - ((-4) + (5))
y = x + 1

In the case of a vertical line, the X value would be the same for any Y value.

In the case of a horizontal line, the Y value would be the same for X value on the line.

Adjust Calculator Width:

Move the slider to left and right to adjust the calculator width. Note that the Help and Tools panel will be hidden when the calculator is too wide to fit both on the screen. Moving the slider to the left will bring the instructions and tools panel back into view.

Also note that some calculators will reformat to accommodate the screen size as you make the calculator wider or narrower. If the calculator is narrow, columns of entry rows will be converted to a vertical entry form, whereas a wider calculator will display columns of entry rows, and the entry fields will be smaller in size ... since they will not need to be "thumb friendly".

Show/Hide Popup Keypads:

Select Show or Hide to show or hide the popup keypad icons located next to numeric entry fields. These are generally only needed for mobile devices that don't have decimal points in their numeric keypads. So if you are on a desktop, you may find the calculator to be more user-friendly and less cluttered without them.

Stick/Unstick Tools:

Select Stick or Unstick to stick or unstick the help and tools panel. Selecting "Stick" will keep the panel in view while scrolling the calculator vertically. If you find that annoying, select "Unstick" to keep the panel in a stationary position.

If the tools panel becomes "Unstuck" on its own, try clicking "Unstick" and then "Stick" to re-stick the panel.