Focal Length Calculator

Calculate the focal length of a lens from the object distance and image distance, using the thin lens equation.

Uses the real-is-positive sign convention: positive distances represent a real object and a real image forming on the sensor (the everyday camera case). A negative image distance represents a virtual image. Enter negative values for virtual objects or virtual images when applicable.
Result Live
Focal Length
Magnification

The thin lens equation

Formula
1/f = 1/d₀ + 1/dᵢ   Solved for focal length: f = (d₀ × dᵢ) ÷ (d₀ + dᵢ)   Example: d₀=30cm, dᵢ=15cm — f = (30×15)÷(30+15) = 10cm

d₀ is the object distance (from the object being photographed to the lens), and dᵢ is the image distance (from the lens to where the image actually forms — the camera sensor, for a properly focused shot). This calculator uses the real-is-positive sign convention, standard in most introductory physics courses: positive distances for a real object and a real image forming on the far side of the lens — the everyday case for a camera actually taking a photo. A negative image distance represents a virtual image instead (the kind a magnifying glass produces when held close to an object, rather than a lens projecting light onto a sensor).

Why focusing only moves the lens a tiny amount

Something genuinely counterintuitive falls out of this formula: as the object distance grows very large, the image distance gets closer and closer to the focal length itself, and barely moves from there no matter how much farther the object gets. A 50mm lens focusing on a subject 3 meters away forms its image about 50.85mm behind the lens — less than a millimeter past the focal length. Push the subject out to 10 meters, and that gap shrinks even further. This is exactly why autofocus mechanisms only need to shift a lens element by a fraction of a millimeter to rack focus across most of a scene — the image distance simply doesn't have much room to move once the subject is more than a few focal lengths away. At true infinity, the image distance and focal length become exactly equal, which is the actual definition of what "focal length" means physically: the distance behind the lens where parallel rays from infinitely far away converge.

Frequently asked questions

How do you calculate the focal length of a lens?

Using the thin lens equation: 1/f = 1/d₀ + 1/dᵢ, which rearranges to f = (d₀ × dᵢ) ÷ (d₀ + dᵢ). An object 30cm from the lens forming an image 15cm behind it gives a focal length of 10cm.

What is the difference between object distance and image distance?

Object distance is how far the actual subject is from the lens. Image distance is how far behind the lens the resulting image actually forms — for a camera in focus, that's the distance from the lens to the sensor.

What does negative magnification mean?

The image is inverted (upside down) relative to the object — the normal case for a real image formed by a single converging lens, exactly what happens inside a camera. The magnitude of the number (ignoring the sign) tells you the size ratio: a magnification of -0.5× means the image is half the size of the object, flipped.