Focal Length Calculator Formula

Understand the math behind the focal length calculator. Each variable explained with a worked example.

Formulas Used

Focal Length

focal_length = 1 / (1/object_distance + 1/image_distance)

Lens Power

lens_power = 100 / (1 / (1/object_distance + 1/image_distance))

Variables

VariableDescriptionDefault
object_distanceObject Distance(cm)30
image_distanceImage Distance(cm)15

How It Works

Focal Length

The focal length defines the converging or diverging power of a lens or mirror.

Formula

1/f = 1/d_o + 1/d_i

Lens power in diopters is D = 1/f (with f in meters). Positive focal length = converging lens; negative = diverging.

Worked Example

An object at 30 cm produces an image at 15 cm.

object_distance = 30image_distance = 15
  1. 011/f = 1/do + 1/di
  2. 021/f = 1/30 + 1/15
  3. 031/f = 0.0333 + 0.0667 = 0.1
  4. 04f = 10 cm
  5. 05Power = 100/10 = 10 diopters

Frequently Asked Questions

What are diopters?

The unit of lens power, equal to 1/f where f is in meters. Eyeglass prescriptions use diopters. Positive = farsighted correction; negative = nearsighted.

How does focal length relate to camera zoom?

Longer focal length gives higher magnification and a narrower field of view (telephoto). Shorter focal length gives a wider field of view (wide-angle).

What determines the focal length of a lens?

The curvature of the lens surfaces and the refractive index of the glass. The lensmaker's equation relates these to focal length.

Ready to run the numbers?

Open Focal Length Calculator