the math of bokeh

If you don’t know (yet) what bokeh is, check out the Wikipedia arti­cle. In short, bokeh is the blur (or qual­i­ty there­of) of out-of-focus regions in a pho­to­graph. This post is not about the per­ceived qual­i­ty of such blur, but rather of its size. For bokeh, more is usu­al­ly bet­ter, since it allows to sep­a­rate an object in focus nice­ly from the blurred back­ground. For the cal­cu­la­tions that fol­low, we will look at the size of the image of point orig­i­nat­ing far behind an object of inter­est in the pic­ture. To make the cal­cu­la­tions eas­i­er, that point is assumed to be infi­nite­ly far away – the dif­fer­ence to points which are finite­ly but sig­nif­i­cant­ly far behind the object will be neg­li­gi­ble.

Bokeh lights in San Diego’s Gaslamp Quar­ter, tak­en with a Sony DSC-R1 at 69.8mm with f/4.8 and focused to the near lim­it of about 50cm.


The disks in Fig­ure 1 are essen­tial­ly the images of point sources locat­ed a long dis­tance away and are used here to illus­trate the bokeh effect. In a “reg­u­lar” pho­to­graph, each point in the back­ground of the scene is con­volved with the shape of the bokeh disk and super­posed with the disks from all oth­er back­ground points, just like the over­lap­ping disks in Fig­ure 1. The result is a more or less blurred back­ground which nice­ly iso­lates an in-focus fore­ground. The larg­er the bokeh disk, the more pro­nounced the blur effect and fore­ground iso­la­tion will be. For lots of great exam­ples, check out flickr’s Bokeh - Smooth & Silky pic­ture pool.

Cal­cu­lat­ing the expect­ed size of bokeh disks – and thus the strength of the bokeh effect – is not at all that hard. The only for­mu­la from optics that we need is the thin lens for­mu­la

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

where $f$ is the focal length of the lens, $a$ is the object dis­tance, and $b$ is the image dis­tance. The rest is just basic trigonom­e­try. We will assume a thin lens through­out to make our life eas­i­er. How­ev­er, the results then will only hold for $a \gg f$, since oth­er­wise the geom­e­try of the lens becomes rel­e­vant. There­fore, macro pho­tog­ra­phy is not cov­ered by this post.

The above quan­ti­ties and a few more are shown in Fig­ure 2. Here, $\Delta b$ is the dif­fer­ence in image dis­tance between an object at dis­tance $a$ and one at infin­i­ty, as can be deter­mined using (1) – for the object at infin­i­ty, $b = f$. Fur­ther­more, $A$ is the (absolute) aper­ture size of the lens, as relat­ed to its f-num­ber $N_f$ by $A = f / N_f$, $w$ is the size of the sen­sor, and $d$ is the diam­e­ter of the bokeh disk on the sen­sor.

Fig­ure 2: Basic quan­ti­ties for bokeh cal­cu­la­tions:
$a$ - object dis­tance
$b$ - image (sen­sor) dis­tance
$f$ - focal length
$A$ - lens aper­ture
$w$ -sen­sor size
$d$ - size of bokeh disk

Now from Fig­ure 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 set­ting $b = f + \Delta b$. Remem­ber that $a \gg f$, so that actu­al­ly $\Delta b \ll f$, unlike shown in the fig­ure. Com­bin­ing (2) and (3) we get

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

which for $a \gg f$ can be sim­pli­fied to

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

So, a large aper­ture $A$ (small f-num­ber $N_f$) will pro­duce large bokeh disks, as well as does a large focal length. At a con­stant aper­ture, the bokeh disk is pro­por­tion­al in size to the focal length; at a con­stant f-num­ber, the bokeh disk sizes increas­es with the square of focal length. Also, the clos­er the object is to the lens the more blur­ry the bokeh will be.

Stopping Down

What hap­pens when the aper­ture becomes small­er because the lens is “stopped down?” Fig­ure 3 shows.

Fig­ure 3: Effect of a small­er aper­ture.

Com­par­ing with Fig­ure 2, we can eas­i­ly see how the bokeh disk becomes small­er because the angle of the out­er­most (red) rays becomes less acute as they pass through the focal point.

For great bokeh, your aper­ture can­not be large enough, i.e. your lens f-num­ber can­not be small enough.

Sensor size

If you’ve ever com­pared a pho­to shot with a full-frame cam­era to one shot with a phone cam­era, you already know the result of this sec­tion. But we’ll cal­cu­late it any­way.

To image the same field of view (same object size for a giv­en dis­tance), the focal length of a cam­era with a small­er sen­sor must also be small­er, as shown in Fig­ure 4.

Fig­ure 4: Illus­tra­tion of the rela­tion­ship between sen­sor size $w$ and focal length $f$.

The field of view $\theta$ is giv­en by

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

and for an equal field of view $\theta$ we have $w \prop­to f$. Hence, accord­ing to (5), $d \prop­to w^2$ for an equal f-num­ber. The cor­re­spond­ing ray tra­jec­to­ries are shown in Fig­ure 5.

Fig­ure 5: Ray tra­jec­to­ries for a small­er sen­sor, leav­ing object dis­tance $a$, field of view $\theta$ and f-num­ber $N_f$ con­stant.

How­ev­er, since the sen­sor is small­er, the image of the bokeh disk takes up a larg­er part of the whole image, and to be fair we should nor­mal­ize the disk size $d$ by the sen­sor size $w$ in order to give the size of the bokeh disk as frac­tion of the whole image (which is what you will even­tu­al­ly see when look­ing at the pic­ture). Then,

$$\frac{d}{w} \prop­to \frac{w}{a N_f} \tag{7}$$

Thus, the bokeh size as frac­tion of the whole image for a full-frame sen­sor will be about eight times as large as that for a 1/3.2″ sen­sor, as can be found in e.g. the iPhone 5, at the same f-num­ber and field of view. More gen­er­al­ly, the bokeh frac­tion scales inverse­ly with the “crop fac­tor” for the var­i­ous sen­sor sizes, with APS-C hav­ing about 2/3 that of full-frame, Four-Thirds hav­ing about 3/4 that of APS-C, and so on.

If you sim­ply use a lens with some focal length $f$ and f-num­ber $N_f$ on a cam­era with a small­er sen­sor, you will get bokeh disks which are even larg­er than those on the large sen­sor (mul­ti­plied by the crop fac­tor), but your field of view $\theta’$ becomes small­er, as also shown in Fig­ure 4, and you might not image the object com­plete­ly.

For great bokeh, your sen­sor can­not be large enough.

Focal Length with Fixed Object Size

When the object is to be imaged at a cer­tain size on the sen­sor, we have to increase the object dis­tance $a$ when we increase the focal length $f$. How does this affect the bokeh?

For an object of extent $h$ from the opti­cal axis, we need a obser­va­tion dis­tance $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 con­stant aper­ture $A$ through­out the focal length range, the bokeh disk size will not change if you adjust the object dis­tance so as to have a con­stant object size in the image. At a fixed f-num­ber, how­ev­er, the bokeh disk size increas­es with focal length, though only lin­ear­ly instead of qua­drat­i­cal­ly as in (5).


There you have it. For a giv­en field-of-view to be imaged, noth­ing beats a cam­era with a large sen­sor and a lens with a small f-num­ber, both usu­al­ly not cheap. Whether the bokeh qual­i­ty is “good” or “bad” is a whole dif­fer­ent sto­ry, though.

In prin­ci­ple, sim­i­lar cal­cu­la­tions can be used to deter­mine the depth-of-field which is basi­cal­ly those dis­tances $\Delta a_+$ and $\Delta a_-$ (instead of the infi­nite dis­tance used here) at which the size of the bokeh disk has some defined val­ue such that an imaged point is just per­ceived as sharp. The bokeh disk in this con­text is called cir­cle of con­fu­sion. See also the Wikipedia arti­cle on depth of field or Paul van Walree’s arti­cle on the depth of field [tooth​walk​er​.org].

last posts in photography:


  • Some time I ago I tried to find an answer to the fol­low­ing ques­tion: Which bokeh is larg­er, that of a 6x6 medi­um for­mat cam­era with a stan­dard lens 80mm f/2.8 or that of an APS-C with 50mm f/1.4 giv­en that the object in focus is imaged at the same rel­a­tive size on the sen­sor and the film frame.

    So let’s assume you own these camera/lens com­bi­na­tions (which, coin­ci­den­tal­ly, I do) and take a por­trait of some­one with the same fram­ing on both cam­eras, i.e. you adjust the object dis­tance accord­ing­ly. Is the bokeh disk size larg­er on the medi­um for­mat 80mm/f2.8 or on the APS-C 50mm f/1.4? My guess is the medi­um for­mat bokeh balls are larg­er but I’m not sure.

    It seems that you devel­oped the nec­es­sary the­o­ry to answer that ques­tion. (I will try to do it.)

    Very inter­est­ing post, btw!!!

  • Marcus wrote:

    That’s actu­al­ly pret­ty easy using (8) from the post. Assumung 56mm film size for the medi­um for­mat cam­era and 14.9mm for the APS-C sen­sor (Canon’s APS-C) – I’m using the height, but you could use the width of 22.3mm if you like, depend­ing on if you want to crop ver­ti­cal­ly in the APS cam­era or hor­i­zon­tal­ly in the medi­um for­mat – you get the fol­low­ing (infin­i­ty) 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 medi­um for­mat is about three times as large.

  • Assume that you will print both por­traits on the same paper size. I think in this case one should rather look at d/w to make a fair com­par­i­son. If I under­stand (8) cor­rect­ly, d/w scales with f/Nf for h con­st. So the APS-C wins since 50/1.4 > 80/2.8 ?

  • Marcus wrote:

    You are cor­rect! Unlike in (7), I for­got the nor­mal­iza­tion in my answer.
    So it seems that huge aper­tures beat huge sensors/films in this case. Now where do I get an f/1.4 lens for the Sony NEX sys­tem?

  • Hey Mar­cus! Die Mailadresse, die ich von Dir habe funk­tion­iert nicht, Meld Dich mal! Achso ja übri­gens Einfallswinkel=Ausfallswinkel! Ich wollte auch was zum Optik The­ma beitragen…Zwinker!

  • Nice post. But I think you could an answer the fol­low­ing ques­tion: what is the “vir­tu­al diam­e­ter” of the bokeh ball, i.e. how large objects in the real world that are focused in the pho­to are the same size in the pho­to as the bokeh balls? If I am not mis­tak­en then for an infi­nite­ly far light source the answer is very sim­ple: the vir­tu­al diam­e­ter of the bokeh ball is equal to the aper­ture. E.g. if the aper­ture is 5 cm and you take a pho­to of a per­son whose nose is 5 cm then the bokeh ball of a far point­like light source is on the pho­to the same diam­e­ter as the length of the person’s nose on the pho­to. Using this rela­tion it is imme­di­ate­ly pos­si­ble to the answer to ques­tions like chris­t­ian had: in which cam­era is bokeh larg­er giv­en the same scene, if the object dis­tance is adjust­ed so that the fram­ing is the same.

    Sec­ond­ly, I have a ques­tion which I don’t know the answer: In your arti­cle and in my rea­son­ing about the vir­tu­al diam­e­ter of the bokeh balls we assumed that there is only one lens and an aper­ture stop on it or out­side it. In real cam­eras one dis­tin­guish­es between phys­i­cal aper­ture and entrance pupil because the sys­tem con­sists of sev­er­al lens­es and the aper­ture stop is between them… is it true that the rela­tions con­tin­ue to hold if one uses the entrance pupil as the aper­ture in the for­mu­las?

Post a Comment

Your email is never shared.