Percentages and Math

Linear Interpolation Calculator

Give two points and a value to look up, and get the straight-line answer with the slope and intercept.

Your numbers

Find

Result

y at x = 2

20

Interpolated: the value lies between your two points.

Slope (change in y per 1 of x)
10
Intercept (y when x is 0)
0
Position along the segment
50%
Line
y = 10 x + 0

Points

Pointxy
Point 1110
Result (between the points)220
Point 2330
How this was calculated
  1. y = y1 + (x - x1) x (y2 - y1) / (x2 - x1) = 10 + (2 - 1) x (30 - 10) / (3 - 1) = 20.
  2. The calculation assumes the value changes at a steady rate between the two points.

Calculated using SumPanda.com · https://sumpanda.com/linear-interpolation-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the linear interpolation calculator

  1. Choose whether to find y for a given x or find x for a given y. Enter the two points you know, (x1, y1) and (x2, y2), then the value you want to look up.
  2. The answer appears at once, with the slope and intercept of the straight line through your two points, how far along the segment the value sits, and a short line stating whether it was interpolated or extrapolated.
  3. The two points can be in any order, and negative numbers and decimals work. If the first and second x values are the same, the line is vertical and the tool asks you to change one of them.
  4. Use Copy, Print or CSV to keep the result, with the three points listed in order.

Formula

y = y1 + (x - x1) x (y2 - y1) / (x2 - x1)

x = x1 + (y - y1) x (x2 - x1) / (y2 - y1)

Slope = (y2 - y1) / (x2 - x1), intercept = y1 - slope x x1

The fraction (x - x1) / (x2 - x1) is how far the value is along the segment, from 0 at the first point to 1 at the second.

Two worked cases

Between (1, 10) and (3, 30), the value at x = 2 is halfway along the segment, so y = 10 + 0.5 x 20 = 20. The slope is 10 and the line is y = 10x.

Between (2, 3.5) and (6, 9.5) the slope is 6 / 4 = 1.5. At x = 3, y = 3.5 + 1.5 x 1 = 5. Reversing the question, the x that gives y = 8 is 2 + (8 - 3.5) / 1.5 = 5. At x = 8, which is outside the two points, the same line gives 3.5 + 1.5 x 6 = 12.5, and the tool flags it as extrapolated.

When a straight line is a good guess

Linear interpolation assumes the quantity changes at a steady rate between two known values. That is reasonable when the points are close together or when the thing you are measuring is close to straight, such as a price that changes steadily with quantity or a table entry between two nearby rows. It is a poor guide when the real curve bends sharply between the points, so use points as close to your target as you can.

Looking up a value outside the two points is called extrapolation. The arithmetic is the same, but the further you go beyond the points, the more the answer depends on the line continuing unchanged, so the tool marks those answers and shows a warning.

Using the slope and intercept

The slope tells you how much y changes for each 1 of x, and the intercept is where the line crosses y when x is 0. Together they give the equation of the line, which the tool prints so you can reuse it. To fit a line to many points instead of two, use the linear regression calculator, and to work with the slope on its own, use the slope calculator.

Numbers are accepted up to one trillion in size and are shown with up to 8 decimal places. The calculation uses ordinary double precision numbers, which carry about 15 significant digits, so very large or very small values may show tiny rounding differences.

Assumptions and limits

  • The value changes at a steady rate between the two points. Curved relationships are not modeled.
  • Points must have different x values. To find x from y, the two y values must also differ.
  • Answers outside the two points are extrapolations and are flagged as less reliable.
  • Values are limited to one trillion in size, and results are shown to 8 decimal places.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What is the difference between interpolation and extrapolation?

Interpolation finds a value between two known points. Extrapolation finds a value outside them, which relies more heavily on the trend continuing.

Can I enter the points in any order?

Yes. The formula gives the same answer whichever point you call the first, as long as each x is paired with its own y.

Why does it ask for different y values when I look up x?

If both y values are equal, the line is flat. Many x values share that same y, so there is no single x to find.

How accurate is the result?

The arithmetic is exact to about 15 significant digits. How well it matches reality depends on whether the real relationship is close to a straight line between your points.