Interpolation Calculator – The Value Between Your Two Known Values, Worked Out

You have the reading at x = 2 and the reading at x = 5 — but the value you actually need sits at x = 4, unmeasured, in between. Interpolation finds it the honest way: it draws the straight line between your two known points and reads off the height where your x crosses it, showing the slope, the fraction of the way, a half-step table and a plot so the answer can be checked, not just believed. And if your x wanders outside the two points, the calculator says so, in plain sight — that is extrapolation, and it does not get to borrow the same confidence.

100% FreeNo sign-up neededInstant results

The two points, and the x you need

● First known point
● Second known point
● The x you need the value for
The two points can go in either order — the line is the same. What they cannot share is an x: two points with the same x make a vertical line, and a vertical line has no single value to read off between them.

🔒 Everything is calculated in your browser — your numbers never leave your device.

The value on the line

y at x = 4
9
Interpolation — inside the two points
x = 4 lies between 2 and 5, so the answer is anchored by a real measurement at both ends.

How the line gets there

Slope of the line (rise over run)3
Rise between the points (y₂ − y₁)9
Run between the points (x₂ − x₁)3
Fraction of the way from point 1 to point 20.6667 · 66.7%
y at the target x9

What this means

x = 4 sits between the two known points, 66.7% of the way from (2, 3) toward (5, 12). Climbing that same fraction of the rise — 9 up over a run of 3 — lands at y = 9. Because the target stays inside the measured range, the answer leans only on the straight line between two real points, and on nothing beyond them.

Why the label matters. Inside the points, the line is held at both ends by measurements. Outside them, the same line is extended on faith alone — the arithmetic does not change, but the trust should. This calculator names which one you are doing, every time.

Copied ✓
Key Takeaways
  • Interpolation draws the straight line between your two known points and reads off the height where your x crosses it — on the default, x = 4 gives 9.
  • If your x wanders outside the two points, the calculator says so in plain sight: that is extrapolation, and it does not get to borrow the same confidence.
  • The two points can go in either order — the line is the same — but they cannot share an x: a vertical line has no single value to read off.

The line, drawn — and every half-step along it

The plot puts your two known points and the target on the same straight line the calculator uses; the dashed guides drop from the target point to both axes so you can read the answer off the picture. Underneath, the table walks the line in half-steps, so any value between the points can be read without another calculation.

xy on the line
23
2.54.5
36
3.57.5
4 · your target9
4.510.5
512

The table walks from the lower x to the higher one in steps of 0.5, and covers only the stretch between the two known points — the region where interpolation, not extrapolation, is doing the work. Your target row is shaded whenever it falls on the walk.

How it works, in 3 steps

1

Enter the two points you trust

Two measurements of the same thing at two different x values: a temperature at two times, a price at two sizes, a reading at two depths. Either order works — the calculator draws the same line through them both — but the x values must differ, because a line through two points at the same x stands straight up and goes nowhere.

2

Enter the x you actually need

The target is the x nobody measured. Watch the label when you type it: between the two known x values, the result is interpolation; outside them, the calculator switches the label to extrapolation and shades it differently, because the same arithmetic deserves less trust out past the data.

3

Read y — then check the fraction

The fraction of the way is the whole trick in one number: the target sits that fraction along the run, so the answer climbs that fraction of the rise. If the fraction puzzles you, the half-step table underneath walks the line slowly enough to follow with a finger.

How each figure is worked out

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

The default, worked through. Points (2, 3) and (5, 12), target x = 4. The run is 5 − 2 = 3 and the rise is 12 − 3 = 9, so the slope is 9 ÷ 3 = 3: every step of 1 in x climbs 3 in y. The target sits 4 − 2 = 2 along the run, which is 2 ÷ 3 = 0.6667, or 66.7% of the way. Climb that fraction of the rise — 0.6667 × 9 = 6 — and add it to the starting height: 3 + 6 = y = 9. One step along from either end agrees: at x = 3 the line is at 6, at x = 4 it is at 9, at x = 5 it reaches the second point, 12, exactly as it must.

The fraction is the engine. Everything on this page hangs off (x − x₁) ÷ (x₂ − x₁). At the first point the fraction is 0 and the formula hands back y₁ untouched; at the second point it is 1 and the formula hands back y₂. In between, it is the share of the journey completed — and past the second point it runs above 1, which is the arithmetic’s quiet way of saying you have left the measured ground. Extrapolation is not a different formula; it is this same fraction, out of its safe range.

Order does not matter, and the calculator proves it. Swap the two points — enter (5, 12) first and (2, 3) second — and the slope flips sign twice, once in the rise and once in the run, landing back at 3. The fraction is then measured from the other end (4 is 33.3% of the way from 5 toward 2), and the answer is still 9. Any interpolation tool that changes its answer when you swap the points has a bug; this one cannot, because the geometry cannot.

Deep dives

Interpolation built the modern world’s tables. For a century, engineers read steam tables, navigators read tide tables and tax clerks read printed schedules — none of which could print every possible value. The tables printed the values at regular steps and expected you to interpolate the rest, and the whole system worked because the underlying quantities changed smoothly and the steps were small. The straight-line shortcut was not laziness; it was the best affordable accuracy of its era, and in short enough stretches it is still nearly exact.

The error hides in the bend. A straight line can only be wrong between two points by as much as the real curve bends away from it. That error grows with the curvature of the real quantity and with the square of the gap between points: double the gap and the possible error roughly quadruples, which is why interpolating across a small gap in dense data is safe while spanning a wide gap is a gamble. Cooling coffee, growing populations and charging batteries all bend; heights on a ramp do not. The calculator cannot know which kind of quantity you fed it — that judgement is the one part of the job that stays yours.

A habit worth copying from the table-makers: when the answer matters, interpolate from the closest pair of points you have, not the most convenient pair. The nearest neighbours keep the gap — and with it, the bend and the error — as small as your data allows.

Every forecast is an extrapolation wearing a suit. Extend any trend past the last measurement — next quarter’s sales, next year’s traffic, a child’s adult height from this year’s growth — and you are running this page’s formula with the fraction past 1. Sometimes it works beautifully, because the trend really is a straight line for physical reasons. Often it fails for the most boring reason imaginable: the world changed its mind just after your last data point, and no line drawn through old points can see a turn it never met.

Distance is the tax. An extrapolated answer does not just carry uncertainty — the uncertainty grows with every step beyond the data, because a tiny error in the slope is multiplied by the whole distance travelled. A slope that is wrong by a hair costs almost nothing one step out and a fortune fifty steps out. That is why this calculator changes the label and the colour the moment your target steps outside the two points: the number may still be the best guess available, but it should never be allowed to look as settled as an interpolated one.

The working rules professionals use: extrapolate as short a distance as you can; treat the result as a range, not a point — rerun it with slightly different pairs of points and see how much the answer wobbles; and wherever the quantity is known to level off, saturate or turn (capacities, populations, markets), distrust any straight line that sails through the limit without slowing down.

Three targets on one line: inside, at the edge, and beyond

The default line on this page runs through (2, 3) and (5, 12): a rise of 9 over a run of 3, a slope of 3, and the equation y = 3x − 3. Every target below was run through this page’s own calculator, and the fraction column is the heart of the method: (target x − x₁) ÷ (x₂ − x₁) tells you how far along the line you are, and the answer is y₁ plus that fraction of the rise.

Target xFraction of the wayy on the lineInside or outside?
2.50.1667 · 16.7%4.5Inside — interpolation
30.3333 · 33.3%6Inside — interpolation
4 (default)0.6667 · 66.7%9Inside — interpolation
4.50.8333 · 83.3%10.5Inside — interpolation
51.0000 · 100%12Exactly on point 2
61.3333 · 133.3%15Outside — extrapolation

Read the table as a ruler. At x = 2.5 you are one sixth of the way from (2, 3) toward (5, 12), so you climb one sixth of the rise of 9 — that is 1.5 — and land at 4.5. At x = 4 you are two thirds of the way, so you climb 6 and land at 9. At x = 5 the fraction is exactly 1 and the answer is point 2 itself, 12 — a useful check that the method reproduces its own inputs. The half-step table between the points is equally regular, because the slope is constant: every half step of x adds 1.5 to y (3, 4.5, 6, 7.5, 9, 10.5, 12 for x = 2, 2.5, 3, 3.5, 4, 4.5, 5). If a set of interpolated values does not step evenly when the x values step evenly, something is wrong with the inputs, not with the method — the most common culprit is the two points sharing an x value, which the calculator refuses, because the run would be zero and the slope undefined.

A second line, through (0, 0) and (10, 100), shows the same method at a different scale and is worth running yourself: slope 10, and at x = 3 the fraction is 0.3, so y is 30. Nothing about the method changed — only the numbers did. That scale-independence is the point of stating the method as a fraction rather than as a recipe for one pair of points: the fraction is always between 0 and 1 for interpolation, exactly 0 or 1 at the points themselves, and outside that range for extrapolation. The calculator labels each case for you, and the label matters more than the number, because the number is computed the same way in all three cases while the trust you should place in it is not.

Extrapolation: the same arithmetic, a weaker claim

At x = 6 the calculator gives y = 15, by the same arithmetic as every other row: the fraction is 1.3333, so you climb 1.3333 times the rise of 9, which is 12, from y₁ = 3 to 15. The arithmetic is exact and the claim is weak, and both halves of that sentence matter. The line has been extended past the data at the same slope, but nothing in the two points guarantees the real quantity keeps that slope beyond them. The page’s own FAQ gives the reasons: populations grow by multiplying rather than adding, cooling bodies slow down as they approach room temperature, and drug doses level off — none of them move in straight lines except across short stretches. A straight line fitted to two points of a curving quantity will be wrong beyond the points by an amount that grows with the distance beyond them and with the curvature between them, and the calculator cannot warn you how large that amount is, because curvature is exactly what two points cannot measure.

The practical rule follows from that limitation. Interpolate freely when the gap between the points is small and the quantity is steady — the printed tables this method was built for, steam tables and tax tables and conversion tables, worked that way for a century precisely because their gaps were small and their quantities were smooth. Extrapolate only a short way, and label the result an estimate rather than a measurement: x = 6 on a line measured from 2 to 5 is one step beyond the data, and 15 is a reasonable estimate if the quantity is steady; x = 20 on the same line would be 57 by the same arithmetic, and calling it anything but a guess would be dishonest, because it asserts fifteen units of unmeasured behaviour. The distance beyond the data is itself information about the answer’s quality, and the fraction column tells you that distance at a glance: 1.3333 is a little beyond, 6.0000 would be far beyond, and the further the fraction strays from the 0-to-1 range, the less the number deserves to be quoted without its warning.

There is one more direction worth knowing, because it is the same line read backwards. Given a y on the line, the x that produces it is x₁ plus the fraction (y − y₁) ÷ (y₂ − y₁) of the run: for y = 6, that fraction is (6 − 3) ÷ 9 = 0.3333, giving x = 3, which the calculator confirms by returning y = 6 at x = 3; for y = 9 it gives x = 4, the default target. Reading a line backwards is not a feature of this calculator — it takes x and gives y — but it is the same arithmetic with the roles exchanged, and it is how interpolated tables were historically used in both directions: find a value in the table, read off the argument that produced it. If you need the reverse direction often, run the calculator forward at candidate x values until the y matches, or solve the fraction by hand as shown; either way, the line itself is the only authority, and it only speaks confidently between its two points.

Order does not matter, endpoints do: two checks on the method

Enter the default points in reverse order — (5, 12) first, (2, 3) second — and ask for x = 4, and the calculator still gives y = 9. The slope is still 3, but the rise and the run are both negative now (−9 over −3), the fraction is 0.3333 from point 1 toward point 2, and the climb from 12 is 0.3333 × (−9) = −3, landing at 9. The line is the same line whichever point you call first, because a line through two points does not have a direction; only the description of the journey along it changes. That is a useful check when a table lists its entries high-to-low rather than low-to-high: reverse the order in your head, or in the calculator, and the interpolated value must not change. If it does, one of the two entries was mistyped, not the method.

The second check is the midpoint, which is interpolation at exactly 50%. The midpoint of (2, 3) and (5, 12) is ((2 + 5) ÷ 2, (3 + 12) ÷ 2) = (3.5, 7.5), and the calculator confirms it: at x = 3.5 it gives y = 7.5. Every interpolated point can be checked the same way against its neighbours: the value at the midpoint of any two known points must be the average of their y values, because the fraction is 0.5. If you interpolate a table by hand and your midpoint does not average, you have misread a row. The slope-intercept form gives a third check: from the two points, slope 3 and intercept −3 (since y = 3x − 3 passes through both), so any interpolated value must satisfy that equation. Three checks — reversed order, midpoint average, slope-intercept equation — and a value that passes all three is as certain as the two points it came from. A value that fails any of them has an input error, because the method itself, on two points, cannot fail: it is the definition of the straight line through them.

A note on units: the slope carries them

Interpolation itself has no units, but the slope does: on the default line the slope is 3, meaning 3 units of y for every 1 unit of x, whatever those units are. If x is measured in metres and y in degrees, the slope is 3 degrees per metre; if x is re-measured in tens of metres, the same line has a slope of 30 degrees per ten metres, because each step of the new x unit covers ten old steps. The interpolated values do not change when the units change — only the slope’s statement does — which is why the fraction method is the safer way to think about the calculation: a fraction of the way along the line is a pure number, independent of units, while a slope always needs its “per what” attached. Whenever you quote a slope from this page, quote its units with it, or the number 3 means nothing at all.

The formula is point-slope form in disguise

Linear interpolation — y = y₁ + (x − x₁) × (y₂ − y₁)/(x₂ − x₁) — is the point-slope equation of the line through the two known points, evaluated at x. Seeing that removes the mystery: you are not approximating with a special trick, you are drawing the straight line between the points and reading it. The slope term (y₂ − y₁)/(x₂ − x₁) carries the units, so the result inherits the right units automatically — density per degree, dollars per dollar of income, whatever the table measures.

Error quarters when the interval halves

Interpolation error is bounded by curvature times interval-width squared, which gives a practical rule: halve the interval and the error roughly quarters. That is why interpolating between neighbouring table entries is usually excellent and interpolating across a wide gap is risky, and why the honest response to a suspicious interpolated value is a denser table, not a fancier formula. Never extrapolate beyond the table’s ends on the same line — beyond the last point, the straight line is a guess about the future, not a reading from data.

Interpolation questions, answered

What is interpolation?

Interpolation is estimating a value inside a range you have actually measured. If you know a quantity at x = 2 and at x = 5, interpolation fills in the gap between them — at x = 4, say — by assuming the quantity moved in a straight line from the first value to the second. This page goes one step further and labels the opposite case: a target outside the two points is extrapolation, the same straight line pushed past the data, and it deserves more caution because nothing measured backs it.

What is the linear interpolation formula?

y = y1 + (x − x1) × (y2 − y1) ÷ (x2 − x1). Read it in plain words: start at the first point, walk the fraction of the way toward the second point measured in x, and climb that same fraction of the rise in y. With (2, 3) and (5, 12) and a target of 4: the fraction is (4 − 2) ÷ (5 − 2) = 2/3, the rise is 9, so y = 3 + 2/3 × 9 = 9. The calculator shows that fraction and the slope on every run, so the arithmetic can always be checked by hand.

What is the difference between interpolation and extrapolation?

The arithmetic is identical; only the target’s address changes. Interpolation asks about an x between the two known x values, where the straight line is anchored at both ends by real measurements. Extrapolation asks about an x outside them, where the line is anchored at one end and guesswork at the other — the further out the target, the more the answer depends on the trend refusing to bend. This calculator names which of the two you are doing on every calculation, in plain sight, instead of letting an extrapolated number borrow an interpolated number’s confidence.

Why do the two points need different x values?

Because interpolation divides by (x2 − x1). If both points share the same x, that denominator is zero and the two points describe a vertical line: one x, many possible y values, and no slope to travel along. Real pairs of measurements of the same quantity at the same x either agree (and add no new information) or disagree (and one of them is wrong). Either way there is no line to interpolate on, so the calculator asks for two different x values instead of printing a made-up answer.

When is a straight line the wrong assumption?

Whenever the real quantity curves between your two points. Populations grow by multiplying, cooling bodies slow down as they approach room temperature, and drug doses level off — none of them move in straight lines except across short enough stretches. Linear interpolation is a good tool when the gap is small and the underlying quantity is steady, which is why printed tables (steam tables, tax tables, conversion tables) were built on it for a century. The wider the gap and the bendier the quantity, the more the in-between value should be labelled a rough estimate.

Can I interpolate with more than two points?

Yes, but the job changes shape. With many points you first find the two neighbours that bracket your target and interpolate between that pair alone — exactly what this calculator does one pair at a time. The shortcut of fitting one line through every point at once is called linear regression, and it answers a slightly different question: the best average line through noisy data, rather than the exact line through two trusted points. When both points are exact readings rather than noisy measurements, the pair method on this page is the right tool.

What does a fraction above 1 mean?

It means you are extrapolating, not interpolating. The fraction (target x − x₁) ÷ (x₂ − x₁) is between 0 and 1 inside the two points, exactly 0 or 1 at the points themselves, and outside that range beyond them. At x = 6 on the default line the fraction is 1.3333 and the answer is 15, computed by extending the line at the same slope — but with no measurement beyond x = 5 to support it. Treat any fraction outside 0 to 1 as a warning label, not just a number.

How do I work backwards, from a y to its x?

Exchange the roles in the same fraction: x = x₁ + (y − y₁) ÷ (y₂ − y₁) × (x₂ − x₁). On the default line, y = 6 gives (6 − 3) ÷ 9 = 0.3333 of the run of 3, so x = 2 + 1 = 3 — and the calculator confirms it, returning y = 6 at x = 3. This calculator takes x and gives y, so for a reverse lookup, solve the fraction by hand or run forward values until the y matches.

Why do evenly spaced x values give evenly spaced y values?

Because the slope is constant on a straight line. On the default line, every half step of x adds 1.5 to y: 3, 4.5, 6, 7.5, 9, 10.5, 12 for x = 2, 2.5, 3, 3.5, 4, 4.5, 5. If interpolated values do not step evenly when the x values do, check the inputs — most often the two points share an x value, which makes the run zero and the slope undefined, and the calculator refuses it.

How far beyond the points is it safe to extrapolate?

Only a short way, and only as a labelled estimate. At x = 6 — one step beyond data measured from 2 to 5 — the answer 15 is reasonable if the quantity is steady. At x = 20 the same arithmetic gives 57, but that asserts fifteen units of unmeasured behaviour and should be called a guess, not a result. The further the fraction strays from 0 to 1, the less the number deserves to be quoted without its warning.

What is the linear interpolation formula?

y = y₁ + (x − x₁) × (y₂ − y₁)/(x₂ − x₁), the value on the straight line between (x₁, y₁) and (x₂, y₂) at position x.

How accurate is linear interpolation?

Excellent for nearly-straight segments and small intervals; error grows with curvature and the square of the interval width. Halving the interval roughly quarters the error.

Should I ever extrapolate?

Only with caution. Extrapolation assumes the trend continues past the data, which often fails. Prefer measuring more points or modelling the function.

What is Newton's divided-difference method?

An extension using three or more points to fit a curve rather than a line, via successive "slopes of slopes", which captures curvature and reduces error.

Related calculators

A straight line between your points — nothing more is claimed.

Linear interpolation assumes the quantity moved in a straight line between the two values you entered. Where the real behaviour curves, saturates or jumps, the true in-between value will differ, and no result from this page should be used where a wrong estimate carries a safety, medical or financial risk. Check critical values against a measured source or a model of the actual process.

↑