the math of bokeh

If you don’t know (yet) what bokeh is, check out the Wikipedia article. In short, bokeh is the blur (or quality thereof) of out-of-focus regions in a photograph. This post is not about the perceived quality of such blur, but rather of its size. For bokeh, more is usually better, since it allows to separate an object in focus nicely from the blurred background. For the calculations that follow, we will look at the size of the image of point originating far behind an object of interest in the picture. To make the calculations easier, that point is assumed to be infinitely far away – the difference to points which are finitely but significantly far behind the object will be negligible.

Bokeh lights in San Diego’s Gaslamp Quarter, taken with a Sony DSC-R1 at 69.8mm with f/4.8 and focused to the near limit of about 50cm.


The disks in Figure 1 are essentially the images of point sources located a long distance away and are used here to illustrate the bokeh effect. In a “regular” photograph, each point in the background of the scene is convolved with the shape of the bokeh disk and superposed with the disks from all other background points, just like the overlapping disks in Figure 1. The result is a more or less blurred background which nicely isolates an in-focus foreground. The larger the bokeh disk, the more pronounced the blur effect and foreground isolation will be. For lots of great examples, check out flickr’s Bokeh – Smooth & Silky picture pool.

Calculating the expected size of bokeh disks – and thus the strength of the bokeh effect – is not at all that hard. The only formula from optics that we need is the thin lens formula

$$\frac{1}{f} = \frac{1}{a} + \frac{1}{b} \tag{1}$$

where $f$ is the focal length of the lens, $a$ is the object distance, and $b$ is the image distance. The rest is just basic trigonometry. We will assume a thin lens throughout to make our life easier. However, the results then will only hold for $a \gg f$, since otherwise the geometry of the lens becomes relevant. Therefore, macro photography is not covered by this post.

The above quantities and a few more are shown in Figure 2. Here, $\Delta b$ is the difference in image distance between an object at distance $a$ and one at infinity, as can be determined using (1) – for the object at infinity, $b = f$. Furthermore, $A$ is the (absolute) aperture size of the lens, as related to its f-number $N_f$ by $A = f / N_f$, $w$ is the size of the sensor, and $d$ is the diameter of the bokeh disk on the sensor.

Figure 2: Basic quantities for bokeh calculations:
$a$ – object distance
$b$ – image (sensor) distance
$f$ – focal length
$A$ – lens aperture
$w$ -sensor size
$d$ – size of bokeh disk

Now from Figure 2 we have (red ray)

$$d = \Delta b \frac{A}{f} = \frac{\Delta b}{N_f}\tag{2}$$


$$\Delta b = \frac{f^2}{a-f}\tag{3}$$

which can be obtained from (1) by setting $b = f + \Delta b$. Remember that $a \gg f$, so that actually $\Delta b \ll f$, unlike shown in the figure. Combining (2) and (3) we get

$$d = A \frac{f}{a-f} \tag{4}$$

which for $a \gg f$ can be simplified to

$$d \approx A \frac{f}{a} = \frac{f^2}{a N_f}\tag{5}$$

So, a large aperture $A$ (small f-number $N_f$) will produce large bokeh disks, as well as does a large focal length. At a constant aperture, the bokeh disk is proportional in size to the focal length; at a constant f-number, the bokeh disk sizes increases with the square of focal length. Also, the closer the object is to the lens the more blurry the bokeh will be.

Stopping Down

What happens when the aperture becomes smaller because the lens is “stopped down?” Figure 3 shows.

Figure 3: Effect of a smaller aperture.

Comparing with Figure 2, we can easily see how the bokeh disk becomes smaller because the angle of the outermost (red) rays becomes less acute as they pass through the focal point.

For great bokeh, your aperture cannot be large enough, i.e. your lens f-number cannot be small enough.

Sensor size

If you’ve ever compared a photo shot with a full-frame camera to one shot with a phone camera, you already know the result of this section. But we’ll calculate it anyway.

To image the same field of view (same object size for a given distance), the focal length of a camera with a smaller sensor must also be smaller, as shown in Figure 4.

Figure 4: Illustration of the relationship between sensor size $w$ and focal length $f$.

The field of view $\theta$ is given by

$$ \tan \frac{\theta}{2} = \frac{w}{2 f} \tag{6}$$

and for an equal field of view $\theta$ we have $w \propto f$. Hence, according to (5), $d \propto w^2$ for an equal f-number. The corresponding ray trajectories are shown in Figure 5.

Figure 5: Ray trajectories for a smaller sensor, leaving object distance $a$, field of view $\theta$ and f-number $N_f$ constant.

However, since the sensor is smaller, the image of the bokeh disk takes up a larger part of the whole image, and to be fair we should normalize the disk size $d$ by the sensor size $w$ in order to give the size of the bokeh disk as fraction of the whole image (which is what you will eventually see when looking at the picture). Then,

$$\frac{d}{w} \propto \frac{w}{a N_f} \tag{7}$$

Thus, the bokeh size as fraction of the whole image for a full-frame sensor will be about eight times as large as that for a 1/3.2″ sensor, as can be found in e.g. the iPhone 5, at the same f-number and field of view. More generally, the bokeh fraction scales inversely with the “crop factor” for the various sensor sizes, with APS-C having about 2/3 that of full-frame, Four-Thirds having about 3/4 that of APS-C, and so on.

If you simply use a lens with some focal length $f$ and f-number $N_f$ on a camera with a smaller sensor, you will get bokeh disks which are even larger than those on the large sensor (multiplied by the crop factor), but your field of view $\theta’$ becomes smaller, as also shown in Figure 4, and you might not image the object completely.

For great bokeh, your sensor cannot be large enough.

Focal Length with Fixed Object Size

When the object is to be imaged at a certain size on the sensor, we have to increase the object distance $a$ when we increase the focal length $f$. How does this affect the bokeh?

For an object of extent $h$ from the optical axis, we need a observation distance $a$ that depends on the field of view $\theta$ as

$$\tan \frac{\theta}{2} = \frac{h}{a} = \frac{w}{2f}$$

and thus

$$a = \frac{2f h}{w}$$

where we also used (6). Then with (5),

$$d\bigr|_{h = \mathrm{const}} = \frac{f w}{2h N_f} = A \frac{w}{2h} \tag{8}$$

If you have a zoom lens that has a constant aperture $A$ throughout the focal length range, the bokeh disk size will not change if you adjust the object distance so as to have a constant object size in the image. At a fixed f-number, however, the bokeh disk size increases with focal length, though only linearly instead of quadratically as in (5).


There you have it. For a given field-of-view to be imaged, nothing beats a camera with a large sensor and a lens with a small f-number, both usually not cheap. Whether the bokeh quality is “good” or “bad” is a whole different story, though.

In principle, similar calculations can be used to determine the depth-of-field which is basically those distances $\Delta a_+$ and $\Delta a_-$ (instead of the infinite distance used here) at which the size of the bokeh disk has some defined value such that an imaged point is just perceived as sharp. The bokeh disk in this context is called circle of confusion. See also the Wikipedia article on depth of field or Paul van Walree’s article on the depth of field [].

last posts in photography:


  • Some time I ago I tried to find an answer to the following question: Which bokeh is larger, that of a 6×6 medium format camera with a standard lens 80mm f/2.8 or that of an APS-C with 50mm f/1.4 given that the object in focus is imaged at the same relative size on the sensor and the film frame.

    So let’s assume you own these camera/lens combinations (which, coincidentally, I do) and take a portrait of someone with the same framing on both cameras, i.e. you adjust the object distance accordingly. Is the bokeh disk size larger on the medium format 80mm/f2.8 or on the APS-C 50mm f/1.4? My guess is the medium format bokeh balls are larger but I’m not sure.

    It seems that you developed the necessary theory to answer that question. (I will try to do it.)

    Very interesting post, btw!!!

  • Marcus wrote:

    That’s actually pretty easy using (8) from the post. Assumung 56mm film size for the medium format camera and 14.9mm for the APS-C sensor (Canon’s APS-C) – I’m using the height, but you could use the width of 22.3mm if you like, depending on if you want to crop vertically in the APS camera or horizontally in the medium format – you get the following (infinity) bokeh disks:

    $$d_\text{medium} = \frac{1}{2h} 1600\text{mm}^2$$

    $$d_\text{APS-C} = \frac{1}{2h} 532\text{mm}^2$$

    So yes, bokeh on the medium format is about three times as large.

  • Assume that you will print both portraits on the same paper size. I think in this case one should rather look at d/w to make a fair comparison. If I understand (8) correctly, d/w scales with f/Nf for h const. So the APS-C wins since 50/1.4 > 80/2.8 ?

  • Marcus wrote:

    You are correct! Unlike in (7), I forgot the normalization in my answer.
    So it seems that huge apertures beat huge sensors/films in this case. Now where do I get an f/1.4 lens for the Sony NEX system?

  • Hey Marcus! Die Mailadresse, die ich von Dir habe funktioniert nicht, Meld Dich mal! Achso ja übrigens Einfallswinkel=Ausfallswinkel! Ich wollte auch was zum Optik Thema beitragen…Zwinker!

  • Nice post. But I think you could an answer the following question: what is the “virtual diameter” of the bokeh ball, i.e. how large objects in the real world that are focused in the photo are the same size in the photo as the bokeh balls? If I am not mistaken then for an infinitely far light source the answer is very simple: the virtual diameter of the bokeh ball is equal to the aperture. E.g. if the aperture is 5 cm and you take a photo of a person whose nose is 5 cm then the bokeh ball of a far pointlike light source is on the photo the same diameter as the length of the person’s nose on the photo. Using this relation it is immediately possible to the answer to questions like christian had: in which camera is bokeh larger given the same scene, if the object distance is adjusted so that the framing is the same.

    Secondly, I have a question which I don’t know the answer: In your article and in my reasoning about the virtual diameter of the bokeh balls we assumed that there is only one lens and an aperture stop on it or outside it. In real cameras one distinguishes between physical aperture and entrance pupil because the system consists of several lenses and the aperture stop is between them… is it true that the relations continue to hold if one uses the entrance pupil as the aperture in the formulas?

Post a Comment

Your email is never shared.