Search the complete library

Find a useful next step.

Start typing to search the complete UtilHub library.

Learning & education · Free online tool

Straight line equation calculator

Find the gradient, y = mx + c equation, midpoint and distance for the line through two points.

No sign-upNo run limitPrivate inputsMobile-friendly

Straight line equation calculator workspace

Runs locally in your browser

Result

Equation—
Gradient (m)—
y-intercept (c)—
x-intercept—
Midpoint—
Distance between points—
Perpendicular gradient—
ax + by + c = 0 form—
Angle—

Use it with confidence

How to use the straight line equation calculator.

01

Add the requested inputs

Use the labelled fields in the workspace above. If example values are provided, try them first or replace them with your own.

02

Calculate and review

Use the main action when needed. Gradient m = (y₂ − y₁) ÷ (x₂ − x₁) and c = y₁ − m x₁. The midpoint averages the coordinates, the distance uses Pythagoras, and a perpendicular line has gradient −1 ÷ m.

03

Try a worked example

The line through (1, 3) and (4, 9) has gradient 2 and equation y = 2x + 1. Its midpoint is (2.5, 6) and the points are √45 = 3√5 ≈ 6.708 apart.

04

Check the assumptions

Values are kept as exact fractions where possible. A vertical line has no gradient and is written x = k.

Helpful answers

Straight line equation calculator FAQs.

Is the straight line equation calculator free?

Yes. Use it as often as you need, with no sign-up and no run limit. Your inputs stay in your browser.

Does UtilHub upload or save my inputs?

No. This tool runs in your browser and UtilHub does not receive or store the values you enter. Your browser or device may still retain normal local history or form data.

How does this straight line equation calculator work?

Gradient m = (y₂ − y₁) ÷ (x₂ − x₁) and c = y₁ − m x₁. The midpoint averages the coordinates, the distance uses Pythagoras, and a perpendicular line has gradient −1 ÷ m.

What should I check before using the result?

Values are kept as exact fractions where possible. A vertical line has no gradient and is written x = k.

Coming up