Linear Interpolation Calculator

Find a missing data point between two known points, or blend two values with a t factor.

Enter two known points and the x value you want the y for.

This calculator runs entirely in your browser. Nothing you type is uploaded.

How to use this tool

Pick the mode that matches what you have. If you know two points and want to fill in a value between them, use Two points (x, y): enter the first point (x0, y0), the second point (x1, y1), and the x value you want a y for. If instead you just want to blend one number toward another by some fraction, use Lerp by factor (t): enter your start value a, your end value b, and a factor t between 0 and 1. Press Calculate to see the result, then use Copy result to grab it.

The lerp formula

Linear interpolation assumes the values change at a steady rate between the two known points, so it draws a straight line between them and reads off the point you ask for. The classic two-point form to find a missing data point is:

y = y0 + (x - x0) * (y1 - y0) / (x1 - x0)

The factor form, common in graphics and animation, blends two values using a number t:

lerp(a, b, t) = a + (b - a) * t

The two are the same idea. In the two-point version, t is simply the position of x inside the interval, found with t = (x - x0) / (x1 - x0). When t is 0 you land on the first value, when t is 1 you land on the second, and 0.5 gives you the exact midpoint.

A real example

Suppose a temperature log shows 100 at x = 10 and 200 at x = 20, and you need the value at x = 14. Plug it in: y = 100 + (14 - 10) * (200 - 100) / (20 - 10) = 100 + 4 * 100 / 10 = 100 + 40 = 140. Here x = 14 sits 40 percent of the way through the interval, so t = 0.4, and the answer is 40 percent of the way from 100 to 200.

Common questions

What does this linear interpolation calculator (lerp) actually do?

It estimates a value that falls between two known data points by assuming a straight line connects them. Give it two points and a target x, and it returns the matching y. It can also blend two numbers with a simple t factor.

How do I find a missing data point with it?

Use the two-point mode. Enter the point before the gap as (x0, y0), the point after the gap as (x1, y1), and the x where the value is missing. The tool returns the interpolated y for that x.

What is the interpolation interval and t factor?

The interval is the span between x0 and x1. The t factor is how far along that interval your point sits, from 0 at the start to 1 at the end. A t of 0.25 means a quarter of the way, so the result is a quarter of the way between the two values.

Can I extrapolate beyond the two points?

Yes. If x is outside the range of x0 and x1 (or t is below 0 or above 1), the same lerp formula still applies and the tool will return a value. Just remember that going outside the known range is extrapolation and can be far less reliable.

Why do I get an error or no answer?

The two-point mode needs x0 and x1 to be different, otherwise the interval is zero and the formula divides by zero. Make sure every field has a real number and that x0 does not equal x1.