Skip to content

Linear Interpolation Calculator

Enter two points, a table of values, or the four corners of a grid, and get the interpolated value with the formula worked out in your numbers. It also runs the other way — find the x that gives a chosen y — and it tells you when a result is an extrapolation beyond your data, which is less reliable. Free, no sign-up.

Results

20

y at x = 2

2.5

x at y = 25

10

Slope

50%

Position between the points

The working

y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁)

y = 10 + (2 − 1)(30 − 10) / (3 − 1) = 20

x = x₁ + (y − y₁)(x₂ − x₁)/(y₂ − y₁)

x = 1 + (25 − 10)(3 − 1) / (30 − 10) = 2.5

Graph

  • Line through the points
The line through two points with the interpolated point marked11.522.531015202530xy(1, 10)(3, 30)(2, 20)(2.5, 25)

How to Use the Linear Interpolation Calculator

  1. 1. Choose what you have. Two known points, a table of many points, or the four corner values of a grid for bilinear interpolation.
  2. 2. Enter the known values. For a table, type one “x, y” pair per line; they may be in any order. Decimal commas work when you separate the numbers with semicolons.
  3. 3. Enter the x you want. Optionally also enter a y to run it backwards and find the x that gives that value.
  4. 4. Read the result and the working. The formula is written out with your numbers, and the graph marks the interpolated point on the line.

The Formula

Linear interpolation assumes the values lie on a straight line between two known points (x₁, y₁) and (x₂, y₂). Then y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁). The fraction t = (x − x₁)/(x₂ − x₁) says how far along you are: t = 0 is the first point, t = 1 the second, t = 0.5 halfway. Solving the same line for x gives x = x₁ + (y − y₁)(x₂ − x₁)/(y₂ − y₁).

Worked Examples

ProblemWorkingResult
Points (1, 10) and (3, 30); y at x = 210 + (2 − 1)(30 − 10)/(3 − 1)20
Same points; x where y = 251 + (25 − 10)(3 − 1)/(30 − 10)2.5
Same points; y at x = 5 (extrapolation)10 + (5 − 1)(30 − 10)/(3 − 1)50
Table (0, 1), (20, 0.8), (40, 0.6), (60, 0.4); y at x = 30segment (20, 0.8)–(40, 0.6): 0.8 + (30 − 20)(0.6 − 0.8)/(40 − 20)0.7

Bilinear interpolation. Given the values at the four corners of a rectangle — f(0, 0) = 1, f(10, 0) = 3, f(0, 20) = 5, f(10, 20) = 11 — the value at (5, 10) comes from two steps along x: R₁ = 1 + 0.5 × (3 − 1) = 2 on the bottom edge and R₂ = 5 + 0.5 × (11 − 5) = 8 on the top, then one step along y: 2 + 0.5 × (8 − 2) = 5. The result is the same if you go along y first.

Interpolation Versus Extrapolation

Interpolation estimates a value between known points, and the error is bounded by how much the true curve bends between them: for a function with second derivative at most M, the error is at most M·(x₂ − x₁)²/8. Extrapolation extends the line beyond the data, with no known point on the far side to hold it in place, so errors grow quickly. The calculator flags any result outside your data. Linear interpolation also assumes a straight line is a fair stand-in: for strongly curved data (compound growth, logarithms) use closer points, or a curve-fit tool with a proper model.

Frequently Asked Questions

What is linear interpolation?
It is estimating a value between two known data points by assuming they are joined by a straight line. It is the standard way to read a value off a table, such as a steam table or tax table, when your exact input is not listed.
How do you interpolate between two values in a table?
Find the two rows whose x-values bracket yours, then apply y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁). The table mode does this automatically, shows which two rows it used, and works out the arithmetic.
What is the difference between interpolation and extrapolation?
Interpolation estimates inside the range of your data; extrapolation estimates outside it. The formula is identical, but extrapolation is much less reliable because the trend may not continue. The calculator notes when a result is an extrapolation.
How do I find x for a given y?
Solve the same line for x: x = x₁ + (y − y₁)(x₂ − x₁)/(y₂ − y₁). Enter the y you want in the optional field. In table mode, every x where the piecewise-linear data reaches that y is listed, since a non-monotonic table can reach it more than once.
What is bilinear interpolation?
It is linear interpolation in two directions, used for values on a grid, such as a two-way table or the pixels of an image. You interpolate along x on two opposite edges, then along y between the two results. It is exact for functions of the form a + bx + cy + dxy.
How accurate is linear interpolation?
It is exact for data that really is linear. For a curve, the error between two points is at most M·h²/8, where h is the gap between the points and M the largest curvature (second derivative) there, so halving the gap cuts the error to a quarter.

Related Tools

More in Math Calculators

See all Math Calculators