A **bilateral filter** is a non-linear, edge-preserving, and noise-reducing smoothing filter for images. It replaces the intensity of each pixel with a weighted average of intensity values from nearby pixels. This weight can be based on a Gaussian distribution. Crucially, the weights depend not only on Euclidean distance of pixels, but also on the radiometric differences (e.g., range differences, such as color intensity, depth distance, etc.). This preserves sharp edges.

The bilateral filter is defined as^{[1]}^{[2]}

and normalization term, , is defined as

where

- is the filtered image;
- is the original input image to be filtered;
- are the coordinates of the current pixel to be filtered;
- is the window centered in , so is another pixel;
- is the range kernel for smoothing differences in intensities (this function can be a Gaussian function);
- is the spatial (or domain) kernel for smoothing differences in coordinates (this function can be a Gaussian function).

The weight is assigned using the spatial closeness (using the spatial kernel ) and the intensity difference (using the range kernel ).^{[2]} Consider a pixel located at that needs to be denoised in image using its neighbouring pixels and one of its neighbouring pixels is located at . Then, assuming the range and spatial kernels to be Gaussian kernels, the weight assigned for pixel to denoise the pixel is given by

where σ_{d} and σ_{r} are smoothing parameters, and *I*(*i*, *j*) and *I*(*k*, *l*) are the intensity of pixels and respectively.

After calculating the weights, normalize them:

where is the denoised intensity of pixel .

- As the range parameter σ
_{r}increases, the bilateral filter gradually approaches Gaussian convolution more closely because the range Gaussian widens and flattens, which means that it becomes nearly constant over the intensity interval of the image. - As the spatial parameter σ
_{d}increases, the larger features get smoothened.

The bilateral filter in its direct form can introduce several types of image artifacts:

- Staircase effect – intensity plateaus that lead to images appearing like cartoons
^{[3]} - Gradient reversal – introduction of false edges in the image.
^{[4]}

There exist several extensions to the filter that deal with these artifacts, like the scaled bilateral filter that uses downscaled image for computing the weights.^{[5]} Alternative filters, like the *guided filter*,^{[6]} have also been proposed as an efficient alternative without these limitations.

Adobe Photoshop implements a bilateral filter in its *surface blur* tool. GIMP implements a bilateral filter in its *Filters → Blur* tools; and it is called *Selective Gaussian Blur*. The free G'MIC plugin *Repair → Smooth [bilateral]* for GIMP adds more control.^{[7]}
A simple trick to efficiently implement a bilateral filter is to exploit Poisson-disk subsampling.^{[1]}

The bilateral filter has been shown to be an application of the short time kernel of the Beltrami flow
^{[8]}
^{[9]}
^{[10]} that was introduced as an edge preserving selective smoothing mechanism before the bilateral filter.

Other edge-preserving smoothing filters include: anisotropic diffusion,^{[11]} weighted least squares,^{[12]} edge-avoiding wavelets,^{[13]} geodesic editing,^{[14]} guided filtering,^{[15]} iterative guided filtering ^{[16]} and domain transforms.^{[17]}