Thin Lens Calculator1/f = 1/do + 1/di

The thin lens equation links focal length, object distance and image distance: 1/f = 1/do + 1/di. Magnification is m = −di ÷ do. Enter the focal length and object distance to find where the image forms, how big it is, and whether it is real or virtual and upright or inverted. You can also solve for the focal length or convert to lens power in dioptres. A scaled ray diagram traces the principal rays.

Formula verified against OpenStax — University Physics, Volume 3 · HyperPhysics, Georgia State University

Manzoor AhmadBy Manzoor Ahmad · Pharmacist & calculator developer
Reviewed & updated

Lens & object

Converging (convex) lens: f > 0. Diverging (concave) lens: f < 0.

Quick presets
Principal rays from the object’s tip meet at the image. Dashed lines show a virtual image traced back through the lens.
Result
—

Step-by-step working

    What is thin lens?

    A thin lens is a lens whose thickness is small compared with its focal length, so it can be treated as bending light at a single plane. The thin lens equation then predicts exactly where images form.

    The same equation describes camera lenses, eyeglasses, magnifiers, projectors and the lens in your eye, which changes its focal length to keep the image distance fixed on your retina.

    Quick answers

    How do I find the image distance of a lens?

    Use di = 1 ÷ (1/f − 1/do). With f = 20 cm and an object at 60 cm, the image forms at 30 cm on the far side.

    How do you calculate magnification?

    m = −di ÷ do. A negative m means the image is inverted; |m| > 1 means it is enlarged.

    How do I convert focal length to dioptres?

    Power (D) = 1 ÷ f in metres. A +2.5 D reading lens has f = 40 cm; a −4 D myopia lens has f = −25 cm.

    Why is a magnifying glass image upright?

    With the object inside the focal length, the rays diverge after the lens and only appear to come from a virtual, upright, enlarged image. It all starts with refraction at each curved surface.

    Thin lens equation

    1/f = 1/do + 1/dim = −di ÷ do = hi ÷ hoP = 1 ÷ f (m)

    Sign convention: real images have di > 0, virtual images di < 0. Negative m means the image is inverted.

    SymbolMeaningSI unit
    fFocal length (+ converging, − diverging)m
    doObject distance from the lensm
    diImage distance from the lensm
    mMagnification—
    POptical powerdioptres (m⁻¹)

    How to use the thin lens equation

    1. Write 1/f = 1/do + 1/di with consistent units.
    2. Rearrange: 1/di = 1/f − 1/do.
    3. Invert to get di, and note its sign.
    4. Find the magnification m = −di ÷ do to get the image size and orientation.

    Worked example: f = 10 cm, object at 30 cm

    An object stands 30 cm from a converging lens with a 10 cm focal length.

    1/di = 1/10 − 1/30 = 2/30 → di = 15 cm
    m = −15 ÷ 30 = −0.5: real, inverted, half size

    Move the object to 5 cm, inside the focal length, and di = 1 ÷ (1/10 − 1/5) = −10 cm. That is a virtual, upright image magnified 2×, how a magnifying glass works.

    Image types for a converging lens

    Object positionImageExample
    Beyond 2fReal, inverted, smaller, between f and 2fCamera, eye
    At 2fReal, inverted, same size, at 2fPhotocopier 1:1
    Between f and 2fReal, inverted, larger, beyond 2fProjector
    At fNo image (rays parallel)Spotlight, collimator
    Inside fVirtual, upright, largerMagnifying glass

    Common mistakes to avoid

    • Mixing up the signs. Diverging lenses have negative f, and virtual images negative di.
    • Mixing units. Use the same unit for f and both distances. Dioptres need metres.
    • Using the thin-lens formula for thick or compound lenses without principal-plane corrections.
    Manzoor Ahmad

    Manzoor Ahmad

    Pharmacist turned Web Developer & Calculator Engineer · 13+ years in web development

    I’m a pharmacist by training who turned into a full-time tech geek, and for 13+ years I’ve designed and coded web tools. My pharmacy degree included physical pharmacy and pharmaceutics — states of matter, heat, flow and reaction kinetics — so the physics behind these tools is familiar ground, not a new hobby.

    I’m not a physicist, so I don’t ask you to take my word for it: every formula on this page is traced to an open university textbook or NIST reference data, and the calculator is tested against published worked examples before it goes live. Spot an error? Tell me and it will be fixed and dated on the next update.

    Thin Lens Calculator: frequently asked questions

    1/f = 1/do + 1/di, relating focal length to object and image distances.

    The image is virtual and sits on the same side of the lens as the object.

    m = −di ÷ do = hi ÷ ho.

    The unit of optical power, 1 ÷ focal length in metres. Eyeglass prescriptions are written in dioptres.

    When the lens thickness is small compared with its focal length and the object and image distances.

    References & sources

    1. OpenStax — University Physics, Volume 3 — Ch. 2.4, Thin Lenses
    2. HyperPhysics, Georgia State University — thin lens equation
    3. OpenStax — College Physics 2e — Ch. 25.6, Image Formation by Lenses

    Disclaimer: This calculator is an educational tool built on idealised textbook models. It is not a substitute for professional engineering or safety calculations.