Interpolation Calculator
Find a value between known data points using linear interpolation. Switch to inverse interpolation or a multi-point table, and view the formula, steps and graph.
Enter at least two points. Use a comma between x and y. Points may be entered in any order; x values must be unique.
What is interpolation?
Interpolation is a mathematical method used to estimate an unknown value between known data points. For example, if a product costs €10 at 2 units and €40 at 8 units, a straight-line estimate for 5 units is €25. This calculator uses linear interpolation: it assumes the relationship changes at a constant rate between the selected points.
Interpolation is useful when a table, measurement or chart lists values at certain intervals but not at the exact input you need. Engineers use it with reference tables, students use it in mathematics and statistics, and analysts use it to estimate intermediate values in datasets. The calculation does not create a new observation; it estimates a value from the information supplied.
Linear interpolation formula
y = y₁ + (x − x₁) × (y₂ − y₁) / (x₂ − x₁)
Here, (x₁, y₁) and (x₂, y₂) are known points, x is the target input and y is the estimated output. The term (y₂ − y₁) / (x₂ − x₁) is the slope, or the change in y for each unit increase in x. The expression (x − x₁) / (x₂ − x₁) tells you how far the target lies between the two known x values.
How to use this interpolation calculator
- Select Linear interpolation to find an unknown y from a known x, or Find x from y for the inverse calculation.
- Enter the two known points. Both coordinates can be positive, negative or decimal numbers.
- Enter the target x or y and choose how many decimal places to display.
- Click Calculate to see the estimate, step-by-step substitution and chart.
- For several measurements, select Data table, enter one x,y pair per line and let the calculator select the two surrounding points automatically.
Worked example: estimating an intermediate value
Suppose a dataset gives y = 10 at x = 2 and y = 40 at x = 8. You want to find y when x = 5. First calculate the slope: (40 − 10) / (8 − 2) = 30 / 6 = 5. Next, measure the difference from the first x value: 5 − 2 = 3. Multiply that difference by the slope and add the first y value: 10 + 3 × 5 = 25. The estimate is 25 because x = 5 lies halfway between 2 and 8, so the estimated y also lies halfway between 10 and 40.
Inverse interpolation: finding x from y
Sometimes the known value is y rather than x. For example, a calibration table may show a measured response, while you need to estimate the input that produced it. Inverse linear interpolation rearranges the formula to x = x₁ + (y − y₁) × (x₂ − x₁) / (y₂ − y₁). For the example above, when y = 25, the result is x = 5. If both known y values are identical, inverse interpolation cannot determine one unique x value; the calculator will report that limitation.
Interpolate between multiple table values
The data table mode is useful for readings such as temperature and pressure, time and distance, or height and volume. Rather than drawing one line through every data point, it performs piecewise linear interpolation. The calculator sorts the points by x, locates the two points that surround your target, and calculates along only that segment. This is usually more appropriate for tables where the rate of change varies between intervals.
For example, if your table contains (10, 25) and (20, 65), the estimate at x = 15 is 45. The slope between these two points is 4 units of y per unit of x. If another segment has a different slope, the calculator uses that other slope only when the target lies in that segment.
Interpolation vs extrapolation
Interpolation estimates a value inside the known range. Extrapolation extends a trend beyond the known range. If the data covers x values from 2 to 8, estimating at x = 5 is interpolation, while estimating at x = 12 is extrapolation. Both use the same straight-line equation, but extrapolation can be substantially less reliable because the real-world relationship may change outside the measured interval. This calculator identifies extrapolated results and lets you disable them.
When is linear interpolation appropriate?
Linear interpolation is practical when nearby data points follow an approximately straight trend and you need a simple, transparent estimate. It is not necessarily suitable for highly curved functions, sudden jumps, exponential growth or data with important discontinuities. For non-linear relationships, consider polynomial interpolation, spline interpolation or a domain-specific model. More complex methods are not automatically more accurate: the right choice depends on the underlying process and the quality of the measurements.
Accuracy, units and common mistakes
Keep x values in the same units and y values in the same units. For instance, do not mix seconds and minutes without converting them first. Check that the known x values differ; otherwise the slope would require division by zero. When using the table mode, do not repeat the same x coordinate with conflicting y values. Also avoid treating an interpolated estimate as a measured or guaranteed value. Rounding should normally happen at the end of the calculation, not after each intermediate step.
The calculator retains full JavaScript numeric precision during computation and rounds only the displayed result. Very large or very small values may have floating-point limitations. If the target matches a known point exactly, the calculator returns its known y value without estimating between adjacent observations.
Where interpolation is used
Engineering: estimate values from load, material or performance tables. Science: estimate an intermediate laboratory reading between measured observations. Finance: estimate intermediate values in a schedule, while checking whether a straight-line assumption is appropriate. Education: learn slopes, ratios and coordinate geometry. Data analysis: fill a gap between observations when a simple linear model is justified. In safety-critical applications, use the method required by the relevant standard or professional guidance.
Interpolation calculator FAQs
What is the formula for linear interpolation?
Use y = y₁ + (x − x₁)(y₂ − y₁)/(x₂ − x₁), where the two known points have different x values.
How do I interpolate between two numbers?
Find the fraction of the distance between the two x values, multiply it by the change in y, and add the first y value.
Can I use decimals or negative values?
Yes. Decimal and negative coordinates work as long as the inputs are valid numbers and the two x coordinates are different.
Can I calculate x if I already know y?
Yes. Choose Find x from y. The two known y values must differ to obtain a unique inverse linear estimate.
What is piecewise linear interpolation?
It estimates a value using the two table points immediately surrounding the target, rather than fitting one line across the entire dataset.
What happens if the target is outside the data range?
The calculation becomes extrapolation. The tool displays a warning or blocks the result, depending on your setting.
Is interpolation always accurate?
No. Accuracy depends on the measurements and whether the relationship is approximately linear between the chosen points.
Does this tool use polynomial or spline interpolation?
No. It uses linear interpolation, inverse linear interpolation and piecewise linear interpolation for data tables.
Related GCalculate tools
Continue with the Proportion Calculator for ratios and missing values, the Derivative Calculator for rates of change, or the Ratio to Fraction Calculator for ratio conversions. Verify each internal link against your published page slug.
