Math

Linear interpolation calculator

Linear interpolation estimates an unknown value between two known data points by assuming a straight line connects them. Enter two points (x₁, y₁) and (x₂, y₂) and the x you are interested in, and the linear interpolation calculator returns the interpolated y with the formula filled in, the slope, the equation of the line and how far along the interval your x sits. If x lies outside the two points, it labels the result as an extrapolation.

Runs in your browser. Nothing you type is sent to us.

Interpolated y

10

y = 4 + (5 − 2) × (12 − 4) ÷ (6 − 2)

Slope (m)
2
Equation of the line
y = 2x
Position between the points (t)
0.75 (75%)

Key facts

  • Formula: y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁).
  • Between (2, 4) and (6, 12), at x = 5: y = 4 + 3 × 8 ÷ 4 = 10.
  • The position t = (x − x₁) ÷ (x₂ − x₁) is 0.75 here: x = 5 is 75% of the way from 2 to 6.
  • Equivalently, y = (1 − t) × y₁ + t × y₂, a weighted average of the two known values.
  • Outside the interval the same formula extrapolates, which is much less reliable.

The formula

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

Read it as: start at y₁, then move along the line by the slope (y₂ − y₁)/(x₂ − x₁) times the horizontal distance x − x₁.

How to use the linear interpolation calculator

  1. Enter the first known point x₁, y₁ and the second known point x₂, y₂.
  2. Enter the x where you want an estimate.
  3. Read the interpolated (or extrapolated) y, the slope, the line equation and the position t.

Step-by-step examples: linear interpolation

Example 1: the default

Known points (2, 4) and (6, 12), x = 5. Slope = (12 − 4) ÷ (6 − 2) = 2. y = 4 + (5 − 2) × 2 = 10.

Example 2: a table lookup

A steam table lists 2,257 kJ/kg at 100 °C and 2,230 kJ/kg at 112 °C (illustrative values). At 105 °C: y = 2,257 + 5 × (2,230 − 2,257) ÷ 12 = 2,257 − 11.25 = 2,245.75 kJ/kg.

Example 3: filling a gap in data

A child was 102 cm tall at age 4 and 109 cm at age 5. At 4 years 4 months (4.333 years) a linear estimate is 102 + 0.333 × 7 ≈ 104.3 cm.

Example 4: grading on a scale

A test maps a raw score of 40 to a grade of 60 and a raw score of 80 to 100. A raw score of 55 maps to 60 + 15 × 40 ÷ 40 = 75.

Example 5: extrapolation

With the points from Example 1 and x = 8, y = 4 + 6 × 2 = 16. This lies outside [2, 6], so it assumes the straight-line trend continues, which may not be true.

The weighted-average view

With t = (x − x₁) ÷ (x₂ − x₁), the formula becomes y = (1 − t) y₁ + t y₂. At t = 0 you get y₁, at t = 1 you get y₂, and at t = 0.5 you get the average of the two. This form, often called lerp in programming, is used everywhere in computer graphics and animation to blend positions and colours smoothly.

When linear interpolation works well

  • The points are close together, so the curve between them is nearly straight.
  • The underlying relationship is actually linear, such as a constant speed or a fixed price per unit.
  • You need a quick estimate from a printed table (tax tables, statistical tables, engineering data).

When it can mislead

If the data curve strongly, as with exponential growth or a pendulum's swing, a straight line between distant points can be far off. Then use more points, a curve fit or a model of the real process. Extrapolating far beyond the data is especially risky.

Interpolation in two directions

Bilinear interpolation extends the idea to a grid: interpolate along one axis twice, then along the other between those results. It is how images are resized smoothly and how values are read from two-way tables.

Pitfalls with linear interpolation

  • Mixing up the points, such as pairing x₁ with y₂.
  • Using the formula across a jump, for example between tax brackets with different rules.
  • Treating extrapolation as reliable without checking the trend continues.

Reading between the lines of a table

Linear interpolation estimates a value between two known points by assuming a straight line between them. It is ancient: Babylonian astronomers interpolated in their tables of planetary positions, the Greek astronomer Hipparchus and later Ptolemy in the *Almagest* interpolated in tables of chords, and the Indian mathematician Brahmagupta developed a second-order method in the 7th century. Until calculators, every user of logarithm or trigonometry tables interpolated by hand.

It is still everywhere. Engineers interpolate in steam tables published by the International Association for the Properties of Water and Steam; tax authorities, such as the IRS in its withholding tables, effectively interpolate between bracket points; and statisticians use it to compute percentiles and medians from grouped data. In computer graphics and animation, "lerp" (linear interpolation) blends colours and positions between keyframes, and bilinear interpolation resizes digital images. Interpolation is only as good as the straight-line assumption; for curved data, polynomial or spline interpolation is more accurate, and going beyond the known points (extrapolation) is riskier. Joining data points with straight lines and adding the areas underneath gives the trapezoidal rule, in which each strip is a trapezoid. For the line through the two points, use the equation of a line calculator; for the slope, the slope calculator; and for averages of values, the average calculator.

Related: the equation of a line calculator, the average rate of change calculator and the midpoint calculator.

How this calculator works

  • y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁).
  • Shows the slope, the line equation and the position t = (x − x₁) ÷ (x₂ − x₁) of x between the points (0 at the first, 1 at the second).
  • Values of x outside the two points are extrapolated along the same line, which is less reliable.
  • x₁ = x₂ is rejected because the line would be vertical.

Frequently asked questions

What is linear interpolation?

A way to estimate a value between two known points by assuming a straight line between them.

What is the linear interpolation formula?

y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁).

How do you interpolate between (2, 4) and (6, 12) at x = 5?

The slope is 2, so y = 4 + 3 × 2 = 10.

What is the difference between interpolation and extrapolation?

Interpolation estimates inside the range of known points; extrapolation estimates outside it and is less reliable.

What is lerp?

Short for linear interpolation, lerp(a, b, t) = a + t(b − a), widely used in programming and graphics.

Is linear interpolation accurate?

It is accurate when the relationship is close to linear between the points, and less so when the data curve.

How do I interpolate in a table?

Take the two rows around your value, then apply the formula using those rows as the two points.

What does the position t mean?

How far along the interval x is: 0 at x₁, 1 at x₂, 0.5 halfway.

Sources

  1. Wolfram MathWorld: Linear interpolation
  2. Wikipedia: Linear interpolation
  3. Wikipedia: Interpolation

Updated November 25, 2026. Formulas checked against published sources and worked examples.

Cite this page: CalcRoster. "Linear interpolation calculator." calcroster.com/linear-interpolation-calculator/. Updated November 25, 2026.

Results are estimates for general information. They are not financial, medical or legal advice. Check important decisions with a qualified professional.