Skip to content

Linear interpolation calculator

Estimate y at a target x from two known points on a straight line.

Known points and target

Your data stays in this browser.

(10, 20)(30, 60)
What this calculator findsTwo known points define a straight line. The diagram estimates y at the target x as you type.
Known pointsPosition to estimate

Inputs

(x₁, y₁)
(x₁, y₁)
(x₂, y₂)
(x₂, y₂)

Target point

Result

Your result will appear here

Enter the values, then select Calculate.

How to use the Linear interpolation calculator

Enter two known points

Enter the two known pairs (x₁, y₁) and (x₂, y₂), then enter the target x. The two x-values must differ, while negative values and decimals are accepted.

Select Calculate to estimate the y-value on the straight line through the two points. Editing any input immediately removes the old answer and disables copying.

Formula and interpretation

The calculator uses y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁). The fraction t = (x − x₁)/(x₂ − x₁) reports where the target lies relative to the first and second x-values.

A fraction from 0 to 1 is interpolation. A fraction below 0 or above 1 is extrapolation, so the result is clearly marked because it extends the line beyond the known interval.

Reading the result

Results show at most two decimal places for ordinary values while internal arithmetic keeps number precision. Very small or very large supported values use compact scientific notation.

Use this for a straight-line estimate between table readings. It does not fit a regression, spline, polynomial, or uploaded data series.

Worked examples

Between two readings

For (10, 20), (30, 60), and x = 15, t = 0.25 and y = 30.

Negative and decimal values

For (−2, 5.5), (2, −2.5), and x = 0, t = 0.5 and y = 1.5.

Outside the interval

For (0, 10), (5, 20), and x = 8, t = 1.6 and y = 26. This is extrapolation, not interpolation.

Uses and limits

Good uses

Use it for lookup-table values, calibration readings, or any quantity reasonably assumed to change in a straight line between two known points.

Important limits

The estimate is only as good as the linear assumption. Equal x-values cannot define y as a function of x, and values outside the interval are flagged as extrapolation rather than rejected.

Frequently asked questions

Can x₂ be less than x₁?

Yes. The two x-values may be in either order, but they cannot be equal.

Are endpoints allowed?

Yes. At x₁ the result is y₁, and at x₂ it is y₂.

Why is my result marked extrapolation?

Your target x lies outside the interval between the two known x-values.

Does this find a best-fit line?

No. It uses exactly two points and does not perform regression.

How is rounding handled?

The display uses at most two decimals; calculation keeps the available internal number precision.