Linear Interpolation Calculator

Find a value on the line through two points
Next

Estimate a y-value on the straight line through two known points. Enter (x₁, y₁), (x₂, y₂) and the target x-value; the calculator returns y, slope, intercept and the target’s fractional position along the interval. A target between the known x-values is interpolation. A target outside them is clearly marked as extrapolation, where the straight-line assumption is usually less reliable.

How it works

  1. 1

    Enter the first point

    Provide x₁ and y₁ with matching real-world units. Negative and decimal values are supported.

  2. 2

    Enter the second point

    Provide x₂ and y₂. The two x-values must differ, or a unique slope cannot be calculated.

  3. 3

    Choose the target x-value

    Review the calculated y-value, slope, formula substitution and interpolation or extrapolation status.

How linear interpolation works

Two points with different x-values define one straight line. For a target x, this calculator uses:

y = y₁ + (x − x₁) × (y₂ − y₁) / (x₂ − x₁)

The slope is m = (y₂ − y₁) / (x₂ − x₁). The position fraction t = (x − x₁) / (x₂ − x₁) shows where the target lies relative to the first point: t = 0 is point 1, t = 1 is point 2, and 0 < t < 1 is between them. NIST describes interpolation as estimating values at unobserved regions between design points and distinguishes it from extrapolation beyond them in its Engineering Statistics Handbook. NIST also gives the straight-line model as f(x) = β₀ + β₁x in its straight-line reference.

Worked example

Suppose the known points are (10, 25.5) and (20, 40.5), and the target is x = 14.

  • Slope: (40.5 − 25.5) / (20 − 10) = 1.5
  • Position fraction: (14 − 10) / (20 − 10) = 0.4
  • Result: 25.5 + 0.4 × 15 = 31.5

Because 14 lies between 10 and 20, this is interpolation.

Position fraction Target location Tool status
Less than 0 Before point 1 along the directed line Extrapolation
0 to 1 Between the two x-values, including endpoints Interpolation
Greater than 1 Beyond point 2 along the directed line Extrapolation

When the estimate can mislead

Linear interpolation assumes the relationship is adequately straight over the interval. It does not discover curvature, discontinuities, thresholds or measurement error from only two points. Keep x-units consistent with each other and y-units consistent with each other; the x- and y-units do not need to match. Extrapolation extends the same slope beyond observed data and deserves extra caution. SciPy’s official extrapolation guidance likewise notes that out-of-domain behaviour requires deliberate handling. For safety-critical, financial, scientific or engineering decisions, confirm that a linear model is justified and use appropriate source data and uncertainty analysis.

Frequently Asked Questions

Interpolation evaluates the straight line at an x-value within the range of the two known x-values. Extrapolation extends that line outside the known range and is usually more uncertain.

The slope divides by x₂ − x₁. Equal x-values make that denominator zero and describe a vertical line, which does not assign one y-value to every target x.

Yes. Signed finite numbers and the active locale’s decimal mark are accepted. Do not include thousands separators, units or scientific notation in the fields.

The five values may pass through this site in requests to our servers or funnel URLs so the result can be calculated and restored. The tool does not send them to a third-party service, but you should not enter confidential information.

Related Tools

Tool available in other languages