Linear Interpolation Calculator
Linear interpolation calculator with steps. Enter two known points and an x or y value to find the missing value, with the formula and slope shown.
Published
Last updated
How the Linear Interpolation Calculator Formula Works
Linear interpolation estimates a value between two known points by assuming the values change at a constant rate along the straight line joining them. Take your two points, (x1, y1) and (x2, y2). The slope of that line is (y2 - y1) / (x2 - x1), which is the change in y for each 1 change in x. To find y at a new x, start at y1 and add the slope times how far x is from x1. That gives y = y1 + (x - x1)(y2 - y1) / (x2 - x1).
The same formula runs backward. If you know y and want x, solve the line for x: x = x1 + (y - y1)(x2 - x1) / (y2 - y1). Choose the mode above to solve for either one.
If x falls outside the range between x1 and x2, the formula still works, and the calculation is then called extrapolation. It is the same arithmetic with less reliable results, because nothing in your two points says the straight-line trend continues.
y = y1 + (x − x1)(y2 − y1) / (x2 − x1) | solved for x: x = x1 + (y − y1)(x2 − x1) / (y2 − y1)- x1, y1anyThe first known point. Use the same units for every x value and the same units for every y value.
- x2, y2anyThe second known point. x2 must differ from x1, otherwise the points sit on a vertical line.
- xany12The x value where you want to estimate y. Used when solving for y.
- yanyThe y value where you want to find x. Used when solving for x. y1 and y2 must differ for this mode.
- x1, y1
- any
- The first known point. Use the same units for every x value and the same units for every y value.
- x2, y2
- any
- The second known point. x2 must differ from x1, otherwise the points sit on a vertical line.
- x
- any
- The x value where you want to estimate y. Used when solving for y.
- y
- any
- The y value where you want to find x. Used when solving for x. y1 and y2 must differ for this mode.
Using the Linear Interpolation Calculator
Enter what do you want to find?
Choose from Find y from x, Find x from y.
Enter first point, x1
Type the figure you already have, then press Calculate.
Enter first point, y1
Type the figure you already have, then press Calculate.
Enter second point, x2
Type the figure you already have, then press Calculate.
Enter second point, y2
Type the figure you already have, then press Calculate.
Enter x value to look up
Type the figure you already have, then press Calculate.
Enter y value to look up
Type the figure you already have, then press Calculate.
Read the result
Press Calculate to update the result. Until you do, the last result is dimmed and marked as out of date, so you always know which numbers belong to the values in the boxes.
A Real Worked Example
A temperature transmitter sends a 4 to 20 mA signal for a range of 0 to 100 °C, so 4 mA means 0 °C and 20 mA means 100 °C. A controller reads 12 mA. What is the temperature?
The slope is (100 − 0) / (20 − 4) = 6.25 °C for each mA. The reading is 12 − 4 = 8 mA above the first point, so y = 0 + 8 × 6.25 = 50 °C. The position output of 0.5 says 12 mA sits exactly halfway between 4 and 20, which matches 50 °C being halfway between 0 and 100. Because 12 lies between 4 and 20, this is interpolation, the more reliable case.
Between two bond maturities (illustrative numbers)
Suppose a 2-year bond yields 4.0% and a 5-year bond yields 4.3%, and you want a rough 3-year yield. These are illustrative numbers, not market data. The slope is (4.3 − 4.0) / (5 − 2) = 0.1 percentage points per year, and 3 years is 1 year past the first point, so y = 4.0 + 1 × 0.1 = 4.1%.
The position of 0.3333 shows that 3 years sits one third of the way from 2 to 5. Real yield curves bend, so this is a quick estimate rather than a market quote.
Solving for x: when does a battery reach 60%? (illustrative numbers)
A battery reads 80% at 14:00 and 50% at 17:00. When does it reach 60%? Here y is known and x is the unknown, so the calculator uses the line solved for x. The slope is (50 − 80) / (17 − 14) = -10 percentage points per hour.
x = 14 + (60 − 80) × (17 − 14) / (50 − 80) = 14 + (-20 × 3) / (-30) = 14 + 2 = 16, so the battery hits 60% at 16:00. The position of 0.6667 means that moment is two thirds of the way from 14:00 to 17:00. A negative slope is no problem, the formula handles falling values the same way.
Extrapolation can break: the same battery at 23:00
Use the same two readings, but ask for 23:00, which is well past the last reading. The formula gives y = 80 + (23 − 14) × (-10) = -10, so the line predicts a battery level of -10%. That is impossible, and it shows the limit of extrapolation.
The position output of 3 says the point sits three full intervals past the first reading, so it is far outside the 14:00 to 17:00 range. The calculator flags this as extrapolation in its steps. The arithmetic is correct, but the straight-line assumption stopped being true somewhere before the battery reached zero.
Bilinear interpolation, final pass: between two row results
This is the third and last pass of the bilinear example above. The first two passes, along x at y = 10 and y = 20, gave 125 and 325. Here those become the two known points, with y playing the role of x.
The point y = 12 is 2 of the 10 units from 10 to 20, so the position is 0.2. The slope is (325 − 125) / (20 − 10) = 20, and y = 125 + 2 × 20 = 165. That is the bilinear estimate at x = 1.25, y = 12.
Why straight lines can mislead: growth by ratios
A quantity quadruples from 100 at x = 0 to 400 at x = 2. Linear interpolation at x = 1 gives the halfway value, 250. If the quantity grows by equal ratios, the midpoint is the geometric mean instead, 100 × 40.5 = 200.
The gap between 250 and 200 is the price of using a straight line on a curve that bends upward. For data that changes by a percentage, interpolate geometrically, or take logarithms of y first, interpolate, and convert back.
A log scale for x: interpolate between log values
Suppose y is 2 at x = 10 and 6 at x = 1000, and you want y at x = 100. Because x spans two orders of magnitude, work with log10 of x. The points become (1, 2) and (3, 6), and x = 100 becomes 2, which is exactly halfway.
The result is y = 4. Interpolating directly on the original x values would give about 2.36, because x = 100 is only a small way along the straight line from 10 to 1000. Matching the scale to how the data behaves is what makes the estimate sensible.
What Else to Know
The Formula as a Weighted Average
The interpolation formula has a second form that is easier to picture. Write t for the position between the points, t = (x - x1) / (x2 - x1). Then y = (1 − t) × y1 + t × y2. That is a weighted average of the two known values. At t = 0 you get y1, at t = 1 you get y2, and at t = 0.5 you get the midpoint of the two. The closer x is to one point, the more that point's value counts.

That is why the calculator shows a position output. A value near 0 or near 1 tells you the answer sits close to a known point, while 0.5 means exactly halfway. Programmers know the same idea as lerp, written lerp(a, b, t) = a + (b - a) × t, and the calculator's position is that t.

The formula also gives the straight line through your two points. The slope is (y2 - y1) / (x2 - x1) and the intercept is the y value where the line crosses x = 0. Both are shown in the results, so you can write the line as y = mx + b.

How to Interpolate by Hand or on a Scientific Calculator
By hand, work in four small steps. First find the slope: subtract the two y values, subtract the two x values, and divide. Second find how far your x is from the first point: x - x1. Third multiply the slope by that distance. Fourth add y1. For x = 12 between (4, 0) and (20, 100), the slope is 100 / 16 = 6.25, the distance is 8, the product is 50, and adding y1 = 0 gives 50.

On a scientific calculator, including Casio and TI models, type the whole formula with parentheses so the order is right: (x - x1) × (y2 - y1) ÷ (x2 - x1) + y1. The brackets around each subtraction matter. Without them the calculator divides and multiplies the wrong pieces. If your calculator has a memory key, store the slope first and reuse it.

In a spreadsheet, put x1 in A2, y1 in B2, x2 in A3, y2 in B3, and the new x in E2, then use =B2+(E2-A2)*(B3-B2)/(A3-A2). The calculator above does the same arithmetic and also writes out each step.
Interpolation, Extrapolation, and How Far to Trust the Answer
Interpolation estimates a value between two known points. Extrapolation uses the same formula for an x outside them. The arithmetic does not change, but the reliability does. Between the points you at least know the true values at both ends, while outside them nothing in your data says the trend continues. The battery example shows how that fails: the straight line predicts a negative charge.
For a smooth curve, the error of linear interpolation has a known form. If f is twice differentiable, the difference between the true value and the straight-line estimate is (x - x1)(x2 − x)/2 times the second derivative at some point between them, up to sign. The largest this can be between points h apart is h² / 8 times the biggest value of |f″|. Halving the spacing cuts the worst-case error to a quarter, which is why a finer table gives better interpolated values.

In practice, check two things. First, whether the quantity really changes at a roughly steady rate between your points. Second, whether your points are close together. Look-up tables such as steam tables and calibration charts are usually printed with closely spaced values, which keeps the straight-line error small.
When Linear Interpolation Is the Wrong Tool
A straight line is a good guess only when the data is close to straight between your two points. Compound growth, decay, pH, decibels, and anything that curves sharply between table entries will be misjudged. For data like that, interpolate on a transformed scale, such as the logarithm of the values, or use a method that follows the curve, such as polynomial or spline interpolation through more than two points.
This calculator handles one straight line through two points. It does not do bilinear or trilinear interpolation, which estimate a value on a grid or a cube. You can still work a bilinear problem by hand with three linear interpolations: interpolate along x twice, once on each of the two rows, then interpolate between those two results along y.
If your known points are noisy measurements rather than exact table values, interpolation is the wrong idea altogether. A fitted line through many points, such as a least-squares line, smooths the noise instead of passing through every error.
Bilinear Interpolation as Three Linear Passes
Bilinear interpolation estimates a value inside a rectangle when you know the value at all four corners. It is nothing more than linear interpolation done three times: twice along one direction, then once along the other. This calculator handles each pass, so you can run it three times to get a bilinear answer even though it has no dedicated grid mode.
Suppose a table gives values at x = 1 and x = 2 for two rows. At y = 10 the values are 100 and 200, and at y = 20 they are 300 and 400. To estimate the value at x = 1.25, y = 12, first interpolate along x on the y = 10 row: enter x1 = 1, y1 = 100, x2 = 2, y2 = 200 and x = 1.25 to get 125. Next do the same on the y = 20 row with 300 and 400 to get 325. Finally interpolate between those two results along y: x1 = 10 with y1 = 125, x2 = 20 with y2 = 325 and x = 12, which gives 165.

The order does not matter, as long as you finish with the other direction. Doing y first and then x gives the same 165. Bilinear interpolation is only as good as the surface is flat inside the rectangle, so it works best on a fine grid, and it should not be used outside the four corner points.
Logarithmic and Geometric Interpolation
Straight-line interpolation assumes equal steps in x produce equal steps in y. Many real quantities do not behave that way. Anything that grows or decays by a percentage, such as a population, a decay curve or a sound level, moves in equal ratios, and a straight line between two points sits above the true curve in between.
There are two common fixes, and the calculator handles both without a special mode. If y changes by ratios, interpolate geometrically, which means y = y1 × (y2 / y1)p, where p is how far x is between the points (the calculator's position output). If x covers several orders of magnitude, such as frequency or concentration, interpolate against the logarithm of x instead. Take the log of x1, x2 and x, enter those, and read the answer.

Here are two examples. Between (0, 100) and (2, 400) the linear estimate at x = 1 is 250, but a growth by ratios gives 100 × 40.5 = 200. For x on a log scale, take (10, 2) and (1000, 6) and look up x = 100. Using log10 of each x gives the points (1, 2) and (3, 6) at x = 2, which interpolates to 4. The plain linear answer on the original x values would be about 2.36, which is noticeably different. Always pick the scale that matches how the data behaves, and check it against a known point.
Interpolation, Curve Fitting, and Forecasting Are Different Jobs
Interpolation estimates values between known data points and passes through them exactly. Curve fitting works the other way around: it chooses a smooth curve that follows the overall trend of many points and usually does not pass through any of them. Both can predict a value at a new x, but they answer different questions. If your numbers are exact table values, interpolate. If they are noisy measurements, fitting a line or curve through all of them is usually better than trusting two noisy neighbors.

Forecasting goes a step further and estimates values beyond the discrete data you have, which is extrapolation, not interpolation. The method is the same formula, but the risk is much higher because nothing constrains the answer past the last point. A trend can turn, saturate or break entirely, as the battery example on this page shows with a negative percentage.
A good rule is to use the closest two points that bracket your x, keep the answer inside the data range when you can, and treat anything outside it as a rough estimate to be confirmed. If the gap between known points is wide or the curve bends sharply, add more known points or use a method that fits the shape.
Linear Interpolation in Spreadsheets and Code
In a spreadsheet, the two-point formula is =y1+(x-x1)*(y2-y1)/(x2-x1), with each name replaced by a cell reference. It is worth knowing that Excel's FORECAST.LINEAR function is not the same thing. Its documentation describes predicting a value by linear regression on all the known x and y values, so it fits one best-fit line through every point, and its answer will usually not match a two-point interpolation between your nearest points.

In Python, NumPy's interp function performs piecewise linear interpolation over a list of increasing x values. Be careful at the edges: by default, for an x below the first point or above the last point it returns the first or last y value, not an extrapolated one, unless you pass the left and right arguments. The x list must be increasing, and NumPy does not check this for you.
You can also write the interpolation yourself in one line: y1 + t × (y2 - y1), where t is the position between the points, from 0 to 1. This is the form often called lerp in graphics and game code, and it is the same formula the calculator uses. The table below summarizes how each tool behaves.
Reference Tables
| Signal (mA) | Temperature (°C) | Position between 4 and 20 mA |
|---|---|---|
| 4 | 0 | 0 |
| 8 | 25 | 0.25 |
| 12 | 50 | 0.5 |
| 16 | 75 | 0.75 |
| 20 | 100 | 1 |
| Spacing between points (h) | Error bound (h² / 8) |
|---|---|
| 1 | 0.125 |
| 0.5 | 0.03125 |
| 0.25 | 0.0078125 |
| 0.1 | 0.00125 |
| Method | What it needs | Use it when |
|---|---|---|
| Linear interpolation | Two points | Values change at a steady rate between the points |
| Bilinear interpolation | Four corner points on a grid | You are estimating a value on a two-variable table |
| Logarithmic interpolation | Two points, on a log scale | Values grow or fall by a steady ratio, not a steady amount |
| Polynomial or spline interpolation | Three or more points | The data curves between the points |
| Least-squares line | Many noisy points | Measurements contain error and should be smoothed |
| Pass | Points used | Look up | Result |
|---|---|---|---|
| 1. Along x on the y = 10 row | (1, 100) and (2, 200) | x = 1.25 | 125 |
| 2. Along x on the y = 20 row | (1, 300) and (2, 400) | x = 1.25 | 325 |
| 3. Along y between the two results | (10, 125) and (20, 325) | y = 12 | 165 |
| x | Linear estimate | Geometric estimate |
|---|---|---|
| 0 | 100 | 100 |
| 0.5 | 175 | 141.42 |
| 1 | 250 | 200 |
| 1.5 | 325 | 282.84 |
| 2 | 400 | 400 |
| Task | Uses | Passes through the data? | Risk |
|---|---|---|---|
| Interpolation | Two known points that bracket x | Yes, exactly | Low if the curve is gentle |
| Curve fitting | Many noisy points | Usually not | Depends on the model chosen |
| Forecasting | Past points, to estimate beyond them | Not applicable | Highest, since nothing limits the answer |
| Tool | Formula or function | What it does outside the data range |
|---|---|---|
| Excel or Sheets, two points | =y1+(x-x1)*(y2-y1)/(x2-x1) | Extrapolates along the same line |
| Excel FORECAST.LINEAR | =FORECAST.LINEAR(x, known_y's, known_x's) | Regression line through all points, not two-point interpolation |
| Python NumPy | np.interp(x, xp, fp) | Returns the first or last y value by default |
| Any language, lerp form | y1 + t * (y2 - y1) | Extrapolates if t is below 0 or above 1 |
Frequently Asked Questions About the Linear Interpolation Calculator
How do you calculate linear interpolation?
Take two known points, (x1, y1) and (x2, y2). The estimate at a new x is y = y1 + (x - x1) × (y2 - y1) / (x2 - x1). In words: find the slope between the points, multiply it by how far x is from x1, and add y1. For points (4, 0) and (20, 100) and x = 12, that is 0 + 8 × 6.25 = 50. Enter your own values above to see each step.
What is the linear interpolation formula?
The formula is y = y1 + (x - x1)(y2 - y1) / (x2 - x1), where (x1, y1) and (x2, y2) are the two known points and x is where you want the estimate. Solved for x instead, it is x = x1 + (y - y1)(x2 - x1) / (y2 - y1). It is the equation of the straight line through the two points, rearranged to give one value from the other.
How do I do linear interpolation on a calculator?
On any scientific calculator, including Casio and TI models, type the formula with brackets around each subtraction: (x - x1) × (y2 - y1) ÷ (x2 - x1) + y1. Without the brackets the calculator applies the wrong order of operations. Or skip the keystrokes: enter the two points and your x or y into the calculator above and it returns the answer with the working shown.
How do I manually interpolate between two values?
Find the slope by dividing the difference in y by the difference in x. Subtract x1 from your x to get the distance from the first point. Multiply the slope by that distance, then add y1. For x = 250 between (200, 15) and (300, 20), the slope is 0.05, the distance is 50, the product is 2.5, and 15 + 2.5 = 17.5.
How can I calculate interpolation online?
Enter your two known points and either an x or a y value into the calculator above, choose whether you are solving for y or x, and read the result. It shows the formula with your numbers substituted, the slope and intercept, and whether your value is interpolation or extrapolation. Nothing is stored or sent anywhere, and the calculation runs in your browser.
What is the difference between interpolation and extrapolation?
Interpolation estimates a value between two known points. Extrapolation estimates a value outside them, using the same formula. The arithmetic is identical, but extrapolation is less reliable, because nothing in your two points says the trend continues. The calculator flags which one you are doing in its steps, so a result outside the range does not go unnoticed.
Can I find x from y instead of y from x?
Yes. Set the first option above to find x from y. The calculator then uses the same line solved for x: x = x1 + (y - y1)(x2 - x1) / (y2 - y1). This needs y1 and y2 to be different, because a flat line gives the same y for every x and no single x can be found from it.
How accurate is linear interpolation?
It is exact for data that really is a straight line. For a curve, the worst-case error between two points h apart is h² / 8 times the largest value of the curve's second derivative. That means halving the spacing cuts the worst-case error to a quarter. With a curve whose second derivative never exceeds 1, points 0.1 apart give an error of at most 0.00125.
What is lerp in programming?
Lerp is short for linear interpolation. In graphics and games it is usually written lerp(a, b, t) = a + (b - a) × t, where t runs from 0 to 1. That is the same formula as here. The t in lerp equals (x - x1) / (x2 - x1), which is the position output the calculator shows between your two points.
How do I do linear interpolation in Excel?
Put x1 in A2, y1 in B2, x2 in A3, y2 in B3, and the new x in E2, then use =B2+(E2-A2)*(B3-B2)/(A3-A2). That is the interpolation formula written with cell references. To solve for x from a known y instead, use the version solved for x with the same cells. The calculator above gives the same answer and writes out each step.
Does this work for bilinear or trilinear interpolation?
No. This calculator interpolates along one straight line through two points. Bilinear interpolation estimates a value on a grid using four corner points, and trilinear does the same in three dimensions. You can do bilinear by hand with three linear interpolations: two along x on the two rows, then one between those results along y.
What if x1 and x2 are the same?
Then the two points sit on a vertical line and the slope is undefined, because the formula divides by x2 - x1, which is zero. The calculator stops and tells you so rather than showing a wrong number. Check that your two points have different x values. If they share an x value but have different y values, the data is not a function of x.
What does the position between the points mean?
It is the fraction of the way from the first point to the second, calculated as (x - x1) / (x2 - x1). A value of 0 means you are at the first point, 1 means the second point, and 0.5 means exactly halfway. A value below 0 or above 1 means your x is outside the two points, so the result is extrapolation.
Is linear interpolation the same as a line equation?
It uses the same line. Linear interpolation finds the straight line through your two points, with slope m = (y2 - y1) / (x2 - x1) and intercept b = y1 - m × x1, and reads a value off it. The calculator shows m and b in the results, so you can write the line as y = mx + b and use it for any other x.
How do I interpolate on a TI-84 or TI-36X Pro?
On a TI-84 or a TI-36X Pro you type the formula in yourself: (x - x1) × (y2 - y1) ÷ (x2 - x1) + y1, with brackets around each subtraction and your numbers in place of the names. Then press enter. For a known y, use the version solved for x. Models differ, so check your own manual, or enter your points into the calculator above and compare the answer.
What is the linear interpolation formula in statistics?
It is the same formula, y = y1 + (x - x1)(y2 - y1) / (x2 - x1). In statistics it is often used to estimate a value that falls between two ordered data points, such as a percentile that lands between two ranked values. For example, if the 6th value in a sorted list is 40 and the 7th is 48, a point a quarter of the way between them is 40 + 0.25 × (48 − 40) = 42.
What is logarithmic interpolation?
It is interpolation done on logarithms instead of raw numbers. Take the log of x, or of y, or both, interpolate in a straight line on that scale, then convert back. It suits data that spans orders of magnitude or changes by constant ratios. You can do it here by entering the log values as your points.
What is the difference between interpolation and curve fitting?
Interpolation passes exactly through the known data points and estimates values between them. Curve fitting finds one smooth line or curve that follows the overall trend of many points and usually does not pass through any of them. Use interpolation for exact table values, and fitting for noisy measurements.
How do I interpolate in Python with NumPy?
Use np.interp(x, xp, fp), where xp is an increasing list of known x values and fp is the matching y values. It returns piecewise linear estimates. For an x outside the data it returns the first or last y value by default, not an extrapolated one, unless you pass the left and right arguments.
Is Excel FORECAST.LINEAR the same as linear interpolation?
No. Microsoft describes FORECAST.LINEAR as predicting a value by linear regression on all known x and y values, so it fits one best-fit line through every point. Linear interpolation uses only the two points on either side of x. The two answers match only when all the data already lies on one straight line.
Can I use linear interpolation to forecast future values?
You can use the same formula to extrapolate beyond your last data point, but the result is a rough projection and not a reliable forecast. Nothing limits the answer outside the data, and trends can turn or saturate. Treat extrapolated numbers as estimates to be checked against new data.
How do I interpolate on a table with two variables?
Use bilinear interpolation, which is three linear interpolations. Interpolate along x on each of the two bracketing rows, then interpolate between those two results along y. You can run this calculator three times to do it. The example on this page works through all three passes.
References
- [1] Wikipedia contributors. “Linear interpolation.” Wikipedia. Accessed 2026-10-04.
- [2] Atkinson, University of Iowa. “Error in Linear Interpolation (course overheads, section 4.2).” University of Iowa, Elementary Numerical Analysis materials. Accessed 2026-10-04.
- [3] A. T. Patera and M. Yano. “Interpolation (Math, Numerics, and Programming for Mechanical Engineers).” MIT OpenCourseWare, 2.086. Accessed 2026-10-04.
- [4] NumPy Developers. “numpy.interp.” NumPy Manual. Accessed 2026-10-04.
- [5] Microsoft. “FORECAST and FORECAST.LINEAR functions.” Microsoft Support. Accessed 2026-10-04.
Related calculators
- Amps to Kilowatts CalculatorConvert amps to kilowatts for DC, single-phase and three-phase circuits, with power factor, kVA, kWh per day or month and an optional energy cost.Open
- Binomial Distribution CalculatorBinomial distribution calculator. Enter trials, success probability and successes for exact, at most, at least and between probabilities, plus mean.Open
- Box Plot CalculatorBox plot calculator with steps: get Q1, median, Q3, whiskers, fences and outliers from data or five numbers, with a text box and whisker plot.Open
- Boyle's Law CalculatorBoyle's law calculator: solve P1 V1 = P2 V2 for pressure or volume in atm, kPa, bar, mmHg, psi, L, mL or m3, with gauge pressure and examples.Open
