Linear Interpolation

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

Estimating a Value Between Two Known Points

Linear interpolation estimates an unknown value between two known points, assuming a straight-line relationship between them. Enter two known (x, y) points and the x value you want an estimate for, and this calculator finds the corresponding y.

The Formula

y=y1+(xx1)y2y1x2x1\vC{y} = y_1 + (x - x_1) \cdot \frac{y_2 - y_1}{x_2 - x_1}

where (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) are your two known points and xx is the value you want an estimate for.

Worked Example

A car is at 50 miles at 2 hours, and 140 miles at 5 hours. Where was it at 3.5 hours?

    1. y=50+(3.52)1405052=50+1.530=95 milesy = 50 + (3.5 - 2) \cdot \frac{140 - 50}{5 - 2} = 50 + 1.5 \cdot 30 = \vC{95 \text{ miles}}

Key Factors to Consider

  • Interpolating between two points is generally more trustworthy than extrapolating beyond them. A target x value that falls between your two known points stays within the range the relationship was actually observed, while a target outside that range assumes the same straight-line trend continues unchanged — an assumption that gets riskier the further outside the known range you go.
  • This method is exact for a truly linear relationship, and only an approximation otherwise. A physical process with constant speed, a fixed rate, or any genuinely straight-line relationship gives an exact answer through this formula — but most real-world processes (like compound growth or acceleration) actually curve, so the further apart your two known points are, the more a straight-line estimate can diverge from reality partway between them.
  • Reference tables (like lookup tables in engineering, steam tables, or actuarial tables) commonly rely on linear interpolation between listed values. Rather than publishing every possible input value, a table lists a manageable set of known points and expects the reader to interpolate between them — this is one of the most common practical uses of this exact technique.
  • Adding a third known point can reveal whether linearity is actually a reasonable assumption. If a third point you know falls close to the line drawn between the other two, linear interpolation is probably reliable in that range — if it falls far off that line, the underlying relationship likely curves and a straight-line estimate should be treated with more caution.

Common Mistakes

  • Extrapolating far beyond the known range and treating the result with the same confidence as interpolation. A target value outside your two known points assumes the trend keeps going unchanged — a much riskier assumption than estimating a value that actually falls between them.
  • Assuming a straight-line relationship without checking whether the real process is actually linear. Processes like compound growth or acceleration curve rather than follow a straight line, so a linear estimate can be noticeably wrong, especially far from the known points.
  • Mixing up which known point is which. Swapping x1/y1 with x2/y2 in the formula produces a different (and wrong) slope — double-check that each known point’s x and y values are entered together correctly.
  • Using two known points that are very far apart when the underlying relationship isn’t linear. The wider the gap between your two points, the more room there is for a curve to diverge from the straight line connecting them — closer, more relevant known points generally produce a more trustworthy estimate.

Useful to Know

Source: Linear interpolation.

Frequently Asked Questions

What is linear interpolation?

Linear interpolation estimates an unknown value between two known data points by assuming the relationship between them follows a straight line. If you know a car's position at 2 hours and at 5 hours, linear interpolation estimates where it was at 3.5 hours, assuming a constant speed the whole way.

What's the difference between interpolation and extrapolation?

Interpolation estimates a value that falls BETWEEN your two known points, which is generally reliable. Extrapolation estimates a value OUTSIDE that range, which assumes the same straight-line trend keeps going beyond what you actually observed -- a riskier assumption the further you go. This calculator flags which one your result actually is.

When is linear interpolation not accurate?

Linear interpolation assumes a straight-line relationship between your two points. If the real relationship curves (like compound interest, population growth, or acceleration), a straight-line estimate can be noticeably off -- especially the further your target value is from the two known points.

What are some real-world uses of linear interpolation?

It's commonly used to read values off reference tables (like engineering lookup tables or actuarial tables) that only list a limited set of known points, to estimate a missing data point in a time series, and in computer graphics to smoothly blend between two values (like colors or positions) over a range.

How can I tell if a straight-line estimate is reasonable for my data?

If you have a third known point, check how close it falls to the straight line drawn between your other two points. A close match suggests the relationship really is roughly linear in that range; a big gap suggests the underlying relationship curves, and a linear interpolation estimate should be treated with more caution.

Confirm Your Age

To create an account, please tell us your birth month and year.