LINEAR INTERPOLATION CALCULATOR

Linear interpolation calculator

Enter two points and x, get y.

How does linear interpolation work?

It assumes a straight line between two known points: y = y₁ + (x − x₁)(y₂ − y₁) ÷ (x₂ − x₁). Between (1, 10) and (3, 30), x = 2 gives y = 20.

Where is it used?

Reading values between the rows of a table — steam tables, tax tables, conversion charts — and estimating between measurements.

What is extrapolation?

Using the same line beyond the two points. It can be far off, because the real relationship may not stay straight — the calculator flags it.

How accurate is it?

Exact for straight-line data, approximate for curves. The closer the two points, the better the estimate.

Can I interpolate backwards, finding x for a y?

Yes — swap the roles: enter the y values as x and the x values as y.

Is the estimate too high or too low?

It depends on the bend of the curve. If the curve bends upward (f″ is positive) the straight line between two points lies above it between them, so linear interpolation overestimates; if the curve bends downward it underestimates. The square root bends downward: interpolating √6 between (4, 2) and (9, 3) gives 2.4, while the true value is 2.4495.

How large can the error be?

For points a distance h apart on a smooth curve, the error is at most h² ÷ 8 times the largest absolute second derivative between them (NIST DLMF, Eq. 3.3.15). Halving the spacing cuts the worst-case error to a quarter.

How the formula works

Between two known points (x₁, y₁) and (x₂, y₂), the straight line gives y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁). The fraction t = (x − x₁) ÷ (x₂ − x₁) is how far along the interval x lies, which is the percentage the calculator reports, and the formula is the same as (1 − t) × y₁ + t × y₂, a weighted average of the two y values. The two x values must differ. Outside the interval the same formula still runs, but it is then extrapolation, and the calculator says so. NIST DLMF section 3.3 shows where the error comes from: the leftover is f″(ξ) ÷ 2 × (x − x₁)(x − x₂), which is zero at both points and grows with the curvature.

Worked example: sin 35° from a table

A short table gives sin 30° = 0.5000 and sin 40° = 0.6428. For 35°, t = 0.5, so the estimate is 0.5000 + 0.5 × (0.6428 − 0.5000) = 0.5714. The true sin 35° is 0.5736, so the estimate is low by 0.0022; the sine curve bends downward here, as it should. The DLMF bound with h = 10° (0.1745 radians) and a largest |f″| of sin 40° allows an error of 0.0024, and the actual error is inside it. Interpolating between 0° and 90° instead would give 0.3889, off by 0.18.

Common mistakes

Using two points that are far apart, as in the 0° to 90° case above, throws away the accuracy a closer pair would give; always pick the two table rows that surround your x. Treating a stepped table (tax brackets, shipping bands) as a smooth line produces amounts that the table never charges. Extrapolating a long way past the points is the least reliable use. And mixing units, such as degrees in one point and radians in the other, gives a meaningless line.

Sources: NIST Digital Library of Mathematical Functions, section 3.3 “Interpolation” (Eqs. 3.3.4, 3.3.5 and 3.3.15); Wikipedia, “Linear interpolation”. Related tools: slope calculator, line equation calculator, linear regression calculator and trigonometry calculator. How we check our calculators.