Interpolation Calculator
Enter two known points and a target x value to find the interpolated y value.
Enter finite decimal values within ±10¹², with distinct x₁ and x₂. The result must be representable.
y = y₁ + t(y₂−y₁), where t = (x−x₁)/(x₂−x₁). Endpoints count as interpolation; t outside [0,1] is extrapolation. Reversed point order is supported. Inputs are compared as exact decimals before division. Approximate outputs show up to 12 significant digits. Invalid input clears previous results.
How linear interpolation works
Linear interpolation estimates a value between two known data points by assuming the relationship between them is a straight line. The formula is y = y1 + (x − x1) × (y2 − y1) / (x2 − x1), finding the proportional position of your target x between x1 and x2, then applying that same proportion to find y.
This is useful whenever you have two known measurements and need to estimate a value in between, such as reading a value from a sparse lookup table, estimating a sensor reading between calibration points, or finding an intermediate value in engineering tables.
y = y₁ + t(y₂−y₁), where t = (x−x₁)/(x₂−x₁). Endpoints count as interpolation; t outside [0,1] is extrapolation. Reversed point order is supported. Inputs are compared as exact decimals before division. Approximate outputs show up to 12 significant digits. Invalid input clears previous results.
Frequently asked questions
What if my target X is outside the range of my two points?
This calculator will still compute a result — this is technically called extrapolation rather than interpolation. Extrapolated results assume the linear relationship continues beyond your known data, which is a less reliable assumption than interpolating between known points.
Does this work for curved (non-linear) relationships?
This calculator assumes a straight-line relationship between your two points. For data that's known to follow a curve, linear interpolation is still often a reasonable local approximation if your two points are close together, but a dedicated curve-fitting method would be more accurate for data with significant curvature.
What's a common real-world use for linear interpolation?
It's widely used in engineering reference tables (like steam tables or material property charts), computer graphics (blending between colors or positions), financial calculations (estimating values between known data points), and any lookup table with limited entries.
How we verified this calculator
The calculator is checked against 6 reference cases computed independently of its code. Last passed: .
| # | Inputs | Expected result |
|---|---|---|
| 1 |
Target X = 0
|
Y: 0
Position parameter t: 0
Slope Δy/Δx: 10
|
| 2 |
Target X = 10
|
Y: 100
Position parameter t: 1
Slope Δy/Δx: 10
|
| 3 |
Target X = -3
|
Y: -30
Position parameter t: -0.3
Slope Δy/Δx: 10
|
| 4 |
Target X = 20
|
Y: 200
Position parameter t: 2
Slope Δy/Δx: 10
|
| 5 |
X1 = 10
Y1 = 100
X2 = 0
Y2 = 0
|
Y: 40
Position parameter t: 0.6
Slope Δy/Δx: 10
|
| 6 |
Y1 = 7
Y2 = 7
|
Y: 7
Position parameter t: 0.4
Slope Δy/Δx: 0
|