Linear Interpolation Calculator

Interpolate a value between two known points, with the slope, the interpolation fraction and a warning when you extrapolate.

Interpolated y 3.14
y = y₁ + (x − x₁) · (y₂ − y₁) / (x₂ − x₁)
Interpolating or extrapolating? Interpolating — your x sits between the two known points, which is where a straight line is most trustworthy.
y = y₁ + (x − x₁) · (y₂ − y₁) / (x₂ − x₁)
Slope between the points 0.16
y = y₁ + (x − x₁) · (y₂ − y₁) / (x₂ − x₁)
How far along, as a fraction 0.4
y-intercept of the line 0.9
Equation of the line y = 0.16x + 0.9
x needed for y = 3 13.125

Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.

What the Linear Interpolation Calculator does

This linear interpolation calculator will interpolate a value between two known points, with the slope, the interpolation fraction and a warning when you extrapolate. Fill in all 5 fields and the result updates as you type — there is no Calculate button to press and no page reload. It is most often used for reading a value between two rows of a printed engineering table. A related tool on this site is the percentage calculator.

How to use it

  1. Enter the x and y of the known point below your target.
  2. Enter the x and y of the known point above it.
  3. Enter the x value you want a y for.
  4. Read the interpolated y, and check the status row to confirm you are interpolating rather than extrapolating.

How it works

Linear interpolation assumes the quantity changes at a constant rate between two known readings, and reads off the value in between. It is the arithmetic behind every printed table that says "interpolate between rows": steam tables, mortality tables, calibration charts, tide tables. The formula takes the first value and adds the fraction of the way along multiplied by the total change.

The fraction row makes the mechanism visible. At x = 14 between points at 10 and 20 you are 0.4 of the way along, so the answer is y₁ plus 0.4 of the rise. When that fraction is between 0 and 1 you are interpolating; outside that range you are extrapolating, which is a materially different and much riskier operation. This page says which one you are doing and how far beyond the data you have gone.

The assumption of linearity is the thing to watch. Over a short span most smooth curves are close enough to straight for interpolation to be accurate, which is why the technique works so well in practice. Over a long span, or near a sharp bend in the underlying relationship, it can be badly wrong — interpolating saturation pressure across a wide temperature gap understates it noticeably, because the real curve is exponential. The narrower your bracketing points, the better the answer.

When to use it

  • Reading a value between two rows of a printed engineering table.
  • Filling a gap in a time series between two measurements.
  • Converting a reading using a two-point calibration.
  • Finding an intermediate value for a lerp in animation or graphics code.

Common mistakes to avoid

  • Extrapolating well beyond the known points and treating the result as reliable. Straight lines stop describing curved relationships quickly.
  • Entering the points in the wrong order and then misreading the fraction. The maths copes with either order, but a negative fraction means your target is below both points.
  • Interpolating linearly across a wide span of an exponential relationship, such as pressure against temperature.

Frequently asked questions

What is the difference between interpolation and extrapolation?

Interpolation estimates a value between known data points; extrapolation estimates one beyond them. Interpolation is constrained on both sides by real data, which is why it is far more reliable.

How accurate is linear interpolation?

It depends entirely on how curved the underlying relationship is over your interval. For a smooth function and a narrow gap it is very accurate; across a wide gap on a curve it can be out by several percent or worse.

What is a lerp?

The same operation written as a blend: lerp(a, b, t) = a + t(b − a), where t runs from 0 to 1. Graphics and animation code uses that form constantly to move smoothly between two values.

Related tools

See all math & statistics calculators →