Focal Length Calculator


Focal Length Calculator

An essential tool for photographers, optometrists, and physicists to determine a lens’s focal length based on the thin lens equation.



The distance from the object/subject to the optical center of the lens. Must be a positive value.

Please enter a valid positive number.



The distance from the optical center of the lens to the focused image (e.g., the camera sensor).

Please enter a valid positive number for a real image.



Select the measurement unit for both distances. The focal length will be calculated in the same unit.

Calculated Focal Length (f)

Magnification (M)

Lens Power (P)

Total Distance

Formula Used: 1/f = 1/d_o + 1/d_i

This calculation uses the Gaussian form of the thin lens equation, where ‘f’ is the focal length, ‘d_o’ is the object distance, and ‘d_i’ is the image distance.

Image Distance vs. Object Distance

Dynamic chart showing how image distance changes relative to object distance for the calculated focal length.

What is Calculating Focal Length of a Lens Used For?

Calculating the focal length of a lens is a fundamental task in optics and photography. The focal length determines the lens’s angle of view and magnification. A shorter focal length provides a wider field of view, while a longer focal length offers higher magnification and a narrower field of view. This calculation is crucial for anyone working with optical systems, from photographers selecting the right lens for a shot to engineers designing telescopes, microscopes, or camera systems. Understanding the relationship between object distance, image distance, and focal length is key to controlling how images are formed.

Focal Length Formula and Explanation

The most common formula for calculating the focal length of a simple, thin lens is the thin lens equation. It provides a reliable approximation for most standard lenses where the lens thickness is negligible compared to its focal length.

The formula is expressed as:

1/f = 1/d_o + 1/d_i

This can be rearranged to solve directly for the focal length (f):

f = (d_o * d_i) / (d_o + d_i)

Variables in the Thin Lens Equation
Variable Meaning Unit (Auto-inferred) Typical Range
f Focal Length mm, cm, m 1mm – 5000mm+
d_o Object Distance mm, cm, m f to Infinity
d_i Image Distance mm, cm, m f to Infinity

Practical Examples

Example 1: Macro Photography

A photographer is doing a macro shot of a flower. The flower (object) is placed 200mm from the lens, and the sensor (image plane) is 100mm from the lens to achieve sharp focus.

  • Inputs: Object Distance (d_o) = 200 mm, Image Distance (d_i) = 100 mm
  • Units: Millimeters (mm)
  • Calculation: f = (200 * 100) / (200 + 100) = 20000 / 300 = 66.67 mm
  • Results: The required focal length is approximately 66.7 mm. The magnification would be M = -d_i / d_o = -100 / 200 = -0.5x, meaning the image is half the size of the object.

Example 2: Landscape Photography

A photographer wants to capture a distant mountain range, which for optical purposes is at an infinite distance (d_o → ∞). The lens they are using is a 50mm lens. Where does the image form?

  • Inputs: Object Distance (d_o) → ∞, Focal Length (f) = 50 mm
  • Units: Millimeters (mm)
  • Calculation: Using the formula 1/f = 1/d_o + 1/d_i, as d_o approaches infinity, 1/d_o approaches 0. Therefore, 1/f ≈ 1/d_i, which means d_i ≈ f.
  • Results: The image distance is equal to the focal length, so the image is formed 50 mm behind the lens. This is why focusing on a very distant object is often called “focusing to infinity.”

How to Use This Focal Length Calculator

  1. Enter Object Distance: Input the distance from your subject to the center of your lens in the “Object Distance (d_o)” field.
  2. Enter Image Distance: Input the distance from the center of your lens to the camera’s sensor or film plane in the “Image Distance (d_i)” field. This is the distance required to get a sharp image.
  3. Select Units: Choose the appropriate unit of measurement (millimeters, centimeters, or meters) from the dropdown. Ensure you use the same unit for both distances.
  4. Interpret Results: The calculator will instantly display the Calculated Focal Length (f). It also shows intermediate values like Magnification, Lens Power (in diopters, assuming meters), and the total object-to-image distance.
  5. Analyze the Chart: The chart visualizes the relationship between object and image distance for the calculated focal length, helping you understand how focus changes.

Key Factors That Affect Focal Length

While the thin lens equation provides a great model, several factors determine the true focal length of a physical lens:

  • Refractive Index of the Material: The material the lens is made from (e.g., glass, plastic) has a refractive index that dictates how much it bends light. A higher refractive index leads to a shorter focal length for the same curvature.
  • Curvature of Lens Surfaces: The radii of the front and back surfaces of the lens are the primary determinants of focal length. More highly curved surfaces bend light more sharply, resulting in a shorter focal length.
  • The Surrounding Medium: The medium in which the lens operates (e.g., air, water) also has a refractive index. A lens will have a different focal length underwater than it does in air.
  • Wavelength of Light (Dispersion): The refractive index of glass varies slightly with the wavelength (color) of light. This causes chromatic aberration, where different colors focus at slightly different points. High-quality lenses use multiple elements to correct for this.
  • Lens Thickness: The thin lens equation is an approximation. For “thick” lenses, where the thickness is significant, more complex formulas like the lensmaker’s equation are needed for precise calculations.
  • Object Distance: While not a factor of the lens itself, the object distance directly influences the image distance required for focus, as demonstrated by our calculator and the thin lens formula.

Frequently Asked Questions (FAQ)

1. What is the difference between focal length and image distance?

Focal length is an intrinsic property of the lens itself, determined by its physical construction. Image distance is the variable distance from the lens to the sensor where a sharp image of an object is formed, and it changes depending on how far away the object is. They are only equal when the object is infinitely far away.

2. What does a negative focal length mean?

A negative focal length indicates a diverging lens (concave lens). These lenses spread light out instead of converging it to a point and form virtual images. This calculator is designed for converging (convex) lenses which form real images.

3. How do I handle units? Do I need to convert to meters?

No, you do not need to convert manually. As long as you use the same unit (e.g., millimeters) for both the object and image distance, the calculator will provide the focal length in that same unit. The Lens Power, however, is calculated in diopters, which is based on a focal length in meters (1/m).

4. What is ‘Magnification’ in the results?

Magnification (M) is the ratio of the image size to the object size. It’s calculated as M = -d_i / d_o. A value between -1 and 0 means the image is smaller than the object. A value less than -1 means the image is larger. The negative sign indicates the image is inverted, which is typical for single-lens real images.

5. Why does my camera lens have a focal length range (e.g., 18-55mm)?

That is a zoom lens. It contains multiple lens elements that move relative to each other, allowing you to change the effective focal length of the entire system. This calculator finds the focal length for a fixed (“prime”) lens setup.

6. Can I use this calculator for a virtual image?

This calculator is set up for real images, where both d_o and d_i are positive. For a virtual image (formed by a converging lens when the object is inside the focal length), the image distance (d_i) would be negative. The formula still applies, but the physical setup is different.

7. What is the relationship between focal length and “lens power”?

Lens power is the reciprocal of the focal length in meters (P = 1/f). It is measured in units called diopters. A lens with a short focal length has high power, as it bends light very strongly.

8. What if my object is very far away?

If your object is very far away (e.g., stars, a distant mountain), the object distance (d_o) can be considered infinite. In this case, the image distance (d_i) will be equal to the focal length (f). You can test this by entering a very large number for the object distance in the calculator.

© 2026 Your Website. All rights reserved. For educational and illustrative purposes only.




Leave a Reply

Your email address will not be published. Required fields are marked *