Linear Interpolation Calculator
Interpolated y50.000000
Slope10.000000
Within Range?Yes — interpolated
The Linear Interpolation Calculator estimates the y value at a chosen x by drawing a straight line between two known points and reading off the height at that position. Interpolation is the standard way to fill a gap between tabulated data — looking up an intermediate value in a table of measurements, calibration curves, or lookup charts where only a few points are listed.
Formula
y = y₁ + (x − x₁) × (y₂ − y₁) / (x₂ − x₁)
- x₁, y₁
- First known data point
- x₂, y₂
- Second known data point
- x
- Position where y is being estimated
- y
- Interpolated (estimated) value
How it works
- Enter the two known points as (x₁, y₁) and (x₂, y₂), then enter the x value where you want to estimate y.
- The calculator finds the slope (y₂ − y₁) / (x₂ − x₁) and applies y = y₁ + (x − x₁) × slope to return the interpolated value.
- If the target x falls outside the interval between x₁ and x₂, the result is flagged as extrapolation, which is less reliable because it extends the line past the measured data.
Worked example
Estimate y at x = 5 given the points (0, 0) and (10, 100).
- Slope: (100 − 0) / (10 − 0) = 10.
- Apply: y = 0 + (5 − 0) × 10 = 50.
- Since 5 lies between 0 and 10, the result is a true interpolation, not extrapolation.
The interpolated value at x = 5 is y = 50.
Frequently asked questions
- What is the difference between interpolation and extrapolation?
- Interpolation estimates a value between your two known points, while extrapolation extends the line beyond them. The calculator flags extrapolation because predictions outside the measured range are less trustworthy.
- Why does the calculator reject equal x values?
- If x₁ equals x₂ the two points sit on a vertical line and the slope formula divides by zero, so a single y value for a given x does not exist. The tool reports the result as undefined in that case.
- Does linear interpolation assume a straight line?
- Yes. It assumes the quantity changes at a constant rate between the two points. If the underlying relationship is strongly curved, linear interpolation introduces error that grows with the spacing of the points.
- Is linear interpolation the same as lerp in programming?
- Effectively yes. The lerp function used in graphics and animation blends two values by the same straight-line rule, just parameterized by a fraction between 0 and 1 rather than by raw x coordinates.