How to Use the Interpolation Calculator
This interpolation calculator finds an unknown y value from two known points. Enter the coordinates (x₁, y₁) and (x₂, y₂), then enter the target x value whose y value you want to find. The calculator applies the linear interpolation formula and returns the estimated y value, the slope and y-intercept of the line, and the full line equation in y = mx + b form. It also tells you whether the result is an interpolation (x is between the two known points) or an extrapolation (x is outside the range).
If you need to find the midpoint between two points rather than an intermediate value at a specific x, see our Pythagorean theorem calculator for distance-based calculations.
The Linear Interpolation Formula
The formula for linear interpolation between two points (x₁, y₁) and (x₂, y₂) at a target x is:
y = y₁ + (x − x₁) × (y₂ − y₁) / (x₂ − x₁)
This is simply the point-slope form of the line passing through the two known points, evaluated at x. The fraction (y₂ − y₁) / (x₂ − x₁) is the slope of the line — the rate of change of y per unit change in x. Multiplying slope by (x − x₁) gives the rise from y₁ to the target point.
Step-by-step example
Given points (2, 10) and (6, 30), find y at x = 4:
- Slope m = (30 − 10) / (6 − 2) = 20 / 4 = 5
- y = 10 + (4 − 2) × 5 = 10 + 10 = 20
- Line equation: y = 5x + 0, so y = 5(4) = 20. Confirmed.
Interpolation vs. Extrapolation
Interpolation estimates a value within the range of your two known data points. Because the estimate stays between observed values, it is generally reliable — the linear model only needs to hold over a short interval.
Extrapolation estimates a value outside the known range. This is inherently riskier: a relationship that looks linear between two points may curve significantly beyond them. Extrapolation is common in trend analysis and forecasting but should always be treated with caution, especially far beyond the known data.
The calculator flags extrapolation results with a warning so you know when the estimate is based on an assumption beyond the observed data range.
Real-World Applications of Linear Interpolation
Linear interpolation appears everywhere in science, engineering, and daily life:
- Engineering lookup tables — fluid viscosity, material strength, and heat transfer data are often tabulated. Interpolation finds the value between two table entries.
- Temperature and weather — estimating temperature at an altitude between two measured levels using a standard lapse rate of about 3.5°F per 1,000 ft.
- Finance and economics — estimating yield curves, interpolating option pricing between strike prices, or filling gaps in historical price data.
- Computer graphics — smooth color gradients, animation tweening, and texture mapping all rely on linear (and higher-order) interpolation.
- Medical dosing — when a reference chart lists doses for 60 kg and 80 kg patients, a 70 kg patient's dose is interpolated between the two known values.
Limitations of Linear Interpolation
Linear interpolation assumes the relationship between x and y is a straight line over the interval. This assumption holds well when the two points are close together or when the underlying relationship is genuinely linear. However, for curved relationships — exponential growth, sinusoidal oscillation, power laws — linear interpolation can introduce significant error.
When higher accuracy is needed, use polynomial interpolation (Lagrange or Newton) or spline interpolation, which use three or more points to fit a curve. For most practical engineering and everyday calculations, though, linear interpolation with closely spaced reference points is accurate to within 1–2%.
For statistical analysis of datasets with many data points, see our mean, median, and mode calculator or our standard deviation calculator.
The Line Equation: y = mx + b
The interpolation formula naturally produces the equation of the line through the two points. Once you have the slope m = (y₂ − y₁) / (x₂ − x₁), the y-intercept b is found by substituting either known point: b = y₁ − m × x₁. The full line equation y = mx + b then lets you evaluate any x value instantly — not just the one you entered.
A special case: when x₁ = x₂, the two points lie on a vertical line (undefined slope). Linear interpolation is impossible in this case because any x other than x₁ lies off the line entirely. The calculator detects this condition and displays an error message.
Sources & References
- Linear Interpolation — Math Is Fun — Math Is Fun
- Interpolation — Britannica — Britannica
- Linear Interpolation Formula — Khan Academy — Khan Academy