What is y halfway between two known points? Interpolate from two points or a table pasted from Excel, solve for x from a y value, and get a warning when the answer is an extrapolation.
Linear Interpolation Calculator - Two Points or a Table
What is y halfway between two known points? Interpolate from two points or a table pasted from Excel, solve for x from a y value, and get a warning when the answer is an extrapolation.
Parameters
Enter data for calculations
The value between two known points, or between two rows of a table
If 40 points on a test earn 50% and 50 points earn 75%, what does a score of 46 earn? Enter the two points and x = 46, and this linear interpolation calculator answers 65%, because 46 sits 60% of the way from 40 to 50. It works from two points or from a whole two-column table pasted from Excel or Google Sheets, runs the question backwards (which x gives a chosen y), and prints the formula with your numbers substituted so you can copy the working into a report or homework.
The arithmetic is exact. Inputs are kept as fractions, so 0.1, 0.2, 0.3 and 0.4 give exactly 0.3 at x = 0.2, not 0.30000000000000004. Only the final answer is rounded, to 10 significant digits. When the x you ask about falls outside the data, the result is labeled as an extrapolation instead of being passed off as an interpolated value.
Six fields, and which ones you can skip
- x₁ and y₁ - the first known pair, for example 40 and 50. Negative numbers and decimals are fine; use a period for decimals. A comma is read only as a thousands separator, so 1,250.5 works and 2,5 is rejected with a note.
- x₂ and y₂ - the second pair, for example 50 and 75. The order of the two points does not matter, but x₁ and x₂ must differ.
- Table of points - instead of two points, paste two columns (x on the left, y on the right) or type one pair per row, separated by a tab, semicolon, comma or space. Up to 200 rows in any order. A header row and values like 50% are handled. A filled table takes priority over the point fields.
- Find y for x - the x whose value you want, for example 46.
- Find x for y - optional inverse question, for example the score needed for 65%. Both target fields can be filled at once.
- Read the result - the value, the slope, the equation of the line on the segment used, how far along the segment x lies, and the full substitution into the formula.
Nearest row versus an interpolated value
The usual shortcut with a lookup table is to take the closest row and move on. The two panels below put that habit next to what interpolation gives for the same grading scale.
Score 46 is nearer to 50 than to 40, so the table says 75%.
Score 43 is nearer to 40, so it gets 50%.
Two students 3 points apart land 25 percentage points apart, and a score of 45 is a coin toss.
Score 46 gives 65%, score 43 gives 57.5%.
Every extra point is worth the same 2.5 percentage points, which is the slope of the line.
The inverse question also has one answer: 65% needs exactly 46 points.
How big the error from rounding to a row gets depends on the spacing of the table and on how steeply the values change. The table below measures it on two sets of data.
| Data | x | Closest row | Interpolated | Difference |
|---|---|---|---|---|
| (40, 50), (50, 75) | 46 | 75 | 65 | 10 |
| (40, 50), (50, 75) | 43 | 50 | 57.5 | 7.5 |
| Table 0, 10, 20, 30 → 1,000, 1,200, 1,100, 900 | 26 | 900 | 980 | 80 |
| Same table | 15 | 1,200 or 1,100 (tie) | 1,150 | 50 either way |
The linear interpolation formula, and where it comes from
Exactly one straight line passes through two points (x₁, y₁) and (x₂, y₂). Its slope m = (y₂ - y₁) / (x₂ - x₁) says how much y changes when x grows by 1. The value at x is the starting y plus as many slope steps as x has moved away from x₁:
With the grading points: m = (75 - 50) / (50 - 40) = 2.5, so y = 50 + 6 × 2.5 = 65. A proportion gives the same thing from another angle: x has covered (46 - 40) / (50 - 40) = 0.6 of the segment, so y also moves 0.6 of the way from 50 to 75. The calculator shows that fraction as "Position of x on the segment".
Inverse interpolation swaps the roles: x = x₁ + (y - y₁) × (x₂ - x₁) / (y₂ - y₁). It needs y₁ and y₂ to differ. On a horizontal line every x gives the same y, so either no x works or every x does, and the result says which.
Seven inputs and what came back
Each row is the calculator's own output. The last column flags the cases where a hand calculation tends to slip.
| Points | Asked | Result | Note |
|---|---|---|---|
| (0, 32), (100, 212) | x = 37 | y = 98.6 | Celsius to Fahrenheit is a straight line, so this is exact |
| (0, 32), (100, 212) | y = 98.6 | x = 37 | inverse interpolation |
| (40, 50), (50, 75) | x = 60 | y = 100 | extrapolation, flagged under the result |
| (0, 100), (8, 20) | x = 3 | y = 70 | falling values, slope -10 |
| (0, 0), (3, 1) | x = 1 | y = 0.3333333333 | rounded to 10 significant digits |
| Table (0, 1,000), (10, 1,200), (20, 1,100), (30, 900) | x = 15 | y = 1,150 | only the rows for 10 and 20 are used |
| Same table | y = 1,050 | x = 2.5 and x = 22.5 | data rises then falls, two answers |
The last two rows explain why a table is searched segment by segment. For x = 15 only the neighbors 10 and 20 count. For y = 1,050 every segment is checked, because that value appears once on the rising part and once on the falling part, and both answers are listed.
Interpolation, extrapolation, regression or a proportion
All four read a value off a straight line, but they pick the line differently and deserve different levels of trust.
| Method | Line built from | Passes through the points? | Good for |
|---|---|---|---|
| Linear interpolation | the two neighbors around x | yes, every one | values between rows of a table, grading scales, engineering charts |
| Extrapolation | the end segment, extended | yes, but x lies beyond them | careful use, close to the end of the data |
| Linear regression | all points at once | usually not, it smooths | noisy measurements and trends |
| Proportion a/b = c/x | one point and the origin | line through zero | quantities that are directly proportional |
Four slips that move the answer
Linear interpolation questions
Related tools
Pipe Slope Calculator
Code minimum fall per foot under the IPC, IRC or UPC and the total drop over a drain run - See the calculator
Gutter Size Calculator
5 or 6 inch gutters and the number of downspouts from roof area, pitch and rainfall - See the calculator
Linear Function Calculator
The equation y = mx + b from two points, with the x- and y-intercepts - See the calculator
Linear Regression Calculator
One best-fit line through many noisy measurements - See the calculator
Proportion Calculator
The unknown in a/b = c/x, for lines that pass through zero - See the calculator
Coordinate Calculator
Distance between two points and the midpoint of a segment - See the calculator
System of Equations Calculator
The line through two points as a pair of equations, solved with steps - See the calculator
Polynomial Calculator
When a straight line is not enough: roots and factoring of a polynomial - See the calculator