Equation of a Line Calculator
A straight line can be written as y = mx + b, where m is the slope and b is where the line crosses the vertical axis. Enter any two points on the line and this finds both numbers.
- Free
- Works offline after your first visit
- Saves on this device
- No sign-up
- Updated
How it works
The slope is the rise divided by the run: how much y changes, divided by how much x changes, between the two points.
The y-intercept comes from one of the points. Subtract the slope times that point's x value from its y value, and the line then reads y = slope times x plus the intercept.
Worked example
Through the points (1, 3) and (4, 11), the slope is 2.6667 and the line crosses the y-axis at 0.3333.
Questions
What if both points have the same x value?
Then the line runs straight up and down, a vertical line. A vertical line has no slope, so pick two points with different x values.
Does the order of the points matter?
No. Swapping the two points gives the same line and the same slope.
What does a negative slope mean?
The line goes down as it moves to the right.
More like this
- Percent Change CalculatorPercent up or down between two numbers.
- Average CalculatorMean of a list of numbers.
- Percent Difference CalculatorGap between two values, as a share of their average.
- Standard Deviation CalculatorSpread of a list of numbers.
- Weighted Average CalculatorAverage where some values count more.
- Ratio CalculatorSimplify a ratio or find a missing term.