Interpolation Calculator

About this calculator

Estimate a value from two endpoints or four corners of a rectangular grid. See the exact weights and whether the target is inside the entered range.

Example: find the value at (2, 5) inside a four-corner grid.

X coordinates
Y coordinates
Grid corner values

Use two x coordinates and two y coordinates from a rectangular grid. Keep each value with its labeled corner.

Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

How to calculate linear interpolation

Enter two distinct x coordinates and the value at each one. Compute the fraction of the way from the first x to the second. Use that fraction as the weight of the second value. The first value gets the remaining weight.

t = (x − x₀) ÷ (x₁ − x₀). Estimated value = (1 − t) × z₀ + t × z₁.

If the values at x = 0 and x = 10 are 10 and 20, then x = 2 is one fifth of the way from the first endpoint. The estimate is 12.

How to calculate bilinear interpolation from four corners

Use two x coordinates and two y coordinates that form a rectangle. Keep each value with its labeled corner. Set t = (x − x₀) ÷ (x₁ − x₀) and u = (y − y₀) ÷ (y₁ − y₀). The four weights are (1 − t)(1 − u), t(1 − u), (1 − t)u and tu, respectively.

This follows from applying the same one-axis interpolation on both x edges, then interpolating those results along y. The NIST Dataplot documentation describes bilinear interpolation as a weighted average of four surrounding points on a complete rectangular grid.

For x endpoints 0 and 10, y endpoints 0 and 20, and corner values 10, 20, 30 and 50 at (0,0), (10,0), (0,20) and (10,20), the target (2,5) has weights 3/5, 3/20, 1/5 and 1/20. The estimate is 17.5.

Interpolation versus extrapolation

The target can fall inside, on the boundary or outside. Outside values require enabling extrapolation. That calculation continues the same formula, which can give negative weights and values outside the range of the inputs.

Each axis can run in either direction if its values stay attached to the correct coordinates. Repeated endpoints leave the interval width at zero and are rejected. The worksheet uses the entered rectangular grid or interval. It does not fit curves or interpolate scattered points.

Frequently asked questions

Can I enter the larger endpoint first?
Yes. Keep each endpoint or corner value paired with the coordinate labels you entered. The weights follow the selected order.
What happens at an exact grid corner?
The weight of that corner is 1 and all other weights are 0, so the estimate equals that corner value.
What if the target lies outside the supplied range?
Enable extrapolation to extend the formula. The result is labeled extrapolated, and the weights can be negative.
Does this calculate interpolation from scattered data?
The supported methods are a two-endpoint interval and one complete four-corner rectangular grid cell.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.