Interpolation Calculator
With first x 10, y at that x 25, second x 20, y at that x 45 and 1 more field, interpolation comes to 33.000000 — interpolated y. It is reached in 6 steps, the last of which is 25 + 0.4 * 20, and each one is printed on the page with its numbers filled in. The formula is the one published by NIST Digital Library of Mathematical Functions, not an approximation fitted to it.
The value between two known points on a straight line, with the slope it assumes and a warning when the target sits outside them.
Formula and sources checked · How we check
First x 10, y at that x 25, Second x 20, y at that x 45
33.000000
Interpolated y for the example below. Editing a field recomputes the calculator below; this figure holds the answer the page was loaded with.
It is written into the HTML rather than drawn by a script, so a search engine reading this page without running JavaScript still finds an answer.
- Distance between the known x values
20 - 1010- Distance between the known y values
45 - 2520- Slope of the line through them
20 / 102- How far along x sits
(14 - 10) / 100.4- Interpolated y
25 + 0.4 * 2033- How far past the endpoints, as a share of the gap
(0)0
Worked example
Between (10, 25) and (20, 45) the slope is 2 per unit. x = 14 is four tenths of the way across, so y is 25 + 0.4 × 20 = 33. The "how far along" figure is the one to watch: below 0 or above 1 and this is extrapolation, which the arithmetic performs happily and the data does not support.
How to work it out yourself
- 1.Take the two points that bracket the value you want.
- 2.Slope is the rise over the run between them.
- 3.Work out how far along the gap your x sits, as a fraction from 0 to 1.
- 4.Add that fraction of the rise to the first y. Outside 0 to 1 the same sum is extrapolation, and stops being supported by the two points.
The formula
- Distance between the known x values
20 - 10 - Distance between the known y values
45 - 25 - Slope of the line through them
20 / 10 - How far along x sits
(14 - 10) / 10 - Interpolated y
25 + 0.4 * 20 - How far past the endpoints, as a share of the gap
(0)
Source: NIST Digital Library of Mathematical Functions — interpolation, NIST/SEMATECH e-Handbook of Statistical Methods
Questions people actually ask
- What is linear interpolation?
- Reading a value between two known points by assuming a straight line joins them. y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁). It is what you do by eye on a printed table, written down.
- When is interpolating between table rows safe?
- When the underlying relationship is close to straight over that interval, and the rows are close enough together that the curvature between them is small. A steam table or a t table interpolates well; a compound-interest table interpolates badly, because the curve bends most where the rows are widest.
- What is the difference between interpolation and extrapolation?
- Whether the target sits between the two known points or outside them. Between, you are constrained by data on both sides. Outside, the only thing holding the answer up is the assumption that the line continues — and nothing in the two points supports that. The figure above tells you which one you just did.
- How wrong can linear interpolation be?
- For a smooth curve the error is roughly one eighth of the second derivative times the square of the gap. In practice: halving the spacing between rows quarters the error. That is why a table with a fine step interpolates far better than a coarse one, not merely a bit better.
Related
- Slope CalculatorSlope, intercept, angle and the full line equation from two points, with the perpendicular slope beside it.
- Midpoint CalculatorThe midpoint of two points, with the distance, the slope and the perpendicular bisector — what a coordinate-geometry question asks about the same pair.
- Percentage CalculatorWhat X% of a number is, plus the discounted price, the marked-up price and the remainder.
- Z-Score to P-Value CalculatorExact p-value from a z-score, one-tailed or two-tailed, with the percentile the score sits at.
- Grade CalculatorYour weighted course grade from up to eight categories, by percentage or by points, or the score you need on the final to reach the grade you want.
- Confidence Interval CalculatorThe confidence interval around a sample mean, with the margin of error and what the interval does and does not claim.
Put this calculator on your site
Free, no attribution required beyond the link.
<iframe src="https://rulecalculators.com/embed/linear-interpolation" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Interpolation Calculator"></iframe>