Need to estimate a value between two known data points? This linear interpolation calculator finds the value at any point on a line defined by two coordinates, plus shows you the slope and equation.
Linear Interpolation Calculator
Using the calculator
Enter two known points (x₁, y₁) and (x₂, y₂), then specify your query value:
- Find Y at X: Enter an X value to find the corresponding Y on the line
- Find X at Y: Enter a Y value to find where the line crosses that horizontal
The calculator also displays the slope, Y-intercept, and full line equation.
If your query point falls outside the range of your known points, you're extrapolating – the calculator warns you and assumes the linear trend continues.
What is linear interpolation?
Linear interpolation estimates unknown values by assuming a straight-line relationship between known data points. Given two points, you can find any value along the line connecting them.
The formula:
y = y_1 + (x - x_1) \times \frac{y_2 - y_1}{x_2 - x_1}This is equivalent to the slope-intercept form y = mx + b, where:
m = \frac{y_2 - y_1}{x_2 - x_1}Example: estimating temperature
A sensor recorded 68°F at 8:00 AM and 82°F at noon. What was the temperature at 10:00 AM?
- Point 1: (8, 68)
- Point 2: (12, 82)
- Query: X = 10
You can use linear interpolation to come up with an estimate, here. The calculator gives:
y = 68 + (10 - 8) \times \frac{82 - 68}{12 - 8} = 68 + 2 \times 3.5 = 75°F(Of course, you could try to compute temperature from first principles using the sun's altitude angle, air mass factor, and ~1361 W/m² of solar irradiance... but interpolation is faster.)
Interpolation vs. extrapolation
Interpolation estimates values within your known range – generally safe if a relationship is approximately linear.
Extrapolation estimates values outside your known range – this is always riskier because you're assuming the trend continues. The further you extrapolate, the less reliable the estimate. Real-world relationships often change outside observed ranges – and as I say often in our Investing section, past performance is no guarantee.
Common applications
Lookup tables, sensor readings between intervals, graphics keyframe animation, and filling gaps in data like on our daily inflation calculator. You can extrapolate interpolate from there!
