Math
Linear Interpolation Calculator
Give mathcheck two known points and an x in between, and it returns the y on the straight line through them, as an exact fraction and a decimal, with the slope, the position t along the segment, and the equation of the line.
Inverse mode finds the x that produces a chosen y (handy for tables in reverse). Values outside the known range are still computed but flagged as extrapolation, and the graph shows where the new point sits.
x of the first known point.
y of the first known point.
x of the second known point.
y of the second known point.
Usually between x1 and x2. Outside that range the result is an extrapolation.
Try an example
Result
Interpolated value
—
- Decimal
- —
- Slope
- —
- Line through the points
- —
- Position t
- —
- Interpolation or extrapolation
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What linear interpolation does
When you know a quantity at two points and need it somewhere in between, the simplest estimate assumes it changes at a constant rate: draw the straight line through the two points and read off the value. That is linear interpolation, the method behind reading between rows of a table, resizing images, and blending values in graphics (where it is called lerp).
A table gives f(1) = 2 and f(3) = 8. Estimate f(2).
Slope = (8 - 2)/(3 - 1) = 3. Then f(2) ≈ 2 + 3(2 - 1) = 5. Here t = 1/2, so the answer is the average of the two known values.
Interpolation versus extrapolation
Inside the interval [x1, x2] the estimate is an interpolation, and for smooth data it is usually close. Outside the interval it becomes an extrapolation: the line is extended past the evidence, and the error can grow quickly if the real relationship curves. The calculator flags extrapolation so you can decide whether to trust it.
| t | Meaning | Result |
|---|---|---|
| 0 | at the first point | y = y1 |
| 1/2 | halfway | average of y1 and y2 |
| 1 | at the second point | y = y2 |
| outside [0, 1] | beyond the known points | extrapolation |
How to use this calculator
- Enter the two known points (x1, y1) and (x2, y2).
- Choose forward mode and type the x where you need a value, or inverse mode and type the target y.
- Read the exact answer and its decimal, the How steep a line is: how much y changes for each step right in x., the position t along the segment, and the line's equation.
- Check the type: interpolation is inside the known range, extrapolation is outside it.
- Open Show the work to see the slope and the substitution written out.
How to read the answer
The answer is exact as a fraction whenever the inputs are decimals or integers. t tells you how far along the segment the query lies: 0.25 means a quarter of the way from the first point to the second. If t is below 0 or above 1 the result is an extrapolation and the warning explains the risk. In inverse mode the roles of x and y swap, so a horizontal pair of points (y1 = y2) cannot be inverted.
Common mistakes and edge cases
- Swapping the order of subtraction in only one difference, which flips the sign of the slope.
- Dividing by (x2 - x1) when the two x-values are equal; that pair defines a vertical line with no function value.
- Treating an extrapolated value as reliable. Past the data, a straight line is only a guess.
- Interpolating on data that is clearly curved with brackets that are far apart; use closer points or a different model.
- Mixing up which point is (x1, y1). Either order works as long as x and y stay paired.
Worked examples
Table lookup between rows
(1, 2) and (3, 8), find y at x = 2
Interpolated value
y = 5
Fractional answer
(0, 1) and (4, 2), find y at x = 1
Interpolated value
y = 5/4 (1.25)
Decreasing data
(10, 50) and (20, 30), find y at x = 15
Interpolated value
y = 40
Extrapolation beyond the data
(1, 2) and (3, 8), find y at x = 5
Interpolated value
y = 14
Decimal inputs stay exact
(0, 0.1) and (1, 0.3), find y at x = 0.25
Interpolated value
y = 3/20 (0.15)
Inverse interpolation
(1, 2) and (3, 8), find x where y = 5
Interpolated value
x = 2
Inverse with extrapolation
(1, 2) and (3, 8), find x where y = 0
Interpolated value
x = 1/3 (0.3333)
Vertical pair
Interpolated value
—
Horizontal pair in inverse mode
Interpolated value
—
Frequently asked questions
What is the linear interpolation formula?+
y = y1 + (x - x1)(y2 - y1)/(x2 - x1). It is the equation of the line through (x1, y1) and (x2, y2), evaluated at x.
How do I interpolate from a table?+
Find the two rows that bracket your x, take their (x, y) pairs as the known points, and apply the formula. The calculator's t value shows how far between the rows you are.
What is the difference between interpolation and extrapolation?+
Interpolation estimates inside the range of known points; extrapolation extends the line beyond it. The formula is identical, but extrapolation assumes the trend continues and is far less reliable.
What is inverse interpolation?+
Solving the same line for x instead of y: x = x1 + (y - y1)(x2 - x1)/(y2 - y1). It answers questions like 'at what temperature does the table reach 100 kPa?'
Is linear interpolation accurate?+
For data that is nearly straight over the bracket, yes. The error is bounded by (x2 - x1)^2/8 times the maximum curvature, so tighter brackets give better answers. Strongly curved data needs polynomial or spline interpolation.
What does lerp mean?+
Short for linear interpolation, used in graphics and game programming: lerp(a, b, t) = (1 - t)a + t·b blends between a and b as t goes from 0 to 1. It is the same formula with t as the position.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Bilinear Interpolation Calculator
Interpolate a value inside a 2×2 grid of known points: two linear interpolations in x, then one in y, with exact fractions, the corner weights, and an extrapolation warning for points outside the cell.
Slope Calculator
Find slope from two points, solve a missing coordinate from a known slope, or turn an angle or percentage grade into a slope. Includes equations, intercepts, perpendicular slope, graph, and step-by-step work.
Slope Intercept Form Calculator
Write the equation of a line in slope-intercept form y = mx + b from two points, a point and a slope, or standard form. Exact fractions, intercepts, a graph, and every other form of the line.
Point Slope Form Calculator
Write the equation of a line in point-slope form y - y1 = m(x - x1) from a point and a slope or from two points, then convert it to slope-intercept and standard form with a graph.
Average Rate of Change Calculator
Find the average rate of change of a function between two x-values from a polynomial or from two points, with the exact fraction, the secant line equation, and every step.
Midpoint Calculator
Find the midpoint between two coordinate points with coordinate-average steps.
Last updated: September 4, 2026