What this calculator does
Bilinear interpolation estimates a value at a point inside a rectangle when only the four corners are known. It works by interpolating linearly along one axis twice, then interpolating between those two results along the other axis. Doing it in the other order gives an identical answer, which is a useful property and not an obvious one.
The name suggests a flat plane through the corners, and that is the common misreading. The result is linear along either axis taken on its own, but the surface as a whole is curved, because it carries a cross term in xy. Four corner values will not usually lie on a plane at all, and bilinear interpolation is what fits them smoothly without one.
The formula
Each of the four corner values is weighted by the area of the rectangle diagonally opposite the corner it sits on, and the weighted values are added and divided by the total area of the cell. A target point near one corner therefore takes most of its value from that corner. The calculator rejects any target point outside the grid rather than extrapolating, since the weights turn negative beyond the corners and the result stops being an interpolation.
| Term | Meaning |
|---|---|
| Q11, Q21, Q12, Q22 | The known values at the four corners, indexed by which x and which y they sit on. |
| Target point | The position (x, y) inside the rectangle where a value is wanted. |
| Cross term | The xy component that makes the interpolated surface curved rather than flat. |
| Extrapolation | Estimating outside the known corners, which this calculator declines to do because the weighting breaks down there. |
The inputs explained
| Field | What to enter |
|---|---|
| x1 | The lower x edge of the grid cell. |
| x2 | The upper x edge. It must differ from x1. |
| y1 | The lower y edge of the grid cell. |
| y2 | The upper y edge. It must differ from y1. |
| Value at (x1, y1) | The known value at the corner (x1, y1). |
| Value at (x2, y1) | The known value at the corner (x2, y1). |
| Value at (x1, y2) | The known value at the corner (x1, y2). |
| Value at (x2, y2) | The known value at the corner (x2, y2). |
| Target x | The x coordinate of the target point, which must fall between x1 and x2. |
| Target y | The y coordinate of the target point, which must fall between y1 and y2. |
When to use it
Reading a value from a two-way table
Engineering and thermodynamic tables are indexed by two variables, and the value wanted usually falls between printed rows and columns. The four surrounding entries are exactly the four corners this calculation needs.
Resampling an image or a height map
Scaling an image or sampling terrain elevation between grid points is bilinear interpolation applied at every output pixel. It is the standard step up from nearest-neighbour sampling and it removes most of the blockiness at very little cost.
Estimating between measurement points on a grid
Readings taken across a regular grid, such as temperature or signal strength at fixed stations, can be filled in between stations this way, provided the quantity varies smoothly enough for the assumption to be reasonable.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How does the interpolated value change along the bottom edge?
The target point swept across the cell at y = 0, the lower edge, where the corner values are 20 and 30.
Is the interpolated surface flat?
An identical sweep across x, moved to the opposite edge of the same cell, where the corner values are 40 and 60.
Questions
Is bilinear interpolation the same as fitting a plane through the corners?
No, and four arbitrary corner values will not lie on a plane anyway. The result is linear along each axis separately but carries an xy cross term, which makes the surface a curved one known as a hyperbolic paraboloid.
Does the order of interpolation matter?
No. Interpolating along x first and then y gives exactly the same result as y first and then x. The symmetry falls straight out of the weighting, and it is a useful check when implementing the calculation.
What happens if the target point is outside the grid?
That would be extrapolation rather than interpolation, and this calculator declines it. Outside the corners some of the weights go negative and the result can fall well outside the range of the four known values, which is rarely what anyone wants.
When should I use bicubic interpolation instead?
When smoothness across cell boundaries matters. Bilinear is continuous but its slope jumps at the edges between cells, which shows up as visible banding on smooth gradients. Bicubic uses a wider neighbourhood to match slopes as well as values, at a higher cost.
For interpolating between just two points along a single axis, see the linear interpolation calculator. For numerically integrating a function from sampled values, see the trapezoidal rule calculator.