Lens ray diagram: convex and concave lenses, the lens formula and power in dioptres

Drag an object in front of a convex or concave lens and watch the principal rays find the image: where it forms, how big it is, real or virtual, with the lens formula, magnification and power worked out with signs.

Keep it one tap away for everyday use.

Bookmark Lens ray diagram?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Pick lens
  2. Move object
  3. See rays
  4. Formula
Nothing is uploadedWorks offline once open

Put the object at a standard position:

Drag the object along the axis (or tap where you want it), or use the sliders. Coloured lines are the rays; a dashed line is where a ray only seems to come from.

The image

Lens formula, with signs

 

Sign convention: distances are measured from the optical centre O. Light comes from the left, so the object is at a negative u. Distances to the right of the lens are positive, to the left negative; heights up are positive. A convex lens's f is positive, a concave lens's negative. Power P = 1/f with f in metres, in dioptres (D).

Where is the image?

ObjectImageSizeNature

Try this

  • Start far from a convex lens and slide the object in. The real image moves away from the lens and grows; at 2F₁ it is exactly the same size.
  • Put the object at F₁: the rays leave the lens parallel, so the image is at infinity. A projector puts its slide just outside F₁ to get a big image far away.
  • Move the object inside F₁. The image jumps to the same side as the object, upright and bigger: a magnifying glass.
  • Switch to a concave lens. The image is always upright, smaller and between F₁ and O, wherever the object is.

Check yourself

Fresh numbers each time. Give distances in cm and powers in dioptres, with their sign (for example −30). Nothing is saved.

What it does

A lens bends light as it passes through. A convex lens (thicker in the middle) brings rays together and can make a real image you can catch on a screen; a concave lens (thinner in the middle) spreads them apart and only ever makes a virtual image you see by looking through it. This tool draws the principal rays to scale, so you can watch the image move, grow, shrink and flip as you drag the object along the axis.

It follows the Class 10 Science chapter on light (refraction by spherical lenses, the image table, the lens formula, magnification and power) and the Class 12 Physics chapter on ray optics (sign convention, thin lenses in contact). Before this, try the same with curved mirrors in mirror ray diagram; after it, see how two lenses make a telescope in telescope calculator or trace real thick lenses in lens ray tracer.

How to use it

  1. Pick Convex or Concave.
  2. Tap a standard position (for a convex lens: at infinity, beyond 2F₁, at 2F₁, between F₁ and 2F₁, at F₁, between F₁ and O) or drag the object in the picture. It snaps onto F₁ and 2F₁ when you get close.
  3. Change the focal length with its slider, or type exact numbers. Type “infinity” for a very distant object.
  4. Read the image’s nature, size and position, the signed numbers and the worked lens formula. The table highlights the row for your object’s position.
  5. Class 12 adds the image height for an object height you choose and a box for two lenses in contact.

The rays it draws

  • A ray parallel to the axis bends through F₂ (convex) or bends away as if it came from F₁ (concave).
  • A ray through the optical centre O goes straight on without bending.
  • A ray through F₁ (convex), or heading for F₂ (concave), comes out parallel to the axis.

Solid lines are real light; dashed lines show where rays only seem to come from. A dashed image arrow is a virtual image.

Sign convention and power

Distances are measured from the optical centre O. The object is on the left, where light comes from, so u is negative; anything to the right of the lens is positive. A convex lens has a positive f, a concave lens a negative f. Then 1/v − 1/u = 1/f and m = v/u work for every case. The power P = 1/f with f in metres, measured in dioptres (D): a convex lens of 50 cm is +2 D, a concave lens of 25 cm is −4 D. Lenses in contact simply add their powers.

Worked example

The page opens with a convex lens of focal length 10 cm and the object 20 cm away, which is at 2F₁. With signs, u = −20 cm and f = +10 cm. Then 1/v = 1/10 + 1/(−20) = 0.05, so v = 20 cm: the image is at 2F₂ on the other side. The magnification is m = v/u = 20/(−20) = −1: same size, upside down, real. The power is 1/0.1 m = +10 D.

Drag the object to 5 cm (inside F₁) and the formula gives v = −10 cm and m = +2: an upright image twice as tall, on the same side as the object. That is a magnifying glass. In Class 12 mode, put a −20 cm concave lens against the 10 cm lens: P = 10 + (−5) = +5 D, so the pair acts like one convex lens of 20 cm.

Check yourself

Four short questions with fresh numbers each time: image distance, magnification, focal length and power. Type your answer with its sign and press Check; Show working reveals the steps. Nothing is saved or sent anywhere.

FAQ

Why does the ray bend only once, in the middle of the lens? For a thin lens the two bends at the front and back surfaces add up to one bend, so school diagrams (and this tool) draw it at the centre line.

Why is f positive for a convex lens but negative for a concave mirror, which also brings light together? In the sign convention, a converging lens’s focus F₂ is to the right (positive), while a concave mirror’s focus is in front of it, to the left (negative).

What do opticians’ prescriptions like −1.5 mean? That is the power in dioptres: −1.5 D is a concave lens of focal length 1/1.5 m, about 67 cm.

This is a teaching model for school optics. It is not connected to NCERT or any exam board.

Where the numbers come from

  • Lens formula 1/v − 1/u = 1/f, magnification m = v/u, power P = 1/f in dioptres, P = P₁ + P₂ for thin lenses in contact, and the New Cartesian sign convention: standard school optics, as taught in Class 10 and Class 12 physics. All numbers in the examples and questions are made up.
  • Checked against an independent Python calculation of the lens formula (exact fractions) for every standard position and against hand-worked examples.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Change log for Lens ray diagram

  1. Add #1002 Lens ray diagram Details on GitHub

Every change to fibub

Related tools

Lens ray tracer #T667 Type a lens system as a list of spherical surfaces and trace exact rays through it: focal length, f-number, image position, a spot diagram against the Airy disc, spherical aberration, ray fans, best focus, distortion and Petzval field curvature, drawn as a lens layout. Telescope calculator #T19 Enter your telescope, eyepieces and camera to see magnification, true field, exit pupil, faintest stars, image scale and whether your camera suits your seeing, with a picture of what fits in the view. Mirror ray diagram #L1 Drag an object in front of a concave or convex mirror and watch the principal rays find the image: where it forms, how big it is, real or virtual, with the mirror formula and magnification worked out with signs. Snell's law #L3 Aim a ray of light at the boundary between air, water, glass or diamond and see it bend by Snell's law, find the critical angle and total internal reflection, the sideways shift through a glass slab, and why a pool looks shallower than it is. Prism and dispersion #L4 Shine a ray through a glass prism and see it bend twice: the angles at both faces, the angle of deviation, the deviation graph with its minimum, and white light splitting into a spectrum from red to violet. Eye defects #L5 See how the eye lens changes its power to focus near and far, what goes wrong in short sight, long sight and presbyopia, and which lens fixes each one, with the power in dioptres worked out. Microscope and telescope #L6 Set the focal lengths of a magnifying glass, a compound microscope or a refracting telescope and see the rays, the images and the magnification, with the final image at infinity (normal adjustment) or at the near point. Plane mirror lab #L115 Drag a laser at a flat mirror and see that the angle of reflection always equals the angle of incidence. Put two mirrors at any angle and count the images (360/θ − 1), then tilt the mirrors of a periscope until light gets through.