What This Calculator Does
The Lens Focal Distance Calculator finds the focal length of a thin lens from the position of an object and the position of the image it forms. It is built on the classic thin-lens equation used throughout geometric optics for cameras, eyeglasses, microscopes, and telescopes.
The Formula Explained
The thin-lens equation links the focal distance \(f\), the object distance \(d_o\), and the image distance \(d_i\):
$$\frac{1}{f} = \frac{1}{d_o} + \frac{1}{d_i}$$Solving for the focal distance gives a single convenient expression:
$$f = \frac{d_o \, d_i}{d_o + d_i}$$Here \(d_o\) is the distance from the object to the lens, \(d_i\) is the distance from the lens to the image, and \(f\) is the focal distance. Use consistent units (all in centimeters). A positive \(f\) indicates a converging lens.
How to Use It
Enter the object distance and the image distance in centimeters, then submit. The calculator returns the focal distance and the corresponding lens power in diopters, computed as \(P = 100/f\) when \(f\) is in centimeters.
Worked Example
Suppose an object sits \(30\,\text{cm}\) from a lens and a sharp image forms \(20\,\text{cm}\) on the other side. Then:
$$f = \frac{30 \times 20}{30 + 20} = \frac{600}{50} = 12\,\text{cm}$$The lens power is \(P = 100/12 \approx 8.33\) diopters.
More Worked Examples
All three examples use the thin-lens relation solved for focal length, with lens power in diopters (D) found from the focal length in centimetres:
$$f = \frac{d_o \, d_i}{d_o + d_i}, \qquad P = \frac{100}{f\,(\text{cm})}$$They use the real-is-positive convention. A real object has a positive object distance. A real image has a positive image distance, and a virtual image has a negative one.
Example 1: Magnifier (virtual image)
An object sits 10 cm from a lens. An upright, enlarged virtual image appears 30 cm away on the same side as the object, so \(d_o = 10\) cm and \(d_i = -30\) cm.
- Substitute: $$f = \frac{(10)(-30)}{10 + (-30)} = \frac{-300}{-20} = 15\ \text{cm}$$
- Power: $$P = \frac{100}{15} \approx 6.67\ \text{D}$$
- Magnification: \(m = -d_i/d_o = -(-30)/10 = +3\).
Result: f = 15 cm. This is a converging lens. The image is virtual, upright and three times the size of the object, which is how a simple magnifying glass works.
Example 2: Diverging lens
An object is 20 cm from a lens. A reduced virtual image forms 10 cm from the lens on the object side, so \(d_o = 20\) cm and \(d_i = -10\) cm.
- Substitute: $$f = \frac{(20)(-10)}{20 + (-10)} = \frac{-200}{10} = -20\ \text{cm}$$
- Power: $$P = \frac{100}{-20} = -5\ \text{D}$$
- Magnification: \(m = -(-10)/20 = +0.5\).
Result: f = −20 cm. The negative focal length shows that this is a diverging (concave) lens. The image is virtual, upright and half the size of the object.
Example 3: Object at twice the focal length
An object 40 cm from a lens produces a sharp image on a screen 40 cm away on the other side, so \(d_o = d_i = 40\) cm.
- Substitute: $$f = \frac{(40)(40)}{40 + 40} = \frac{1600}{80} = 20\ \text{cm}$$
- Power: $$P = \frac{100}{20} = 5\ \text{D}$$
- Magnification: \(m = -40/40 = -1\).
Result: f = 20 cm. This is a converging lens. The image is real, inverted and the same size as the object. This is the expected result when an object sits at 2f, because the image then also forms at 2f.
FAQ
What units should I use? Any single length unit works as long as both distances share it; this tool assumes centimeters and reports power in diopters.
Why is my focal distance negative? A negative result indicates a diverging (concave) lens or a virtual image, depending on your sign convention for \(d_i\).
Does this work for mirrors? The same mathematical form applies to the mirror equation, so you can reuse it for spherical mirrors with the appropriate sign convention.