Skip to content
OneCalculate

Linear Interpolation Calculator

The x value you want to estimate y for. It can sit between the two known points (interpolation) or outside them (extrapolation).

Interpolated y

40.00

Known points: (10, 20) and (30, 60) — estimating y at x = 20.

Quick answer

Linear interpolation estimates an unknown y value between two known points, (x1, y1) and (x2, y2), by assuming a straight line joins them. The formula is y = y1 + (x − x1) × (y2 − y1) ÷ (x2 − x1). For example, between (10, 20) and (30, 60), interpolating at x = 20 gives y = 40 — exactly halfway between both.

Explore more Maths calculators

Linear Interpolation Calculator is one of numbers, percentages and conversion tools on OneCalculate — see the full set for this category.

Browse Maths

How it works

Linear interpolation estimates a value between two known data points by assuming a straight line connects them. If you know y at two different x-values, you can estimate y at any x in between — or a little beyond — by working out how far along that straight line your target x sits.

Given two known points (x1, y1) and (x2, y2), the formula is:

y = y1 + (x − x1) × (y2 − y1) / (x2 − x1)

This works by first finding (x − x1) / (x2 − x1) — how far x has moved from x1 toward x2, expressed as a fraction — then applying that same fraction of the total change in y (y2 − y1) on top of y1. For example, with known points (10, 20) and (30, 60), interpolating at x = 20 gives:

y = 20 + (20 − 10) × (60 − 20) / (30 − 10) = 20 + (10 × 40) / 20 = 20 + 20 = 40

That comes out exactly halfway between 20 and 60, because x = 20 sits exactly halfway between 10 and 30 — the straight-line assumption behind linear interpolation.

When x sits outside the range between x1 and x2, the same formula still works — it’s then called linear extrapolation rather than interpolation, and the further outside the range you go, the less reliable the straight-line assumption tends to be. The one thing the formula genuinely can’t do is handle x1 and x2 being equal, since two points that share an x-coordinate don’t define a line at all. This calculator shows 0 with an on-screen hint in that situation rather than an error.

Worked example

Callum, an apprentice diesel mechanic in Adelaide, is checking his ute’s fuel consumption chart from the owner’s manual before a long trip. The chart only lists official figures at a couple of test speeds: 5.4 L/100km at 80 km/h, and 7.2 L/100km at 110 km/h. Callum wants a realistic estimate for cruising at 100 km/h — a common highway speed limit — which isn’t listed anywhere on the chart.

His two known points are (x1, y1) = (80, 5.4) and (x2, y2) = (110, 7.2), and he wants y at x = 100. Working through the formula step by step:

  1. x − x1 = 100 − 80 = 20
  2. y2 − y1 = 7.2 − 5.4 = 1.8
  3. Multiply the two: 20 × 1.8 = 36
  4. x2 − x1 = 110 − 80 = 30
  5. Divide: 36 ÷ 30 = 1.2
  6. Add that back onto y1: 5.4 + 1.2 = 6.6 L/100km

So Callum can plan on roughly 6.6 L/100km at 100 km/h — sitting between the two figures in the manual, and closer to the 110 km/h reading than the 80 km/h one, since 100 km/h is only 10 km/h short of 110 but a full 20 km/h above 80. Over a 420 km trip, that estimate works out to about 27.7 litres of fuel (420 ÷ 100 × 6.6 = 27.72 L) — enough for Callum to decide whether one full tank will get him there or whether he needs to plan a fuel stop.

Speed Fuel consumption
Known point 1 80 km/h 5.4 L/100km
Interpolated 100 km/h 6.6 L/100km
Known point 2 110 km/h 7.2 L/100km

Frequently asked questions

What is linear interpolation used for?

Linear interpolation estimates an unknown value that falls between two known data points, assuming a straight line connects them. It's used to fill gaps in lookup tables, read values off graphs, resize images, model prices between known dates, and anywhere else you have two known points and need a reasonable estimate for a point in between.

What's the difference between interpolation and extrapolation?

Interpolation estimates a value for an x that falls between your two known points — the more reliable case, since the straight line is anchored on both sides. Extrapolation estimates a value for x outside that range, projecting the same line further out. This calculator will still compute a result either way, but extrapolated estimates carry more risk of error.

Does this work if x2 is less than x1?

Yes. The formula only needs x1 and x2 to be different values — it doesn't matter which one is bigger. Enter your known points in whatever order they came from your table or graph; the calculator still finds the correct straight line between them and interpolates y correctly, as long as x1 and x2 aren't identical.

How accurate is linear interpolation?

It's exactly correct if the true relationship between x and y really is a straight line, and only an approximation otherwise. The closer your two known points sit to each other, and the closer the real data is to linear across that stretch, the more trustworthy the estimate — interpolating across a long, curved gap introduces more error.

What if the real relationship between x and y isn't a straight line?

Linear interpolation always assumes a straight line between your two points, even if the true relationship curves. Over a short interval with only mild curvature, the straight-line estimate is usually close enough for everyday use. For strongly curved data, or a wide gap between known points, add more data points or use a curve-fitting method instead.

Can this calculator handle more than two known points?

No — this tool interpolates between exactly one pair of known points at a time. If you're working from a longer table, find the two rows immediately either side of your target x, enter those as known point 1 and known point 2, and run the calculation for that segment. Repeat for other segments as needed.

Nirbhay Tripathi

Written and verified by Nirbhay Tripathi

Last updated 18 August 2026

All rates on this page are verified againstMath Is Fun — Interpolationon 18 August 2026. See our methodology for the full update calendar.