Line Equation Calculator: Slope and y = mx + c from Two Points
The equation and slope of a line from two points or a point and slope, in exact fractions.
- General form
- 2x + y − 1 = 0
- y-intercept (c)
- 1
- x-intercept
- 0.5
- Angle of inclination
- 116.5651 °
- Perpendicular slopem₁ × m₂ = −1
- 0.5
- Distance between the points
- 8.944272
- Midpoint x
- 1
- Midpoint y
- -1
Working
- 1.m = (y₂ − y₁) ÷ (x₂ − x₁); y − y₁ = m(x − x₁)
Formula and sources
Slope m = (y₂ − y₁) ÷ (x₂ − x₁); equation y − y₁ = m(x − x₁), or y = mx + c General form ax + by + c = 0 with whole numbers; x₁ = x₂ gives the vertical line x = x₁ Parallel: m₁ = m₂; perpendicular: m₁ × m₂ = −1; angle = arctan m
- Equation of a straight line — lower-secondary mathematics
When to use the Line Equation
Slope from two points
The slope is the change in y divided by the change in x. For (−1, 3) and (3, −5) it is (−5 − 3) ÷ (3 − (−1)) = −2, so the line is y = −2x + 1, or 2x + y − 1 = 0 in general form.
Fractions stay fractions
The equation is written with exact fractions, not rounded decimals. The points (1, 2) and (4, 3) give y = (1/3)x + 5/3, or x − 3y + 5 = 0 in whole numbers.
Vertical and horizontal lines
When both points share the same x, the slope is undefined and the equation is x = constant. When they share the same y, the slope is zero and the equation is y = constant.
Parallel and perpendicular
Parallel lines have the same slope. Perpendicular slopes multiply to −1, so a line with slope −2 is perpendicular to one with slope 1/2. That value is shown to speed up follow-up questions.
Frequently asked questions
What are the intercepts?
The y-intercept is c, where the line crosses the y-axis at x = 0. The x-intercept is the value of x where y = 0. A horizontal line never crosses the x-axis unless it lies on it.
How many decimals can I enter?
Up to three decimals for each coordinate and the slope. They are read exactly as fractions, so the equation stays exact.
What does the angle mean?
It is the angle between the line and the positive x-axis, from the arctangent of the slope, between 0° and 180°. A slope of 1 means 45°, and a negative slope gives more than 90°.
Related calculators
- Linear Systems (2–3 Unknowns)Linear systems in two or three unknowns by Cramer's rule.Example: x2Calculate →
- Pythagorean TheoremThe missing side of a right triangle, its angles, area and Pythagorean triples.Example: Side c15Calculate →
- Triangle SolverEvery side, angle, the area and the type of a triangle from SSS, SAS, ASA or AAS.Example: Area26.8328Calculate →