🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
MATHEMATICS

Linear Interpolation Calculator — estimate between two points

Enter two known points and a target, and get the interpolated value with the slope, the position fraction and a warning when you have gone past the data.

The inverse mode reads the same straight line backwards, which is how you find the input that produces a target output.
The lower of your two reference points.
The value measured at x₁.
Must differ from x₁, or the line has no slope.
The value measured at x₂.
The x you want a y for, or the y you want an x for, depending on the mode above.
Rounding applied to the displayed answer only, never to the working.
Interpolated value
0
 
0
Slope between the points
0
Position fraction
0
y-intercept of the line
Inside or outside the range
Tip: the position fraction is the number to watch. Between 0 and 1 you are interpolating and the answer is bounded by your data. Outside that range you are extrapolating, and nothing in the data supports the result.
Advertisement

Linear interpolation fills the gap between two measurements you have by assuming the quantity changes at a constant rate between them. It is the arithmetic behind reading a value off a printed statistical table, converting between units that are only tabulated at round numbers, and estimating a sensor reading at a moment nothing was logged. This linear interpolation calculator takes two known points and a target, returns the estimate, and shows the slope, the intercept and the position fraction that produced it.

Arb Digital uses the same operation constantly in reporting work — filling a missing day in a traffic series, estimating a bid at a spend level between two tested points, converting a percentile that sits between two rows of a table. The calculation is trivial. Knowing when the straight-line assumption is safe, and when it quietly produces nonsense, is the part worth writing about, so most of this page is about that.

What This Linear Interpolation Calculator Does

It draws the unique straight line through your two points and evaluates it at the target. In the default direction you give an x and receive a y. In inverse mode you give a y and receive the x that produces it, which is the same line solved the other way and is what you want when you are chasing a target output rather than predicting one. Alongside the answer it reports the slope, the y-intercept of the line in full y = mx + c form, and the position fraction t, which tells you where the target sits relative to your two anchors.

The tool deliberately extrapolates rather than refusing to. If your target falls outside the interval it still returns the value, and labels it clearly as extrapolation in the result grid, because extrapolating knowingly is legitimate and extrapolating without noticing is not. That is also the boundary against our slope calculator, which returns the gradient and angle of the line through two points but does not evaluate it at a third value the way this page does.

How to Use It

  1. Choose the direction. Solve for y if you know an input and want the output. Switch to inverse mode if you know the output you are aiming at and need the input.
  2. Enter the two known points. Order does not matter — the line through them is the same either way, and the calculator handles a descending pair correctly.
  3. Enter the target. Anything between your two anchors is interpolation; anything outside is extrapolation and will be flagged as such.
  4. Read the position fraction. A value of 0.30 means the target sits 30% of the way from the first point to the second, and the answer sits the same 30% of the way between the two outputs.
  5. Check the bar breakdown. It shows visually how far along the interval the target falls, which makes an accidental extrapolation obvious at a glance.

The Formula and How It's Calculated

The interpolation formula is y = y₁ + (x − x₁) × (y₂ − y₁) ÷ (x₂ − x₁). Read it as: start at the first known output, then add the slope multiplied by how far the target has moved past the first known input. The fraction t = (x − x₁) ÷ (x₂ − x₁) is the same expression rearranged, and it makes the weighted-average nature of the result explicit, since y = (1 − t)·y₁ + t·y₂.

Take the default values. The known points are (10, 25) and (20, 45), and the target is x = 13. The slope is (45 − 25) ÷ (20 − 10) = 2. The target has moved 3 units past x₁, so y = 25 + 3 × 2 = 31. The position fraction is 3 ÷ 10 = 0.30, and checking the weighted-average form gives 0.70 × 25 + 0.30 × 45 = 17.5 + 13.5 = 31, which agrees. The y-intercept is 25 − 2 × 10 = 5, so the full line is y = 2x + 5.

Inverse mode solves the same equation for x: x = x₁ + (y − y₁) × (x₂ − x₁) ÷ (y₂ − y₁). It requires the two outputs to differ — a flat line has no unique input for a given output, and the calculator says so rather than dividing by zero. Linear interpolation is the two-point case of Lagrange interpolation, and the general n-point version, along with the error bounds that go with it, is set out in section 3.3 of the NIST Digital Library of Mathematical Functions.

Advertisement

Interpolation Is Safe, Extrapolation Is a Guess

Inside the interval, linear interpolation is bounded by your own measurements: the answer can never be larger than the bigger of the two outputs or smaller than the smaller one. That property makes it hard to produce an absurd result by accident. Outside the interval, the bound disappears. The line keeps climbing forever, and how wrong it becomes depends entirely on how the real relationship curves, which by definition you have not measured out there.

The practical rule is proportional. Extrapolating 10% beyond the width of your interval is usually a minor sin; doubling the interval is a serious claim about a shape you have not observed. Two points cannot distinguish a straight line from the flat part of a curve that turns sharply just past your last measurement. If you must extrapolate a long way, the honest move is to say so explicitly and to attach a range rather than a single number.

Where the Straight-Line Assumption Actually Breaks

Interpolation error depends on curvature, and it is largest in the middle of the interval — precisely where people feel most comfortable. For a smooth function the error is bounded by roughly one eighth of the interval width squared times the largest second derivative on it. The consequence is simple and useful: halving the gap between your reference points cuts the interpolation error by about four, not by two.

Three situations break the assumption badly enough to matter. Anything exponential — compound growth, decay, viral spread — is systematically underestimated in the middle of a wide interval, and an exponential model is the right choice there. Anything with a threshold, such as a pricing tier or a saturating response curve, has a kink that a straight line cuts the corner off. And anything periodic will be read completely wrongly if your two anchors happen to fall a whole cycle apart, since the line will show no change at all while the underlying quantity has moved through its full range twice.

Reading a Statistical Table by Hand

The classic use of this formula is a printed table that only lists round arguments. Suppose a t-table gives critical values at 20 and 24 degrees of freedom but you need 22. Linear interpolation between the two rows gets you close, because the critical value changes slowly and smoothly across degrees of freedom in that region. That approximation was standard practice for a century, and it is still a reasonable way to sanity-check a computed value.

It is worth knowing when the table trick misleads. Interpolating between rows works well where the tabulated function is nearly straight and badly where it is not — in the far tail of a distribution, or at very low degrees of freedom, where consecutive rows differ sharply. In those regions the interpolated value can be off by enough to change a decision at the margin, which is the reason our critical value calculator evaluates the distribution directly rather than interpolating a stored table.

Filling Missing Values in a Time Series

Interpolating a missing day between the day before and the day after is a defensible way to keep a chart continuous, but it changes the statistics of the series in ways that are easy to forget. Interpolated points sit exactly on the line, so they carry no noise. Fill in a handful and the variance of the series drops, autocorrelation rises, and any test run on the filled series will look more confident than the data justifies.

Two habits keep this honest. Mark interpolated points as estimates in the dataset itself, so nobody downstream treats them as observations, and never interpolate across a gap wider than the cycle in the data — filling a missing Wednesday from Tuesday and Thursday is reasonable, filling a missing fortnight from the days either side of it is fiction. Weekly seasonality also means a straight line between two points a week apart will misstate every day in between, and a weighted average calculator applied to comparable weekdays usually beats a naive straight line.

Interpolation Versus Fitting a Line

Interpolation forces the line through exactly two points. Regression finds the line that best fits many points and typically passes through none of them. The distinction matters when your two anchors are themselves measurements with error: interpolation inherits both errors in full and can amplify them, because a small error in either endpoint tilts the whole line.

The test for which tool to use is whether you have more than two data points. If you do, and they are noisy, fitting a line through all of them with our linear regression calculator gives a more stable estimate than picking the two nearest neighbours and drawing between them. Interpolation is the right choice when the two anchors are exact — table values, defined conversion points, contractual tiers — because then the only error is the curvature of what sits between them. The slope and point-slope forms behind both approaches are covered in the algebra notes on lines from Paul's Online Math Notes at Lamar University.

Gaps in your reporting data?

Arb Digital builds analytics setups that measure the days you care about, so you are reading real numbers instead of filling holes with straight lines.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Extrapolating without noticing — a target outside your two anchors is a projection, not an estimate, and this page labels it so you cannot miss it.
  • Interpolating across a curve's turning point — a straight line between two points either side of a peak will miss the peak entirely and report the average instead.
  • Swapping x and y in the formula — the denominator must match the axis you are moving along, and getting it backwards inverts the slope.
  • Treating filled values as observations — interpolated points carry no noise, so they shrink variance and make later tests look more confident than they should.
  • Using two points when you have twenty — with noisy data, a fitted regression line is more stable than a line forced through the two nearest neighbours.

Related Free Tools From Arb Digital

Convert a rate of change into a percentage with the percentage change calculator, control how the answer is displayed with the rounding calculator, or average several anchors with the weighted average calculator. The full free online tools hub lists every mathematics tool we publish.

Frequently Asked Questions

What is linear interpolation in simple terms?

It is estimating a value between two known measurements by assuming the quantity changes at a steady rate between them. You take the first value and add the slope multiplied by how far along the gap your target sits.

What is the difference between interpolation and extrapolation?

Interpolation estimates inside the range covered by your known points, so the answer is bounded by your own data. Extrapolation continues the line beyond that range, where nothing you measured supports the result.

How accurate is linear interpolation?

It depends on how much the underlying relationship curves across the interval. Error is largest in the middle of the gap and shrinks roughly with the square of the interval width, so halving the gap cuts the error by about four.

Can I interpolate backwards to find x from y?

Yes. Switch the mode at the top of the calculator and it solves the same line for x. This needs the two known outputs to differ, because a flat line gives no unique input for a target output.

Does the order of the two points matter?

No. The line through two points is the same regardless of which one you enter first, and the calculator handles a descending pair correctly. Only the sign of the slope changes.

What is the position fraction the calculator shows?

It is how far the target sits along the interval, expressed between 0 and 1. A fraction of 0.25 means the answer is a quarter of the way from the first output to the second. Values outside 0 to 1 mean you are extrapolating.

Why does the calculator refuse when both x values are equal?

Two points with the same input define a vertical line, which has no slope and no single output. There is nothing to interpolate, so the tool says so rather than dividing by zero.

This page explains a mathematical method for study and for checking your own working. It is not a substitute for showing your method, and it is not medical, legal, or financial advice.

Advertisement
Advertisement

Take it further