Skip to content
Math

Bilinear Interpolation Calculator

Enter the four corners of a rectangular grid cell (x1, x2, y1, y2), their known function values at each corner (Q11, Q12, Q21, Q22), and the target point (x, y). The calculator estimates the function value at that point using bilinear interpolation and shows every step of the two-stage linear calculation so you can follow the maths exactly.

Your details

The smaller x-coordinate of the rectangle. Must be less than x2.
The larger x-coordinate of the rectangle. Must be greater than x1.
The smaller y-coordinate of the rectangle. Must be less than y2.
The larger y-coordinate of the rectangle. Must be greater than y1.
Known function value at the bottom-left corner (x1, y1).
Known function value at the bottom-right corner (x2, y1).
Known function value at the top-left corner (x1, y2).
Known function value at the top-right corner (x2, y2).
The x-coordinate of the point where you want to estimate the value. Must lie between x1 and x2.
The y-coordinate of the point where you want to estimate the value. Must lie between y1 and y2.
Interpolated value P(x, y)
4

Estimated function value at the target point, computed by bilinear interpolation.

R1 - interpolated at (x, y1)9
R2 - interpolated at (x, y2)-1
Weight on x1 side0.75
Weight on x2 side0.25
R1 at y1 (bottom edge)9
R2 at y2 (top edge)-1
P(x, y) final result4

Interpolated value at (1, 2): P = 4

  • The target point (1, 2) lies 25.0% of the way from x1 to x2 and 50.0% of the way from y1 to y2.
  • Corner values range from -4 to 12; the interpolated result 4 falls within that range.
  • Bilinear interpolation is exact at all four corners and varies linearly along any horizontal or vertical line through the cell.

Next stepFor higher accuracy over larger regions, consider subdividing the grid into smaller cells and re-applying bilinear interpolation within each cell.

Formula

R1=x2xx2x1Q11+xx1x2x1Q21,R2=x2xx2x1Q12+xx1x2x1Q22,P=y2yy2y1R1+yy1y2y1R2R_1 = \frac{x_2-x}{x_2-x_1}Q_{11}+\frac{x-x_1}{x_2-x_1}Q_{21}, \quad R_2 = \frac{x_2-x}{x_2-x_1}Q_{12}+\frac{x-x_1}{x_2-x_1}Q_{22}, \quad P = \frac{y_2-y}{y_2-y_1}R_1+\frac{y-y_1}{y_2-y_1}R_2

Worked example

Corners: Q11 = 12 at (0,1), Q21 = 0 at (4,1), Q12 = -4 at (0,3), Q22 = 8 at (4,3). Target: (1, 2). Step 1a: R1 = (3/4)*12 + (1/4)*0 = 9. Step 1b: R2 = (3/4)*(-4) + (1/4)*8 = -1. Step 2: P = (1/2)*9 + (1/2)*(-1) = 4.

What is bilinear interpolation?

Bilinear interpolation estimates the value of a function at an arbitrary point (x, y) inside a rectangular grid cell, given that the function is known at the four corners of that cell. The method performs two separate one-dimensional linear interpolations: first horizontally along the bottom edge of the rectangle, then along the top edge, producing two intermediate values (R1 and R2). A final linear interpolation in the vertical direction between R1 and R2 gives the answer. Despite its two-step linear construction, the result is actually bilinear, meaning it is linear in x and linear in y but contains a cross-product term x*y that makes it mildly curved overall. This makes bilinear interpolation a natural extension of simple linear interpolation to two dimensions.

How to use this calculator

Fill in the four grid boundaries (x1, x2, y1, y2) and the function values at the four corners (Q11, Q12, Q21, Q22), then enter the target coordinates (x, y) where you need the estimate. The naming convention follows the standard mathematical notation: Q11 is the value at (x1, y1) - the bottom-left corner; Q21 is at (x2, y1) - bottom-right; Q12 is at (x1, y2) - top-left; Q22 is at (x2, y2) - top-right. The target point must lie inside the rectangle (between x1 and x2 horizontally, and between y1 and y2 vertically). The result panel shows the final interpolated value P as well as the two intermediate values R1 and R2, and the step-by-step panel walks through every multiplication and addition so you can verify the working or copy the method into your own code.

The bilinear interpolation formula

Let dx = x2 - x1 and dy = y2 - y1. The x-axis weights are wX1 = (x2 - x) / dx and wX2 = (x - x1) / dx. Step 1 produces two intermediate values: R1 = wX1 * Q11 + wX2 * Q21 (along the bottom edge at y = y1) and R2 = wX1 * Q12 + wX2 * Q22 (along the top edge at y = y2). The y-axis weights are wY1 = (y2 - y) / dy and wY2 = (y - y1) / dy. Step 2 gives the final estimate: P = wY1 * R1 + wY2 * R2. This is equivalent to the compact matrix form P = (1 / (dx * dy)) * [x2-x, x-x1] * [[Q11, Q12],[Q21, Q22]] * [y2-y; y-y1], which is how many numerical libraries implement it.

Properties, accuracy, and alternatives

Bilinear interpolation is exact at the four corners and exact along any horizontal or vertical line through the cell. The cross-product term x*y makes it slightly curved along diagonals, which gives better accuracy than nearest-neighbour interpolation but introduces a mild smoothing effect. For very smooth functions the error scales as O(h^2) where h is the grid spacing, the same order as linear interpolation in 1D. When you need higher accuracy, bicubic interpolation uses a 4x4 neighbourhood instead of 2x2 and achieves O(h^4) convergence at the cost of needing derivatives at the corners. For scattered (non-grid) data, methods such as natural-neighbour or radial-basis interpolation are better choices. Bilinear interpolation is preferred in real-time applications such as texture mapping and image resizing because it is fast, reversible, and needs only the nearest four samples.

Common applications of bilinear interpolation

FieldTypical gridWhat is interpolated
Digital image processingPixel grid (integer coordinates)Colour or intensity at sub-pixel position
GIS / terrain modellingLatitude-longitude gridElevation, temperature, or rainfall
Computational fluid dynamicsMesh nodesVelocity, pressure, or density
Engineering lookup tablesTwo-parameter design chartMaterial property, efficiency, or load rating
Weather / climate dataRegular lat-long gridWind speed, humidity, or pressure at a sensor location
Finite-element post-processingElement nodesStress, strain, or displacement inside an element

Bilinear interpolation appears across science, engineering, and computing wherever 2D grid data must be sampled at non-grid locations.

Frequently asked questions

What inputs does bilinear interpolation need?

You need four things: the coordinates of the rectangle corners (x1, x2, y1, y2), the function value at each of the four corners (Q11, Q12, Q21, Q22), and the target point (x, y) where you want an estimate. The target must lie inside the rectangle. If it falls outside, you are extrapolating, which bilinear interpolation does not guarantee to be accurate.

Is bilinear interpolation the same as linear interpolation?

No, but it is built from two successive linear interpolations. Standard linear interpolation works in one dimension (along a line segment). Bilinear interpolation extends that idea to two dimensions by first interpolating horizontally at two y-levels, then interpolating vertically between those results. The overall function is linear in x alone and linear in y alone, but the combination produces a surface with a mild curvature due to the x*y cross term.

Does the order of the two interpolation passes matter?

No. You can interpolate first along x then along y, or first along y then along x. Both orderings produce the same final answer because the underlying formula is symmetric in x and y. This calculator uses the horizontal-first convention (x first, then y), but the result would be identical if the vertical pass were done first.

Why does the result sometimes fall outside the range of the corner values?

Bilinear interpolation is not guaranteed to stay within the range of the corner values. When the function has a saddle-shaped variation over the cell - the corners at opposite ends of a diagonal are large while the other two are small - the bilinear surface can produce values outside the corner range at some interior points. This is a property of the x*y cross term in the formula. If you need a monotone or bounded interpolant, consider alternative methods such as shape-preserving Hermite interpolation.

How is bilinear interpolation used in image processing?

When an image is scaled, rotated, or warped, the destination pixel coordinates rarely fall exactly on source pixel centres. Bilinear interpolation estimates the colour at the fractional source position using the four nearest pixel values as the corners. Compared with nearest-neighbour resampling, bilinear gives smoother results without the blocky artefacts, and compared with bicubic it runs faster, making it a popular default in many image-editing applications.

What happens if the target point is exactly on a corner or edge?

If the target falls exactly on one of the four corners, the result equals that corner value exactly - no approximation is involved. If the target lies on an edge (one coordinate equals a boundary), the formula reduces to a single linear interpolation between the two corner values on that edge. The formula handles both cases correctly without any special casing.

Sources

Written by Dr. Rajiv Menon, PhD Applied Mathematician · Bengaluru, India

Applied mathematician bridging algebraic theory and computational tools for students, engineers, and everyday problem-solvers.

Search 3,500+ calculators

Loading search…