What a lens does and what focal length means
A lens bends every ray that passes through it, and the amount of bending depends on where the ray strikes the surface. Both surfaces refract according to Snell's law, and for a thin lens with spherical surfaces the net effect on paraxial rays is startlingly simple: all rays leaving one point on the object are brought back together at one point on the image side. That is what makes imaging possible at all.
Focal length is the distance at which a converging lens brings parallel rays to a point. Light from a very distant object arrives essentially parallel, so its image forms at the focal plane — which is why a camera focused at infinity has its sensor exactly one focal length behind the lens, and why you can measure a lens's focal length in seconds by imaging a window onto a wall.
The thin lens equation, 1/f = 1/d₀ + 1/dᵢ, follows from applying the refraction equation at each surface and dropping the thickness. Written as reciprocals it is not obviously intuitive, so it helps to see what it says: bring the object closer and 1/d₀ grows, so 1/dᵢ must shrink, so the image moves further away and gets bigger. That is focusing. A camera lens focusing from infinity down to its minimum distance is doing exactly this, and the barrel extension you can feel is the change in di.
Optometrists work in dioptres instead, P = 1/f with f in metres. Dioptres are convenient because thin lenses in contact simply add: a +2.00 D reading lens over a −3.00 D distance correction gives −1.00 D overall. A +2.00 D lens has a focal length of 500 mm; a −4.00 D lens has −250 mm.
Signs, and the five cases a converging lens can produce
The sign convention does the work here, so it is worth stating exactly. This calculator uses the Gaussian, real-is-positive convention: d0 is positive for a real object in front of the lens; di is positive for a real image formed beyond the lens and negative for a virtual image on the object side; f is positive for a converging lens and negative for a diverging one; and m = −dᵢ/d₀, so a negative magnification means an inverted image.
A converging lens then has five distinct regimes, and moving the object through them is the whole of elementary lens optics:
- Object beyond 2f. The image is real, inverted and reduced, between f and 2f. This is the camera and the eye.
- Object at exactly 2f. The image is real, inverted and the same size, at 2f. The object-to-image distance is 4f, which is the minimum possible for a real image and the standard 1:1 macro setup.
- Object between f and 2f. The image is real, inverted and enlarged, beyond 2f. This is the projector.
- Object at f. No image: the rays emerge parallel and meet only at infinity. This is the collimator.
- Object inside f. The image is virtual, upright and enlarged, on the same side as the object. This is the magnifying glass, and it is why you must hold a loupe close to the thing you are inspecting.
A diverging lens is far simpler. With a real object it produces a virtual, upright, reduced image every single time, at any object distance, and the image always sits between the lens and its focal point. There are no cases to remember, which is why a diverging lens can never be used to project.
Worked example: a slide projector
You have a 150 mm projection lens and a 36 mm-wide slide. You want the image to be 1.44 m wide on a screen. Where do the slide and the screen go?
- Required magnification. m = image height ÷ object height = 1440 ÷ 36 = 40 in size. The image is real and therefore inverted, so m = −40.
- Object distance from magnification.
m = −dᵢ/d₀, so di = 40 d0. Substituting into the lens equation:1/150 = 1/d₀ + 1/(40 d₀) = (41)/(40 d₀), giving d0 = 150 × 41 ÷ 40 = 153.75 mm. - Image distance. di = 40 × 153.75 = 6,150 mm, so the screen sits 6.15 m from the lens.
- Check with the lens equation. 1/153.75 + 1/6150 = 0.0065041 + 0.0001626 = 0.0066667 = 1/150. It closes.
- Sanity-check the geometry. The slide sits just 3.75 mm outside the focal point, which is the regime that produces a large real image, exactly as expected. That tiny margin is also why projector focusing is so touchy: moving the slide 0.5 mm shifts the screen distance by roughly 800 mm.
Now reverse the lens's job. Put the same 150 mm lens 200 mm from an object: di = 200 × 150 ÷ 50 = 600 mm and m = −3. And at 100 mm, inside the focal length: di = 100 × 150 ÷ (−50) = −300 mm, a virtual upright image three times life size, 300 mm in front of the lens. One lens, three completely different behaviours, all from the same equation.
Reading the answer and checking it is physical
Read the sign of the image distance first, because it decides everything else. A positive value means light really converges there and you can put a sensor or a screen at that point. A negative value means the rays only appear to come from there — nothing is projected, and you must look through the lens to see the image. Photographic and projection work needs positive image distances; magnifiers, eyepieces and spectacle lenses for myopia work in the negative regime.
Then check the magnification against the object position. For a converging lens, |m| passes through 1 exactly when the object is at 2f. Object further than 2f means |m| < 1; object between f and 2f means |m| > 1. If your numbers contradict that, the focal length or the object distance has the wrong sign.
Watch out for the minimum-conjugate result. For a real image, the total object-to-image distance d₀ + dᵢ has a minimum of exactly 4f, reached at the 2f–2f pair. If you have a bench 500 mm long and want a real image, no lens longer than 125 mm can do it, no matter where you put things. This is the calculation that tells a photographer whether a given macro setup can physically reach 1:1.
Finally, remember what the thin lens model omits. It assumes a lens of negligible thickness, rays close to the axis, a single wavelength and perfect spherical surfaces. Real lenses show spherical aberration, coma, astigmatism, field curvature, distortion and chromatic aberration; a real thick lens has two principal planes and distances must be measured from those, not from the glass. The equation gets you the design point; ray-tracing software and a real optical bench get you the last few percent.
Image position and size across the whole object range
| Object distance d₀ | Image distance dᵢ | Magnification | Image character |
|---|---|---|---|
| 0.50 f | −1.00 f | +2.00 | Virtual, upright, enlarged |
| 0.90 f | −9.00 f | +10.00 | Virtual, upright, strongly enlarged |
| 1.00 f | infinite | infinite | No image — rays emerge parallel |
| 1.10 f | +11.00 f | −10.00 | Real, inverted, strongly enlarged |
| 1.50 f | +3.00 f | −2.00 | Real, inverted, enlarged |
| 2.00 f | +2.00 f | −1.00 | Real, inverted, same size |
| 3.00 f | +1.50 f | −0.50 | Real, inverted, reduced |
| 5.00 f | +1.25 f | −0.25 | Real, inverted, reduced |
| 10.0 f | +1.11 f | −0.111 | Real, inverted, reduced |
| very large | → 1.00 f | → 0 | Real image at the focal plane |
Multiply the middle column by your own focal length to get millimetres. A diverging lens is not tabulated because it gives a virtual, upright, reduced image at every object distance.
Errors that misplace the image
- Adding the reciprocals wrong.
1/f = 1/d₀ + 1/dᵢdoes not meanf = d₀ + dᵢ. Solve for di asd₀f/(d₀−f)rather than inverting term by term. - Mixing sign conventions. Some texts use a Cartesian convention in which the object distance is negative. Pick one and stay in it; this calculator takes a real object as positive throughout.
- Forgetting that magnification is negative for real images. A converging lens forming a real image always inverts, so a positive magnification alongside a positive image distance is a contradiction.
- Using a diverging lens to project. It cannot form a real image from a real object at any distance, so no screen position will ever work.
- Measuring distances from the glass on a thick lens. Distances belong to the principal planes, which for a thick or compound lens can sit centimetres away from the physical elements — sometimes outside the barrel entirely.
- Ignoring chromatic aberration. The focal length depends on refractive index, which depends on wavelength, so a simple lens has a different focal length for blue and red light.
- Expecting a real image inside 4f of total separation. The object-to-image distance for a real image can never be less than four focal lengths.
Beyond a single thin lens
The focal length itself comes from the lensmaker's equation, 1/f = (n − 1)(1/R₁ − 1/R₂), which links it to the refractive index of the glass and the curvature of the two surfaces. That index is exactly the quantity that governs how each surface bends light, so the thin lens formula sits directly on top of Snell's law: it is what you get when you apply refraction at two spherical surfaces and take the thin limit.
Multiple lenses are handled by chaining: the image formed by the first becomes the object for the second, with a negative object distance if it falls beyond the second lens. Two thin lenses in contact simply add their powers. That is how a compound microscope reaches 1,000× and how a telescope's magnification comes out as the ratio of objective to eyepiece focal lengths.
Resolution is not covered by the thin lens equation at all. Even a geometrically perfect lens cannot resolve detail finer than roughly 1.22λ/D in angle, set by diffraction at the aperture — which depends on the wavelength rather than on the ray geometry. That is the limit optical microscopes hit at about 200 nm, and the reason electron microscopes exist.
If you are working through an optics problem set, the neighbouring calculations are usually refraction at a plane surface, the critical angle for total internal reflection inside a prism, and the intensity falling on the image plane. The last of these follows an inverse-square law of the same shape as the one behind sound levels, which is why a projector image dims as the square of the throw distance.
Sign convention used on this page
Object distance positive for a real object. Image distance positive for a real image on the far side of the lens, negative for a virtual image on the near side. Focal length positive for converging, negative for diverging. Magnification negative when inverted. If a textbook gives you a different answer's sign, check its convention before assuming an arithmetic error.
