Audited ·Last updated 27 Jul 2026·5 citations·Tier 1·0 uses

Lens Equation Calculator

Solve thin-lens problems for image distance, object distance, or focal length. Includes magnification and sign conventions with step-by-step physics.

Lens Equation Calculator

Solve For
Solved Unknown
24
Linear Magnification (m)
-0.6

Background.

The thin-lens equation calculator solves for image distance, object distance, or focal length given any two of these quantities, and computes the linear magnification produced by a spherical lens. This relationship is central to geometric optics, the branch of physics that treats light as rays traveling in straight lines and bending at interfaces. Every camera, eyeglass, microscope, and telescope relies on the thin-lens approximation, and students encounter it in high school physics, undergraduate optics courses, and medical school curricula where the eye is modeled as a variable-focus lens system. The calculator removes the algebraic burden of rearranging the reciprocal equation, allowing users to focus on the physical interpretation of real versus virtual images, upright versus inverted orientations, and the conditions under which the approximation holds.

Search interest in lens equation calculators is driven by both academic and practical needs. Photography enthusiasts learning manual focus need to understand how subject distance and focal length determine image position on a sensor. Optometry students calculate image formation by corrective lenses. Physics undergraduates verify laboratory measurements of object and image distances for converging and diverging lenses. The thin-lens equation is also a standard topic on the Medical College Admission Test and the physics subject GRE, meaning pre-med and graduate-school applicants constitute a significant fraction of search traffic. Unlike more advanced optics tools that require wavefront aberration data or ray-tracing software, the thin-lens equation is solvable with three algebraic variables, making it ideal for a programmatic calculator.

The thin-lens equation is not an exact law of nature but a paraxial approximation valid when light rays make small angles with the optical axis. It was developed from the work of Descartes, who in 1637 published the law of refraction, and later from the systematic lens studies of Isaac Newton and Leonhard Euler. The modern form, 1/f = 1/do + 1/di, assumes the lens thickness is negligible compared with its radii of curvature and object distances. Under this assumption, refraction at the two spherical surfaces can be combined into a single effective bending power characterized by the focal length f. The magnification m = -di/do follows from similar triangles formed by the object, the optical axis, and the chief ray passing through the lens center.

In practice, the thin-lens equation is accurate to within a few percent for most simple lenses used in teaching laboratories, provided the object is not placed extremely close to the focal point where aberrations dominate. Real camera lenses contain multiple elements precisely to violate the thin-lens assumption in a controlled way, correcting chromatic and spherical aberrations that the single-surface model ignores. Nevertheless, the thin-lens equation remains the essential first step in any optical design, establishing the approximate element positions before refinement with ray-tracing software such as Zemax or Code V. For students and hobbyists, it provides quantitative insight into why a 50 millimeter lens focuses distant objects at roughly 50 millimeters from the sensor and why bringing the object closer requires extending the lens farther from the image plane, a principle still visible in the helical focus mechanisms of rangefinder cameras.

What is lens equation calculator?

The thin-lens equation relates the object distance, image distance, and focal length of an idealized lens whose thickness is negligible compared with the radii of its surfaces. For a spherical lens in air, the equation is 1/f = 1/do + 1/di, where do is the distance from the object to the lens center, di is the distance from the lens center to the image, and f is the focal length. All distances are measured in meters or any consistent length unit. The magnification is m = -di/do, a dimensionless ratio describing the image size relative to the object size. A negative magnification indicates an inverted image; a positive magnification indicates an upright image.

The sign convention used here follows the Cartesian convention: light travels from left to right, object distances are positive for real objects on the left side of the lens, and image distances are positive for real images formed on the right side of the lens. Converging lenses have positive focal lengths; diverging lenses have negative focal lengths. The equation is valid only in the paraxial regime, where rays make small angles with the optical axis, and for monochromatic light where dispersion can be neglected. At large apertures or extreme object distances, spherical aberration and coma degrade the image quality beyond what the thin-lens model predicts.

How to use this calculator.

  1. Measure or note the focal length of the lens from its specification or manufacturer data.
  2. Measure the distance from the object to the center of the lens.
  3. Enter the two known distances into the calculator, ensuring consistent units.
  4. Select the unknown quantity: image distance, object distance, or focal length.
  5. Review the computed image distance and its sign to determine whether the image is real or virtual.
  6. Examine the magnification to predict image size and orientation.
  7. Verify that the object distance satisfies the paraxial approximation for your lens aperture.

The formula.

1⁄f = 1⁄do + 1⁄di

The thin-lens equation derives from applying the law of refraction at each spherical surface of a lens and then taking the limit where the lens thickness approaches zero. Consider a lens with two spherical surfaces of radii R1 and R2, separating media with refractive indices n_lens and n_surrounding. For a ray passing from object to image through the lens, Snell's law applied at each surface yields two equations relating the object distance, image distance, and surface curvature. When the lens is thin, the intermediate image formed by the first surface serves as the object for the second surface at essentially the same location. Adding the two surface equations and using the small-angle approximation sin θ ≈ θ eliminates the intermediate variable, producing the lensmaker's equation: 1/f = (n_lens/n_medium - 1)(1/R1 - 1/R2).

The lensmaker's equation shows that focal length depends on the refractive index and surface curvatures. For a given lens, these are fixed, so the thin-lens equation 1/f = 1/do + 1/di describes how object and image distances trade off while maintaining the constant focal length. When do approaches infinity, 1/do vanishes and di equals f, defining the focal length as the image distance for an infinitely distant object. When do equals 2f, di also equals 2f and the magnification is -1, producing a real, inverted image the same size as the object. When do is between f and 2f, di exceeds 2f and the magnification is less than -1, producing a real, enlarged, inverted image—the configuration used by projectors.

The magnification formula follows from tracing a ray through the center of the lens, which is undeflected because the two surfaces are locally parallel at the axis. Similar triangles formed by the object height and image height give hi/ho = di/do. The negative sign in m = -di/do encodes the inversion of real images. For virtual images formed by diverging lenses or by converging lenses with objects inside the focal length, di is negative, yielding a positive magnification that indicates an upright, reduced image. This sign convention, while arbitrary in choice, is internally consistent and universally adopted in introductory optics texts.

A worked example.

Example

A converging lens with a focal length of 15.0 centimeters forms an image of an object placed 40.0 centimeters from the lens. To find the image distance, begin with the thin-lens equation 1/f = 1/do + 1/di. Substitute f = 15.0 cm and do = 40.0 cm, giving 1/15.0 = 1/40.0 + 1/di. Subtract 1/40.0 from both sides: 1/di = 1/15.0 - 1/40.0 = (40.0 - 15.0)/(15.0 × 40.0) = 25.0/600 = 1/24.0. Therefore di = 24.0 cm. The positive image distance indicates a real image formed on the opposite side of the lens from the object. The magnification is m = -di/do = -24.0/40.0 = -0.600, meaning the image is inverted and reduced to 60 percent of the object's height. This result agrees with the standard textbook case of an object placed beyond twice the focal length of a converging lens, producing a real, inverted, diminished image between f and 2f on the far side.

object Distance40
focal Length15

Frequently asked questions.

What is the difference between a real image and a virtual image?
A real image is formed when light rays actually converge at a point in space, allowing the image to be projected onto a screen or sensor. In the thin-lens equation, real images correspond to positive image distances di when using the Cartesian sign convention. A virtual image is formed when diverging rays appear to originate from a common point behind the lens; no light actually passes through that point, so the image cannot be projected. Virtual images correspond to negative image distances. Converging lenses produce virtual images when the object is inside the focal length, as in a magnifying glass. Diverging lenses always produce virtual, upright, reduced images regardless of object distance. The distinction is fundamental to designing instruments: camera sensors require real images, while eyepieces present virtual images to the relaxed eye.
Why is the focal length positive for converging lenses and negative for diverging lenses?
The sign convention assigns positive focal lengths to lenses that converge parallel rays to a real focal point on the far side of the lens, and negative focal lengths to lenses that cause parallel rays to diverge as if they originated from a virtual focal point on the near side. This convention is consistent with the lensmaker's equation, 1/f = (n - 1)(1/R1 - 1/R2), where the radii signs depend on whether the surface center of curvature lies to the right or left of the surface vertex. A biconvex lens has R1 positive and R2 negative, making the term (1/R1 - 1/R2) positive and therefore f positive. A biconcave lens reverses these signs, yielding a negative focal length. The sign is not a physical property of the glass but a bookkeeping convention that ensures the thin-lens equation predicts the correct image location algebraically.
Can the thin-lens equation be used for mirrors?
Yes, with a modified sign convention. Spherical mirrors obey the identical equation 1/f = 1/do + 1/di, where f = R/2 for a spherical mirror of radius R. The sign convention for mirrors places real objects and real images on the same side of the mirror. Concave mirrors have positive focal lengths because they converge parallel rays; convex mirrors have negative focal lengths because they diverge them. The magnification formula m = -di/do applies unchanged. The derivation differs—mirrors rely on the law of reflection rather than refraction—but the resulting algebraic relationship between object distance, image distance, and focal length is identical. Many introductory physics texts present the mirror equation as a special case of the refraction formalism.
What happens when an object is placed exactly at the focal point?
When do equals f, the thin-lens equation predicts 1/di = 1/f - 1/f = 0, so di approaches infinity. Physically, rays originating from the focal point emerge from the lens parallel to the optical axis, never converging to form an image. In practice, placing an object infinitesimally inside or outside the focal point produces an image at a very large finite distance. This configuration is exploited in collimators, which convert a point source at the focus into a parallel beam, and in lighthouses, where a source at the focal point of a large Fresnel lens produces a directed beam. The singularity at do = f is a mathematical artifact of the idealized thin-lens model; real lenses with finite apertures produce a blurred pattern at infinity rather than true parallel rays.
Why does the magnification have a negative sign?
The negative sign in m = -di/do encodes image orientation relative to the object. In the standard Cartesian sign convention, a real image formed by a single converging lens is inverted, meaning the image height points opposite to the object height. Because di and do are both positive for a real object and real image, the ratio di/do is positive, and the explicit negative sign makes m negative, signaling inversion. For a virtual image formed by a converging lens with the object inside the focal length, di is negative while do is positive, so m is positive, signaling an upright image. The sign convention is arbitrary but self-consistent; what matters is that the formula correctly predicts orientation when the sign rules are applied uniformly.
What are the limits of the thin-lens approximation?
The thin-lens approximation assumes the lens thickness is negligible compared with object distances, image distances, and radii of curvature. It also assumes paraxial rays, meaning rays that make small angles with the optical axis so that sin θ ≈ θ and tan θ ≈ θ. When these conditions fail, several aberrations appear. Spherical aberration causes marginal rays to focus at a different point than paraxial rays. Chromatic aberration arises because the refractive index varies with wavelength, so different colors focus at different distances. Coma, astigmatism, and field curvature distort off-axis images. Camera lenses and microscope objectives contain multiple elements precisely to cancel these aberrations. The thin-lens equation remains useful for estimating first-order behavior, but precise optical design requires ray-tracing software.
How do I handle the sign convention consistently?
The Cartesian convention used here defines light traveling from left to right. Object distances are positive for real objects on the left side of the lens. Image distances are positive for real images on the right side and negative for virtual images on the left. Focal lengths are positive for converging lenses and negative for diverging lenses. Magnification is negative for inverted images and positive for upright images. The only way to ensure consistency is to assign signs to all quantities before substituting into the equation, rather than inserting absolute values and guessing the sign afterward. A common student error is to treat all distances as positive magnitudes and then manually add or remove minus signs, which leads to incorrect predictions for virtual images and diverging lenses.
Can I use this calculator for camera lenses?
The calculator provides a first-order estimate for simple camera lenses but not for modern multi-element systems. A basic 50 millimeter prime lens behaves approximately like a single thin lens with f = 50 mm: an object at infinity focuses at the focal plane, and an object at 1 meter focuses slightly beyond 50 mm. However, real camera lenses contain six to twenty elements to correct aberrations, and their effective focal length may change with focus distance. The thin-lens equation ignores the principal plane separation in thick lenses, which shifts the object and image distances relative to the physical lens mount. For rough depth-of-field estimates and educational purposes, the thin-lens approximation is adequate; for professional lens design, manufacturers use proprietary ray-tracing models.
What is the lensmaker's equation and how does it relate to the thin-lens equation?
The lensmaker's equation, 1/f = (n - 1)(1/R1 - 1/R2), determines the focal length of a lens from its refractive index n and surface radii R1 and R2. It is derived by applying Snell's law at each spherical surface and combining the results in the thin-lens limit. Once f is known from the lensmaker's equation, the thin-lens equation 1/f = 1/do + 1/di relates object and image distances without reference to the surface details. Thus the lensmaker's equation characterizes the lens itself, while the thin-lens equation describes how that lens images arbitrary objects. The two are connected by the single parameter f, which encapsulates all the lens's intrinsic optical properties.
Why do objects closer than the focal length produce virtual images?
When an object is inside the focal length of a converging lens, the rays diverging from the object are not bent sufficiently to converge on the far side. Instead, they emerge from the lens still diverging, but with a reduced divergence that makes them appear to come from a point on the same side as the object. The eye or a camera placed on the far side intercepts these diverging rays and interprets them as originating from a virtual point. Algebraically, when do < f, the term 1/do exceeds 1/f, so 1/di = 1/f - 1/do becomes negative, yielding a negative di. This is the operating principle of a simple magnifier: the virtual image is farther away than the object and enlarged, reducing eye strain by allowing the eye to focus at a comfortable distance.

References& sources.

  1. [1]Hecht, E. (2017). Optics, 5th ed. Pearson. Ch. 5.
  2. [2]Smith, W.J. (2008). Modern Optical Engineering, 4th ed. SPIE Press. Ch. 2.
  3. [3]Pedrotti, F.L., Pedrotti, L.M., & Pedrotti, L.S. (2007). Introduction to Optics, 3rd ed. Pearson. Ch. 3.
  4. [4]Greivenkamp, J.E. (2004). Field Guide to Geometrical Optics. SPIE Press. Ch. 1.
  5. [5]Jenkins, F.A. & White, H.E. (2001). Fundamentals of Optics, 4th ed. McGraw-Hill. Ch. 5.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 313 calculators remain free
  • No billing is enabled
Coming soon