Linear interpolation is the simplest way to estimate an unknown value that lies between two known data points, assuming a straight-line relationship. It's used everywhere from reading between the lines on a lookup table to estimating missing sensor readings and animating smooth transitions in graphics.

How linear interpolation works

Linear interpolation connects two known points, (x1, y1) and (x2, y2), with a straight line, then reads off the y-value at any x along that line: y = y1 + (x โˆ’ x1) ร— (y2 โˆ’ y1) / (x2 โˆ’ x1). The fraction (y2 โˆ’ y1) / (x2 โˆ’ x1) is the line's slope โ€” a constant rate of change. Because the formula assumes the relationship is exactly linear between your two points, it is exact for truly linear data (like a constant hourly rate) and an approximation for anything curved, where the error grows the further the target x is from both known points.

Interpolation vs. extrapolation

The math is identical whether your target x falls inside or outside the range [x1, x2] โ€” but the reliability is not. Interpolation (target x between the two points) is generally trustworthy because it's bracketed by real data on both sides. Extrapolation (target x outside the range) is a projection: it assumes the same linear trend continues indefinitely, which is often untrue for real-world data (growth curves flatten, temperatures plateau, trends reverse). Treat extrapolated results as a rough guide, not a guarantee, and be more cautious the further the target x is from the known range.

When linear interpolation isn't enough

This calculator uses two points and a straight line, which is the simplest and most common case (also called "lerp" in graphics and animation). If you have three or more data points and the relationship curves, consider polynomial or spline interpolation instead โ€” this tool does not support those. For statistical trend-fitting across many data points, use a linear regression calculator instead, which fits the best-fit line through all your data rather than passing exactly through two points.