Bilinear Interpolation Calculator

Estimate a value at (x, y) inside a rectangle from the values at its four corners, with the two intermediate linear interpolations shown as steps.

Must differ from x₁.
Must differ from y₁.

Results

Value at (4, 5)
21
Step 1: interpolate along the bottom edge (y = 0)
14
10 + 0.4 × (20 − 10)
Step 2: interpolate along the top edge (y = 20)
42
30 + 0.4 × (60 − 30)
Step 3: interpolate between those two in the y direction
14 + 0.25 × (42 − 14) = 21
Position of the point
Inside the rectangle: interpolated.

How it’s calculated

Bilinear interpolation estimates a value at a point inside a rectangle when you know the value at all four corners. It is two rounds of ordinary linear interpolation: first along x on the bottom and top edges, then along y between those two results. Doing y first gives exactly the same answer.

R₁ = f(x₁,y₁) + (x − x₁)/(x₂ − x₁) × [f(x₂,y₁) − f(x₁,y₁)] R₂ = f(x₁,y₂) + (x − x₁)/(x₂ − x₁) × [f(x₂,y₂) − f(x₁,y₂)] f(x,y) = R₁ + (y − y₁)/(y₂ − y₁) × (R₂ − R₁)

Example: corners 10, 20 (bottom) and 30, 60 (top) on a 10 by 20 rectangle, point (4, 5). Along the bottom, R₁ = 10 + 0.4 × 10 = 14. Along the top, R₂ = 30 + 0.4 × 30 = 42. Then f = 14 + 0.25 × (42 − 14) = 21.

Typical uses are reading a two-way table (for example a value that depends on temperature and pressure) and resampling images.

Frequently asked questions

Does it matter whether I interpolate x or y first?

No. For bilinear interpolation both orders give the same answer.

Is the result a flat plane?

Not quite. Along any horizontal or vertical line the result is straight, but the surface between four corners can curve, because it contains an x·y term.

What if my point is outside the rectangle?

The same formula still works, but it is then extrapolation and the calculator says so. Treat the answer with caution.

Do the corners have to be in a particular order?

No. Enter each corner value next to its own x and y. Swapping x₁ and x₂ (and their values) gives the same result.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator