Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Interpolated value y
4
at the target point x
Slope (y₂−y₁)/(x₂−x₁) 2

What is linear interpolation?

Linear interpolation is a method for estimating an unknown value that falls between two known data points. It assumes the relationship between the points is a straight line, so the value at any intermediate x can be read directly off that line. It is one of the most widely used techniques in engineering, statistics, finance, chemistry, and computer graphics whenever you have a table of values but need a result for a point that is not listed.

Two known points connected by a straight line with an interpolated point between them on an x-y graph
Linear interpolation estimates an unknown y value on the straight line between two known points.

How to use this calculator

Enter your first known point as \(x_1\) and \(y_1\), your second known point as \(x_2\) and \(y_2\), and the target x where you want to estimate y. The calculator returns the interpolated y value along with the slope of the line connecting the two points. The target x usually sits between \(x_1\) and \(x_2\), but the same formula will also extrapolate beyond that range.

The formula explained

The formula is $$y = y_1 + \left(x - x_1\right) \cdot \frac{y_2 - y_1}{x_2 - x_1}$$ The term \(\frac{y_2 - y_1}{x_2 - x_1}\) is the slope of the line between the two points. Multiplying that slope by the horizontal distance \((x - x_1)\) gives the vertical change from \(y_1\), and adding it back to \(y_1\) yields the value at x. If \(x_2\) equals \(x_1\) the line is vertical and interpolation is undefined, so the calculator guards against division by zero.

Advertisement
Diagram of the slope triangle showing rise over run between two points used in the interpolation formula
The formula scales the known slope (rise over run) by the distance from the first point.

Worked example

Suppose you know that at \(x_1 = 1\) the value is \(y_1 = 2\), and at \(x_2 = 3\) the value is \(y_2 = 6\). What is y when \(x = 2\)? The slope is $$\frac{6 - 2}{3 - 1} = 2$$ Then $$y = 2 + (2 - 1) \times 2 = 4$$ The interpolated value is 4.

FAQ

Can I extrapolate beyond my two points? Yes — enter an x outside the range and the formula still applies, but extrapolation is less reliable than interpolation.

What if my data is not linear? Linear interpolation gives an approximation. For curved data, keep the two points close together or use polynomial/spline methods.

Why is the slope shown? The slope tells you the rate of change between your two points and confirms the direction of the trend.

Last updated: