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

    First known x value

    Value that goes with x₁

    Must differ from x₁

    Value that goes with x₂

    A filled table replaces points 1 and 2

    Interpolation: the y value at this x

    Inverse interpolation

    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

    1. 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.
    2. 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.
    3. 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.
    4. Find y for x - the x whose value you want, for example 46.
    5. Find x for y - optional inverse question, for example the score needed for 65%. Both target fields can be filled at once.
    6. 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.

    Before: closest row

    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.

    After: linear interpolation

    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.

    DataxClosest rowInterpolatedDifference
    (40, 50), (50, 75)46756510
    (40, 50), (50, 75)435057.57.5
    Table 0, 10, 20, 30 → 1,000, 1,200, 1,100, 9002690098080
    Same table151,200 or 1,100 (tie)1,15050 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₁:

    y = y₁ + (x - x₁) × (y₂ - y₁) / (x₂ - 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.

    PointsAskedResultNote
    (0, 32), (100, 212)x = 37y = 98.6Celsius to Fahrenheit is a straight line, so this is exact
    (0, 32), (100, 212)y = 98.6x = 37inverse interpolation
    (40, 50), (50, 75)x = 60y = 100extrapolation, flagged under the result
    (0, 100), (8, 20)x = 3y = 70falling values, slope -10
    (0, 0), (3, 1)x = 1y = 0.3333333333rounded to 10 significant digits
    Table (0, 1,000), (10, 1,200), (20, 1,100), (30, 900)x = 15y = 1,150only the rows for 10 and 20 are used
    Same tabley = 1,050x = 2.5 and x = 22.5data 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.

    MethodLine built fromPasses through the points?Good for
    Linear interpolationthe two neighbors around xyes, every onevalues between rows of a table, grading scales, engineering charts
    Extrapolationthe end segment, extendedyes, but x lies beyond themcareful use, close to the end of the data
    Linear regressionall points at onceusually not, it smoothsnoisy measurements and trends
    Proportion a/b = c/xone point and the originline through zeroquantities that are directly proportional

    Four slips that move the answer

    Mismatched differences. The top and bottom of the slope must subtract in the same order: (y₂ - y₁) / (x₂ - x₁). Writing (y₂ - y₁) / (x₁ - x₂) flips the sign of the slope, and the answer lands on the wrong side of y₁.
    Wrong pair of rows. In a table, use the two rows directly around x. Interpolating between the first and last rows of the table above gives 950 at x = 15 instead of 1,150, because the data does not lie on one line.
    Extrapolation dressed up as interpolation. The formula happily returns a number for an x outside the data, but nothing says the relationship stays straight out there. The same table gives 800 at x = 35, a figure no row supports, so the result carries a warning.
    Stopping at the first match. When y rises and then falls, a value can occur more than once. Reading down a table and stopping at the first hit misses the second answer.

    Linear interpolation questions

    How do I do linear interpolation in Excel?

    Excel has no function named "interpolate", but for two points FORECAST.LINEAR(x, known_y's, known_x's) does the job, and the older FORECAST works the same way. Exactly one line passes through two points, so the result equals the interpolated value. Point it at a whole table, though, and it fits a regression line through every row, which is a different calculation. Google Sheets has FORECAST with the same arguments.

    How do I paste data from a spreadsheet?

    Select two adjacent columns, x on the left and y on the right, copy, and paste into the table field. Spreadsheets separate columns with a tab, which the calculator recognizes. A header row is skipped, percentages such as 50% are read as numbers, and thousands separators such as 1,200 are accepted. Comma-separated rows like 0,1000 from a CSV file are read as two columns.

    What is the difference between interpolation and extrapolation?

    Interpolation estimates a value between known points; extrapolation estimates one outside them. The formula is identical. The difference is the evidence: an extrapolated value assumes the trend continues where the data no longer shows it.

    Does the order of the points matter?

    No. Swapping point 1 and point 2 gives the same answer. A table is sorted by x automatically, and a note under the result says when that happened.

    When is linear interpolation not accurate enough?

    When the real relationship curves noticeably and the points are far apart. The straight line is then a chord of the curve, and the error is largest near the middle of the segment. A denser table, or a method that assumes a curve, fixes it.

    What does "Position of x on the segment" mean?

    It is the share of the distance from x₁ to x₂ that x has covered. At 60%, the answer is 60% of the way from y₁ to y₂. Values of 0% and 100% are the points themselves.

    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

    Similar calculators from this section