Math

Slope calculator

Find the exact slope and the slope-intercept equation through two points.

Free to useNo sign-upCalculated in your browser

Two points

Coordinates from −1,000,000 to 1,000,000, with at most four decimal places.

Your coordinates stay in this browser.

Slope and equation

Enter two different points. A vertical line has undefined slope. Identical points do not determine a line.

Rise over run

The slope of the line through two points is the change in y divided by the change in x. OpenStax Elementary Algebra writes that as rise over run.

Through (1, 2) and (3, 6), the rise is 4 and the run is 2, so the slope is 2. The line crosses the y-axis at 0, and the equation is y = 2x.

Through (1, 1) and (4, 3), the rise is 2 and the run is 3, so the slope is the exact fraction 2/3. The y-intercept is 1/3, and the equation is y = (2/3)x + 1/3.

Each coordinate is stored as an exact number of ten-thousandths. The slope and intercept are reduced fractions. They are not the result of binary floating-point division. A decimal shown beside the fraction is labeled as an approximation and is rounded half up to six places. For 2/3, that approximation is 0.666667. It is not the exact slope.

Horizontal, vertical, and identical points

A horizontal line has rise 0. Through (0, 4) and (3, 4), the slope is 0 and the equation is y = 4.

A vertical line has run 0. Through (2, 5) and (2, 9), the slope is undefined and the equation is x = 2. OpenStax uses slope-intercept form for nonvertical lines. A vertical line does not have that form.

The same point entered twice, such as (2, 5) and (2, 5), does not determine a unique line. The page says so. It does not call that pair a vertical line.

A negative slope falls as x increases. Through (−1, 1) and (2, −5), the slope is −2 and the equation is y = -2x - 1.

What this page does not draw

There is no plotted graph here. Once you have an equation such as y = 2x, the graphing calculator can draw that function. Exact fraction arithmetic that is not a line belongs on the fraction calculator.

Coordinates must be from −1,000,000 to 1,000,000, with at most four decimal places. A blank coordinate, a fifth decimal place, a comma, and scientific notation are rejected.

Frequently asked questions

Is the six-decimal number the exact slope? Only when the exact fraction terminates within six places. Otherwise it is a rounded reading of the fraction. The fraction is the result.

Why is a vertical slope not zero? Zero slope is a horizontal line. A vertical line has no run, so the rise cannot be divided by the run.

Are these coordinates sent to analytics? No. Analytics may record that this calculator ran. The coordinates and the equation stay in this browser.

Sources & review

Last reviewed: . The formula is reproduced above so you can check the math independently.

How we check calculations and describe their limits

Exact rational arithmetic for two points. Not a graph, a regression, or a best-fit line through more than two points.

Accessibility and student privacy

Our accessibility target is WCAG 2.1 AA. We use automated checks for keyboard operation, narrow layouts and readable alternatives to charts. Keyboard and screen reader behavior can vary by device and browser.Report an accessibility issue.

These tools have no ads, affiliate offers or sponsored content. No account is needed. Calculations run in your browser; your inputs and results are not sent to us or to analytics. Google Analytics may be used to measure site usage. See Privacy & analytics for details and how to turn it off.