focal lens calculator

Thin Lens Equation: 1/f = 1/do + 1/di
Enter any two values to calculate the third. Keep all distances in the same unit (mm, cm, or m).

Sign convention supported: positive for real distances, negative for virtual distances.

How this focal lens calculator works

This calculator uses the thin lens equation to solve basic optics problems. In practical terms, you can enter any two of the three variables (focal length, object distance, and image distance), and it computes the missing one instantly.

It is useful for photography, physics homework, microscope/lab work, and quick sanity checks when selecting lenses for prototypes and imaging systems.

Variables and meaning

  • f (Focal Length): The distance from lens center to focal point.
  • do (Object Distance): Distance from object to lens.
  • di (Image Distance): Distance from image to lens.
  • Magnification (m): m = -di/do; indicates image size and inversion.

Sign convention quick guide

Typical classroom convention

  • Real object distance: do is positive
  • Real image distance: di is positive
  • Virtual image distance: di is negative
  • Converging lens focal length: positive f
  • Diverging lens focal length: negative f

If you are using a different sign convention, stay consistent across all inputs. Consistency matters more than the specific convention.

Worked examples

Example 1: Solve focal length

Suppose an object is 30 cm from the lens, and the image forms 60 cm from the lens. Using the calculator: enter do = 30 and di = 60, then click calculate. The result is f = 20 cm.

Example 2: Solve image distance

If f = 50 mm and do = 200 mm, then 1/di = 1/f - 1/do. The computed image distance is approximately 66.67 mm, and magnification is -0.333.

Common mistakes to avoid

  • Mixing units (for example, entering f in mm and do in cm).
  • Entering all three values and expecting a new solution; with three inputs, the calculator only checks consistency.
  • Ignoring signs when dealing with virtual images or diverging lenses.
  • Using zero for any distance, which is physically invalid in this equation.

When to use a more advanced model

The thin lens formula is ideal for introductory and moderate-precision tasks. For high-precision optical design, use thick-lens models, ray tracing, lens maker equations, and aberration analysis. Those methods account for real lens geometry, glass dispersion, and off-axis effects.

🔗 Related Calculators