In photography, bokeh ( BOH-kay) (Japanese: [boke]) is the aesthetic quality of the blur produced in the out-of-focus parts of an image produced by a lens. Bokeh has been defined as "the way the lens renders out-of-focus points of light". Differences in lens aberrations and aperture shape cause some lens designs to blur the image in a way that is pleasing to the eye, while others produce blurring that is unpleasant or distracting ("good" and "bad" bokeh, respectively). Bokeh occurs for parts of the scene that lie outside the depth of field. Photographers sometimes deliberately use a shallow focus technique to create images with prominent out-of-focus regions.
Bokeh is often most visible around small background highlights, such as specular reflections and light sources, which is why it is often associated with such areas. However, bokeh is not limited to highlights; blur occurs in all out-of-focus regions of the image.
The term comes from the Japanese word boke ( or ), which means "blur" or "haze", or boke-aji (), the "blur quality". The Japanese term boke is also used in the sense of a mental haze or senility. The term bokashi () is related, meaning intentional blurring or gradation.
The English spelling bokeh was popularized in 1997 in Photo Techniques magazine, when Mike Johnston, the editor at the time, commissioned three papers on the topic for the March/April 1997 issue; he altered the spelling to suggest the correct pronunciation to English speakers, saying "it is properly pronounced with bo as in bone and ke as in Kenneth, with equal stress on either syllable". The spellings bokeh and boke have both been in use since at least 1996, when Merklinger had suggested "or Bokeh if you prefer." The term bokeh has appeared in photography books as early as 1998. It is sometimes pronounced (boke-uh).
Though difficult to quantify, some lenses have subjectively more pleasing out-of-focus areas. "Good" bokeh is especially important for macro lenses and long telephoto lenses, because they are typically used in situations that produce shallow depth of field. Good bokeh is also important for medium telephoto lenses (typically 85-150 mm on 35 mm format). When used in portrait photography (for their "natural" perspective), the photographer usually wants a shallow depth of field, so that the subject stands out sharply against a blurred background.
Bokeh characteristics may be quantified by examining the image's circle of confusion. In out-of-focus areas, each point of light becomes an image of the aperture, generally a more or less round disc. Depending on how a lens is corrected for spherical aberration, the disc may be uniformly illuminated, brighter near the edge, or brighter near the center. A well-known lens that exhibited the latter "soap-bubble" characteristic was that produced by Hugo Meyer & Co., more recently revived by Meyer Optik Görlitz.
Lenses that are poorly corrected for spherical aberration will show one kind of disc for out-of-focus points in front of the plane of focus, and a different kind for points behind. This may actually be desirable, as blur circles that are dimmer near the edges produce less-defined shapes which blend smoothly with the surrounding image. The shape of the aperture has an influence on the subjective quality of bokeh as well. For conventional lens designs (with bladed apertures), when a lens is stopped down smaller than its maximum aperture size (minimum f-number), out-of-focus points are blurred into the polygonal shape formed by the aperture blades. This is most apparent when a lens produces hard-edged bokeh. For this reason, some lenses have many aperture blades and/or blades with curved edges to make the aperture more closely approximate a circle rather than a polygon. Minolta has been on the forefront of promoting and introducing lenses with near-ideal circular apertures since 1987, but most other manufacturers now offer lenses with shape-optimized diaphragms, at least for the domain of portraiture photography. In contrast, a catadioptric telephoto lens renders bokehs resembling doughnuts, because its secondary mirror blocks the central part of the aperture opening. Recently, photographers have exploited the shape of the bokeh by creating a simple mask out of card with shapes such as hearts or stars, that the photographer wishes the bokeh to be, and placing it over the lens.
Lenses with 11, 12, or 15 blade iris diaphragms are often claimed to excel in bokeh quality. Because of this, the lenses do not need to reach wide apertures to get better circles (instead of polygons). In the past, wide aperture lenses (f/2, f/2.8) were very expensive, due to the complex mathematical design and manufacturing know-how required, at a time when all computations and glass making were done by hand. Leica could reach a good bokeh at f/4.5. Today it is much easier to make an f/1.8 lens, and a 9-bladed lens at f/1.8 is enough for an 85mm lens to achieve great bokeh.
The Nikon 105 mm DC-Nikkor and 135 mm DC-Nikkor lenses (DC stands for "Defocus Control") have a control ring that permits the overcorrection or undercorrection of spherical aberration to change the bokeh in front of and behind the focal plane.
The Minolta/Sony STF 135mm f/2.8 [T4.5] (with STF standing for smooth trans focus) is a lens specifically designed to produce pleasing bokeh. It is possible to choose between two diaphragms: one with 9 and another with 10 blades. An apodization filter is used to soften the aperture edges which results in a smooth defocused area with gradually fading circles. Those qualities made it the only lens of this kind on the market from its introduction in 1999 to 2014. In 2014 Fujifilm announced a lens utilizing a similar apodization filter in the Fujinon XF 56mm F1.2 R APD lens. Sony added the Sony FE 100mm F2.8 STF GM OSS in 2017.
The 'Sigma YS System Focusing' 135mm f/2.8 also has an extra manually-moved component, intended to compensate for aberration at close-focus distances. It can be re-purposed for defocus control. 
In 2015, Meyer Optik USA Inc. launched a Kickstarter campaign to produce the Trioplan f2.9/50, a new lens based on one originally produced by Hugo Meyer & Co.; both lenses exhibit a characteristic "soap-bubble" bokeh.
The use of anamorphic lenses will cause bokeh to appear differently along the horizontal and vertical axes of the lens, becoming ellipsoidal compared to those in a spherical lens.
In 2016, Apple Inc. released the iPhone 7 Plus which can take pictures with "Portrait Mode" (a bokeh like effect). Samsung's Galaxy Note 8 has a similar effect available. Both of these phones use dual cameras to detect edges and create a "depth map" of the image, which the phone uses to blur the out-of-focus portions of the photo. Other phones, like the Google Pixel, only use a single camera and machine learning to create the depth map.
In 2017, Vivo released a smartphone with dual front lenses for selfies with bokeh. The first, a 20 MP lens, uses a 1/2.78" sensor with f/2.0 aperture, while the second, an 8 MP f/2.0 lens, captures depth information. Bokeh can be made with a combination of both lenses, and shots can be refocused even after they are captured, adding bokeh effects with different depths.
In early 2018, the Honor 9 Lite smartphone was released with quad cameras (two dual-lens). Both the front and back cameras have a 13MP main lens and a 2MP lens for capturing bokeh depth information.
200 mm lens at f/2.
The bokeh produced by a catadioptric lens (also called a mirror lens).
An example of the bokeh produced by the Canon 85 mm prime f/1.8 lens. The polygonal shapes are due to the 8-bladed aperture diaphragm being slightly closed. At its full aperture (f/1.8) these shapes would be smooth and not polygonal.
Catadioptric lens bokeh seen in more detail.
Bokeh can be simulated by convolving the image with a kernel that corresponds to the image of an out-of-focus point source taken with a real camera. Unlike conventional convolution, this convolution has a kernel that depends on the distance of each image point and - at least in principle - has to include image points that are occluded by objects in the foreground. Also, bokeh is not just any blur. To a first approximation, defocus blur is convolution by a uniform disk, a more computationally intensive operation than the "standard" Gaussian blur; the former produces sharp circles around highlights whereas the latter is a much softer effect. Diffraction may alter the effective shape of the blur. Some graphics editors have a filter to do this, usually called "Lens Blur."
An alternative mechanical mechanism has been proposed for generating bokeh in small aperture cameras such as compacts or cellphone cameras, called image destabilisation, in which both the lens and sensor are moved in order to maintain focus at one focal plane, while defocusing nearby ones. This effect currently generates blur in only one axis.
Some advanced digital cameras have bokeh features which take several images with different apertures and focuses and then manually compose them afterward to one image. More advanced systems of bokeh use a hardware system of 2 sensors, one sensor to take photo as usual while other ones record depth information. Bokeh effect and refocusing can then be applied to an image after the photo is taken.
In 2009, a research group at MIT Media Lab showed that the bokeh effect can be used to make imperceptibly small barcodes, or bokodes. By using barcodes as small as 3 mm with a small lens over them, if the barcode is viewed out of focus through an ordinary camera focused at infinity, the resulting image is large enough to scan the information in the barcode.