To interpolate, use y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁): find how far x sits between x₁ and x₂ as a fraction, then move the same fraction of the way from y₁ to y₂. Between (10, 50) and (20, 80), x = 14 is 40% of the way across, so y = 50 + 0.4 × 30 = 62. This linear interpolation calculator does it for two points, for a whole pasted table, and in 2D (bilinear), and it flags when you are extrapolating outside your data.
Linear interpolation is how you read between the lines of a printed table — steam tables, tax tables, statistical tables, calibration charts — or fill a gap in a series of measurements. It assumes the values change at a constant rate between the two known points.
How to use the calculator
- Two points: enter (x₁, y₁), (x₂, y₂) and the x you want. You get y, the slope, the fraction t and the equation of the line, plus a chart.
- Table: paste x, y pairs, one per line (commas, spaces or tabs — copy two columns from a spreadsheet). Enter x; the calculator finds the bracketing rows and interpolates between them. Outside the table it extends the end segment and labels the answer as extrapolated.
- Bilinear: enter the four corners of a grid cell and a point (x, y) inside it.
- Copy the link to share or save the exact inputs.
The linear interpolation formula
For two known points (x₁, y₁) and (x₂, y₂):
y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁)
An equivalent, often cleaner, form uses the fraction t = (x − x₁) ÷ (x₂ − x₁):
y = (1 − t) × y₁ + t × y₂
This is equation 3.3.14 in the NIST Digital Library of Mathematical Functions, §3.3(ii). The weights (1 − t) and t add to 1, so the answer is a weighted average of y₁ and y₂; the nearer point gets more weight. When 0 ≤ t ≤ 1 you are interpolating; t below 0 or above 1 means extrapolation.
How to interpolate, step by step
- Pick the two known points on either side of your x.
- Subtract: Δx = x₂ − x₁ and Δy = y₂ − y₁.
- Find the fraction t = (x − x₁) ÷ Δx.
- Multiply: t × Δy.
- Add to the starting value: y = y₁ + t × Δy.
A quick check: the answer must sit between y₁ and y₂ whenever x sits between x₁ and x₂. The table shows how t maps to y for the points (0, 20) and (10, 60); at t = 0.5 the result is simply the average of the two y values.
| Position between the points | t | y for (0, 20) → (10, 60) |
|---|---|---|
| 10% of the way | 0.1 | 24 |
| 25% of the way | 0.25 | 30 |
| 50% of the way | 0.5 | 40 |
| 75% of the way | 0.75 | 50 |
| 90% of the way | 0.9 | 56 |
Worked examples
1. Between two points
(10, 50) and (20, 80), find y at x = 14. Slope = 30 ÷ 10 = 3. y = 50 + (14 − 10) × 3 = 62.
2. Interpolating from a table
Table (x, y): (0, 1.2), (5, 3.4), (10, 4.1), (20, 6), (40, 7.9). For x = 12 the bracketing rows are (10, 4.1) and (20, 6): y = 4.1 + (12 − 10) × (6 − 4.1) ÷ (20 − 10) = 4.48. Paste the same rows into Table mode to check.
3. Extrapolation
A value was 150 in 2020 and 170 in 2024. Extending the line to 2030 gives 150 + 10 × 5 = 200. For the same table as example 2, x = 50 extrapolates from the last segment to 8.85. Treat both as trend guesses, not measurements.
4. How big is the error on a curve?
Interpolating y = x² between (2, 4) and (3, 9) at x = 2.5 gives 6.5; the true value is 6.25, so the error is 0.25. The NIST DLMF bound for linear interpolation is h² ÷ 8 × max|f″| = 1 ÷ 8 × 2 = 0.25, and the midpoint of a parabola hits it exactly. Tighter spacing in the table shrinks the error with the square of the gap.
5. Bilinear interpolation on a grid
A 0–10 × 0–10 cell has corners f(0,0) = 20, f(10,0) = 30, f(0,10) = 40, f(10,10) = 60. At (4, 7): along x at y = 0, 20 + 0.4 × 10 = 24; along x at y = 10, 40 + 0.4 × 20 = 48; then along y, 24 + 0.7 × (48 − 24) = 40.8. Doing y first gives the same answer.
Interpolation vs extrapolation vs curve fitting
| Method | Where x is | Passes through the data? | Use it for |
|---|---|---|---|
| Linear interpolation | Between known points | Yes | Reading tables, filling gaps |
| Linear extrapolation | Beyond the data | Yes | Short-range trend estimates only |
| Regression (line of best fit) | Anywhere | Not necessarily | Noisy data, prediction with uncertainty |
NIST’s Dataplot manual draws the same line: an interpolated function goes through every original point, while a fitted function may not. For smooth curved data, the same manual calls cubic spline interpolation “normally the preferred type”; straight segments are simpler and never overshoot between points.
Common mistakes
- Mixing up which y goes with which x. Keep each pair together; swapping only y₁ and y₂ flips the slope.
- Using rows that don’t bracket x. Pick the rows immediately above and below. Using distant rows adds error on curved data.
- Interpolating on a log scale linearly. Values that grow exponentially (pressure vs temperature, compound growth) often interpolate better on log(y).
- Trusting a long extrapolation. The further past the data, the less the straight-line assumption holds.
To summarise a whole data set with the box plot maker and five-number summary calculator, find the right degrees of freedom for a t, chi-square or F table, or turn scores into percentages with the grade calculator. Preparing for the exam? Try the AP Statistics score calculator.
Frequently asked questions
What is the linear interpolation formula?
y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁). It is the equation of the straight line through (x₁, y₁) and (x₂, y₂), evaluated at x. NIST’s Digital Library of Mathematical Functions writes the same thing as f = (1 − t)·f₀ + t·f₁, where t = (x − x₁) ÷ (x₂ − x₁).
How do you interpolate between two numbers?
Work out how far x is between x₁ and x₂ as a fraction t, then move the same fraction from y₁ to y₂. For (10, 50) and (20, 80) at x = 14: t = 4 ÷ 10 = 0.4, and y = 50 + 0.4 × 30 = 62.
How do you interpolate a value from a table?
Find the two rows whose x values bracket your x, then apply the two-point formula to just those rows. Paste the whole table into Table mode and the calculator picks the right pair — for x = 12 in the example below it uses the rows at 10 and 20 and returns 4.48.
What is the difference between interpolation and extrapolation?
Interpolation estimates a value inside the range of your known x values; extrapolation extends the line beyond them. Both use the same formula, but extrapolation assumes the trend keeps going, which is much riskier. NIST’s Dataplot LINEAR INTERPOLATION command refuses points outside the data range for this reason; this calculator allows it and labels the result as extrapolated.
How accurate is linear interpolation?
It is exact when the data really lie on a straight line and approximate otherwise. For a smooth function, NIST DLMF bounds the error by h² ÷ 8 × the largest |f″| on the interval, where h is the gap between the two x values. Halving the gap cuts the worst-case error to a quarter. Example: interpolating x² between 2 and 3 gives 6.5 at 2.5 instead of 6.25, an error of 0.25 — exactly the bound 1² ÷ 8 × 2 = 0.25.
What is bilinear interpolation?
Linear interpolation in two directions on a rectangular grid: first along x on the two grid rows, then along y between those two results. NIST describes it as a weighted average of the 4 surrounding grid points. With corners 20, 30, 40, 60 on a 0–10 grid, the value at (4, 7) is 40.8.
Does the order of the two points matter?
No. Swapping (x₁, y₁) and (x₂, y₂) gives the same line and the same answer. In Table mode the rows can be in any order; the calculator sorts them by x.
Can I interpolate x from a known y?
Yes — swap the roles: enter the y values in the x boxes and the x values in the y boxes. This inverse interpolation works when the data are increasing or decreasing across the interval.
What if the two x values are the same?
The formula divides by x₂ − x₁, so it is undefined when they are equal (a vertical line). Use two points with different x values.
Sources & method
- NIST Digital Library of Mathematical Functions §3.3(ii) — Linear interpolation, eq. 3.3.14 and error constant 3.3.15
- NIST Dataplot Reference Manual — LINEAR INTERPOLATION (points connected with straight lines)
- NIST Dataplot Reference Manual — BILINEAR INTERPOLATION (weighted average of the 4 surrounding grid points)
Results are estimates for general information. Found an error? It helps everyone — see our methodology.