Mathematics & StatisticsLast updated: 2026-10-01

Linear Function Calculator

Find the slope a and intercept b of y = ax + b from two points, with the substituted rate-of-change formula. Useful for middle-school linear functions and trend analysis.

Client-Side · Zero TelemetryPrivate & Secure
y = ax + b

(x₁, y₁)

(x₂, y₂)

Try an example

Enter two points to find the slope a and intercept b of y = ax + b.

ShareXfB!L

How to use

  1. 1

    Enter two points

    Fill in (x₁, y₁) and (x₂, y₂) that the line passes through.

  2. 2

    Read a and b

    Slope a = (y₂−y₁)÷(x₂−x₁) and intercept b = y₁ − a×x₁ are shown with substituted working.

  3. 3

    Read the equation

    The result appears as y = ax + b, ready to copy.

Features

  • Slope and intercept from two points with substituted working
  • Formatted y = ax + b output (y = ax when b = 0, − |b| when negative)
  • x₁ = x₂ (vertical line) reported as an error
  • Inputs are never transmitted; all computation happens locally in your browser

Use cases

Check linear homework

Verify "find the line through two points" problems from school math.

Analyze data trends

Compute the rate of change between two data points.

Sketch graphs

Confirm the slope sign to see whether the line rises or falls.

Details

A linear function y = ax + b is determined by its slope a (the change in y per unit change in x) and intercept b (the value of y at x = 0). Since two points determine a unique line, a and b follow from the two coordinates: a = (y₂−y₁)÷(x₂−x₁) and b = y₁ − a×x₁.

The slope a is also called the rate of change — how much y increases when x increases by 1. A positive slope rises to the right, a negative slope falls, and zero slope gives the horizontal line y = b. The intercept b is where the line crosses the y-axis at (0, b).

Conditions: x₁ must not equal x₂ (that would be the vertical line x = x₁, which cannot be written as y = ax + b). Coordinates accept absolute values up to one million. Inputs are never transmitted; all computation happens locally in your browser.

FAQ

What is the slope (rate of change)?

It is how much y changes when x increases by 1, computed as a = (y₂−y₁)÷(x₂−x₁). Positive slopes rise to the right, negative slopes fall, and zero gives a horizontal line.

What is the intercept?

The value of y at x = 0 — where the line crosses the y-axis. In y = ax + b, the intercept b means the line passes through (0, b).

Why can't I compute when x₁ equals x₂?

Two points with the same x-coordinate define the vertical line x = x₁. Since x is fixed regardless of y, it cannot be written in the form y = ax + b.

When is the slope zero?

When both points share the same y-coordinate. The line is horizontal, taking the form y = b (a constant), and y never changes no matter how x varies.

All processing happens in your browser. Your files are never uploaded.

Verified: Known values ((2,3),(5,9)→y=2x−1, (-1,4),(3,-8)→y=−3x+1, horizontal→y=5), the x₁=x₂ error and the English page are covered by browser tests

Did you know?

A line with slope a = 2 gains 2 in y for every 1 in x. On y = 2x − 1 through (2, 3), x = 5 gives y = 9 — the "rate of change × change" pattern predicts y, handy for pricing, distance and growth estimates.

Optional usage measurement settings

Only with your consent, a random browser ID and tool/learning events are sent to measure return visits. This is pseudonymous measurement. Inputs, answers, keys, files and search terms are excluded. Consent expires after 90 days. Declining does not limit any feature.

Measurement is off.

Retention and privacy