Skip to content

Linear Interpolation Calculator

Calculate the single value left blank among the X1, Y1, X2, Y2, X3, and Y3 fields.

Linear Interpolation Calculator

You have two data points and you don't know the value in between. For instance, a table shows the temperature at the 10th minute, and also at the 30th minute, but the 20th minute is missing. Or on a graph you have two measurement points and you want to read the approximate value between them.

Linear interpolation is exactly what you use for this job. You connect the two points with a straight line, then you check where the value you're looking for falls on that line. The logic is that simple. Yes, there is a formula, but there's no need to be intimidated by it.

This calculator has X₁, Y₁, X₂, Y₂, X₃, and Y₃ fields. You leave one of these six values blank and enter the other five. The tool calculates the value you left blank.

Most commonly, you know two points, enter the X value of the third point, and find its Y value.

Let's say we have these two points:

\[
(2,4)
\]

\[
(8,16)
\]

Now, when X equals 5, what will Y be? Even by eye, the result should lie somewhere between 4 and 16. The calculator turns that estimation into a number.

The Logic Is All About Slope

The key idea behind linear interpolation is slope. The slope between two points tells you how much Y changes as X changes.

\[
m=\frac{Y_2-Y_1}{X_2-X_1}
\]

Here \(m\) is the slope of the line. That is, on average, how many units Y changes for each unit increase in X.

If the value you're after is Y₃, the formula is written as:

\[
Y_3=Y_1+(X_3-X_1)\frac{Y_2-Y_1}{X_2-X_1}
\]

Let's read the formula in more everyday language: First find the slope between the two points. Then see how far X₃ is from X₁. Multiply that distance by the slope and add it on top of Y₁.

It becomes much clearer with an example.

\[
(2,4)
\]

\[
(8,16)
\]

First the slope:

\[
m=\frac{16-4}{8-2}=\frac{12}{6}=2
\]

So every time X increases by 1, Y increases by 2. If X₃ = 5, you are 3 units ahead of X₁ = 2.

\[
Y_3=4+(5-2)\cdot2
\]

\[
Y_3=4+6=10
\]

Result: Y₃ = 10.

If you picture it on a graph, it's even simpler: you draw a line with a ruler between (2,4) and (8,16). When you reach X = 5, the line passes through Y = 10.

What If the Missing Value Is X?

Sometimes you know the Y value but you want to find which X it corresponds to. This is the same logic applied in reverse.

Let's use the same two points:

\[
(2,4)
\]

\[
(8,16)
\]

This time Y₃ = 10 is given. What is X₃?

The slope is still 2. Y has gone from 4 to 10:

\[
10-4=6
\]

Since the slope is 2, you need to move 3 units in the X direction:

\[
\frac{6}{2}=3
\]

The starting X was 2:

\[
X_3=2+3=5
\]

Again the result is X₃ = 5.

That's exactly what the calculator does. It rearranges the formula to the appropriate side for you. You just leave blank whichever value you're looking for.

But don't leave two fields blank at the same time. Then the available information won't be enough. If no field is left blank, you haven't told the calculator what to find. One blank field, five filled fields — that's the cleanest way to use it.

Also, pay attention to zero. If your actual value is 0, you must enter it as 0. Leaving it blank means "calculate this"; entering 0 means "this value itself is zero." The two are not the same.

What If the X Value Is Outside the Range?

Here the distinction between interpolation and extrapolation begins.

Suppose X₁ = 2 and X₂ = 8. If you choose X₃ = 5, then 5 lies between those two values. This is interpolation in the truest sense.

But if you choose X₃ = 10, you have now gone outside the interval. The formula still produces a result; however, what you are doing this time is more of an outward prediction. You are moving into extrapolation territory.

Why does this matter? Because the change between two points might be linear, but nobody guarantees it will continue the same way outside. This distinction becomes important especially with measurement data, price forecasts, temperature tables, or experimental results.

In short: if you're within the range, you can be more confident. If you're outside, think twice.

An Everyday Example: Temperature Estimation

Say a measurement table has these two values:

At 10 minutes the temperature is 18 degrees.

At 30 minutes the temperature is 26 degrees.

You want to approximately find the temperature at 20 minutes. I like this example because it immediately shows what interpolation does.

We can write the points as:

\[
(10,18)
\]

\[
(30,26)
\]

The X value of the point we're looking for:

\[
X_3=20
\]

First, the slope:

\[
m=\frac{26-18}{30-10}=\frac{8}{20}=0.4
\]

This means: every 1 minute the temperature increases on average by 0.4 degrees.

From minute 10 to minute 20 there are 10 minutes:

\[
20-10=10
\]

The expected increase over this period:

\[
10\cdot0.4=4
\]

The starting temperature was 18 degrees:

\[
Y_3=18+4=22
\]

So the estimated temperature at the 20th minute is 22 degrees.

I deliberately use the word “estimated” here. The real measurement might turn out to be 22.1 or 21.9. We only assumed that the increase between the 10th and 30th minute followed a straight line.

Does the Result Make Sense?

After doing the calculation, a quick sanity check is a good idea.

If X₃ is between X₁ and X₂ and the Y values are increasing, then the found Y₃ should also lie between Y₁ and Y₂. In the temperature example, Y increased from 18 to 26. Since the 20th minute was within that interval, the result had to be between 18 and 26. It came out as 22. Makes sense.

But if the result suddenly came out as 40, you'd need to stop and look at it. The X and Y fields might have been mixed up. X₃ might have fallen outside the range. Or one of the numbers might have been entered incorrectly. This small check catches unnecessary mistakes.

Where Is It Useful?

Linear interpolation is most useful for reading values inside tables. Engineering tables, experimental results, temperature-pressure data, reading graphs, simple financial forecasts… You can run into it in all of these.

If you're a student, the topic is actually a nice example for understanding the equation of a line and the idea of slope. Rather than memorizing a formula, think of it as observing a change that walks between two points.

Of course, not all data behaves linearly. Some things follow curves. In such cases linear interpolation gives a rough approximation. But if the interval is small and the change isn't too sharp, it provides a good first estimate in most practical tasks.

A Few Small Pitfalls

X₁ and X₂ should not be the same. Because in the slope calculation the denominator becomes:

\[
X_2-X_1
\]

If this difference is 0, division is undefined. So you can't do standard linear interpolation with two points that have the same X value.

X₁ and Y₁ must belong to the same point. X₂ and Y₂ belong to the other point. If you enter the values crosswise, the calculation still gives a number, but that number will lie on the wrong line.

Decimal results are normal. In fact, with most real data the result comes out with decimals. The calculator may round the result to a certain number of digits; if you're doing very precise work, you need to take that rounding into account separately.

Anyway, the bottom line is this: Enter the two points correctly, leave the single value you're looking for blank, and check whether the result falls within the interval and looks reasonable. The practical use of linear interpolation largely comes down to that.

How we tested it

The calculator was tested with examples whose results can be easily verified manually. For example, entering X₁ = 2, Y₁ = 4, X₂ = 8, Y₂ = 16, and X₃ = 5 yields Y₃ = 10; entering Y₃ = 10 with the same points yields X₃ = 5. The tool produces the correct result in these two basic scenarios.

Frequently Asked Questions

When is linear interpolation used?
It is used when you want to estimate a missing value between two known points. For example, if a table contains the values 10 and 30, it is suitable for approximating the value corresponding to 20.
Does X₃ have to be between X₁ and X₂?
For interpolation, yes, because the main purpose is to find a value within the interval. If X₃ is outside the range, the formula still produces a result, but this is considered extrapolation and the result should be interpreted more cautiously.
Can I leave two fields blank at the same time?
No. The calculator is designed to find one missing value. Only one of the six fields should be left blank, and the other five values must be entered.

References and Sources

The calculations on this page are based on the following standard and scientific references.

  1. NIST Dataplot - Interpolation

    www.itl.nist.gov
  2. NIST Digital Library of Mathematical Functions - Interpolation

    dlmf.nist.gov
  3. Wikipedia - Linear interpolation

    en.wikipedia.org
Last update:
Information is based on standard reference values. Verification recommended for critical projects.