ThisCalculator

Sports and fitness

Focal Length Calculator: How to Use It

Updated · Standard formula, shown below

Focal length 9.52 cm
Magnification
0.050
Result
Object distance
200 cm
You entered
Image distance
10 cm
You entered

Focal Length Calculator: How to Use It

A focal length calculator determines the focal length of a lens (in millimeters) from the lens-to-image distance and the object-to-lens distance, or from the field of view and sensor size. You enter the distances or angles you know, and the calculator returns the focal length needed or measured, using the fundamental lens equation.

Formula

The thin lens equation relates the object distance (do), image distance (di), and focal length (f):

1/f = 1/do + 1/di

Solving for f gives:

f = (do × di) / (do + di)

  • f – focal length (cm, mm, or any consistent unit)
  • do – distance from the object to the lens (cm)
  • di – distance from the lens to the image (cm)

All distances must be in the same unit. The formula assumes a thin lens and paraxial rays (small angles). For real thick lenses, results are approximate.

Worked Example

Using the default values: object distance = 200 cm, image distance = 10 cm.

  1. Write the formula: f = (do × di) / (do + di)
  2. Plug in the numbers: f = (200 × 10) / (200 + 10)
  3. Multiply: 200 × 10 = 2000
  4. Add: 200 + 10 = 210
  5. Divide: 2000 / 210 = 9.5238…
  6. Rounded to 2 decimals: f = 9.52 cm

The calculator shows 9.52 cm, matching the hand calculation. The magnification is 10 / 200 = 0.05 (the image is 5% the size of the object).

When to Use a Focal Length Calculator

You might need this in several real situations:

  • Photography: estimating the focal length of an unknown lens by measuring the distance from the lens to the sensor when focused on a distant object.
  • Telescope or microscope design: determining the eyepiece or objective focal length from known distances.
  • DIY projection: building a projector or camera obscura, where you know the throw distance and image size.
  • Vision science: simple optics experiments with a light source, lens, and screen.

For photography, you often know the sensor size and field of view instead. Then the focal length is calculated as:

f = (sensor dimension) / (2 × tan(field of view / 2))

That formula is not implemented here, but it is the alternative when distances are hard to measure.

How to Choose the Right Focal Length

If you are selecting a lens for a camera or telescope, the focal length determines magnification and field of view:

  • Short focal length (wide angle): wider field of view, less magnification. Good for landscapes, architecture, and astrophotography of large regions.
  • Long focal length (telephoto): narrow field of view, high magnification. Good for wildlife, sports, and planetary imaging.
  • Normal focal length: roughly equal to the sensor diagonal, giving a natural perspective similar to human vision.

Use the calculator backward: if you know the desired magnification and object distance, solve for di and then f. For example, to get a 0.1× magnification with an object at 500 cm, you need di = 50 cm, and f = (500×50)/(550) ≈ 45.45 cm.

Common Mistakes and Misconceptions

One frequent error is mixing units. If do is in meters and di in centimeters, the result is wrong. Always convert to the same unit before calculating.

Another mistake is using the thin lens equation for thick lenses or very close objects. The formula assumes a lens of negligible thickness and small angles. For macro photography (magnification > 0.5), the thin lens approximation becomes less accurate, and you should use the thick lens formula or measure the focal length directly.

A common misconception is that focal length changes with object distance. It does not for a fixed lens; the image distance changes instead. The calculator solves for f given the two distances, but if you change the object distance, the image distance changes to keep f constant (for a focusing lens).

Limitations and Accuracy

The thin lens equation is a simplification. Real lenses have thickness, aberrations, and a principal plane that may not be at the physical center. For precise work, you need the lens’s cardinal points, which are rarely specified. The calculator gives a good estimate for typical photography distances (object distance much larger than focal length) and for simple single-element lenses.

Also, the formula assumes the lens is in air and the object is a point on the optical axis. Off-axis objects introduce distortion, but the focal length calculation remains valid.

For camera lenses, the stated focal length is usually for infinity focus. When you focus closer, the effective focal length can change slightly due to internal focusing elements, but the difference is small for most purposes.

Alternatives to the Thin Lens Equation

If you cannot measure the image distance (e.g., inside a camera), you can determine focal length from field of view and sensor size:

  • Measure the angle of view (in degrees) for a known sensor dimension (width, height, or diagonal).
  • Use f = (sensor dimension) / (2 × tan(angle/2)).
  • For a full-frame camera (36 mm wide), a 50° horizontal field of view gives f = 36 / (2 × tan(25°)) ≈ 38.6 mm, close to a common 35 mm lens.

Another method is the “distant object� approach: focus on a very distant object (like the Moon), measure the distance from the lens to the image plane, and that distance is approximately the focal length.

For zoom lenses, the focal length varies; you can calculate the range from the minimum and maximum field of view.

Frequently Asked Questions

What units should I use? Any unit works as long as you use the same unit for both object and image distances. The focal length will come out in that same unit. If you want millimeters, enter both distances in millimeters.

Can I use this for a camera lens? Yes, but you need to know the image distance, which is the distance from the lens’s optical center to the sensor. That is not usually printed. You can estimate it by focusing on a distant object and measuring the lens barrel extension, or use the field-of-view method instead.

What is the difference between focal length and magnification? Focal length is a property of the lens (in mm or cm). Magnification is the ratio of image size to object size (di/do). A longer focal length generally gives higher magnification, but the object distance also matters.

Why does the calculator show a result in centimeters when camera lenses are in millimeters? The calculator uses the units you enter. The default is centimeters for convenience, but you can enter millimeters by changing the values. The output will be in millimeters if you do.

Does this work for concave lenses? The thin lens equation works for both convex and concave lenses if you use sign conventions. For a concave lens, the focal length is negative. This calculator assumes positive distances, so it is only valid for converging (convex) lenses forming real images.

What if my object is at infinity? When the object is at infinity, 1/do becomes zero, so f = di. That means the focal length equals the image distance. You can simulate this by entering a very large object distance, like 1,000,000 cm, and the calculator will give f ≈ di.

Related

Formula used
in d_o | Object distance | cm | 200 | 0
in d_i | Image distance | cm | 10 | 0
out f | Focal length | cm | (d_o * d_i) / (d_o + d_i) | 2
out magnification | Magnification | - | d_i / d_o | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.