Lens magnification calculator
Find out how big the image is and which way up: an object at 30 with its image at 60 gives a magnification of -2, an inverted image twice the object's size. Works for lenses and mirrors. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
Linear magnification tells you how much larger or smaller an image is compared with the object, and whether the image is upright or inverted. For a thin lens or a single spherical mirror the textbook relation is simply m equals minus the image distance over the object distance. This calculator takes those two signed distances in any consistent length unit, returns the signed magnification, its absolute value, an orientation label, and a size class, and rejects a zero object distance so you never divide by zero.
How linear magnification is defined for lenses and mirrors
In elementary geometric optics the linear or transverse magnification of a thin lens or spherical mirror is defined as the ratio of image height to object height. With the standard classroom Gaussian convention that ratio is also equal to the negative of the image distance divided by the object distance, written m equals minus v over u. The minus sign is not cosmetic: when a real object with positive object distance produces a real image with positive image distance, m is negative and the image is inverted.
When the image is virtual, for example for an object inside the focal length of a magnifying glass, the image distance is negative, m is positive, and the image is upright. Absolute magnification greater than one means the image is enlarged; less than one means it is reduced; exactly one means same size. Because only the ratio of distances enters the formula, you may work in centimeters, meters, or millimeters as long as both distances use the same unit.
This capability does not rearrange the thin-lens equation to solve for a missing distance or focal length; it only evaluates the magnification once both distances are known. Object distance must be finite and non-zero; image distance must be finite and may be zero, which yields zero magnification corresponding to an image height collapsed to a point in the ideal model.
Where lens magnification calculators show up in real work
Secondary-school and college optics courses assign endless thin-lens and mirror problems that ask for magnification, orientation, and whether the image is enlarged; a single trusted oracle that returns signed m plus human-readable labels speeds grading and demo setup. Camera and projector designers estimate image scale on a sensor or screen from measured object and image conjugate distances long before full ray tracing. Microscopy and telescope teaching labs compare linear magnification of intermediate images with angular magnification of the eyepiece and need the linear part first.
If you later need focal-length solving from the thin-lens equation, angular magnification of telescopes, or multi-element system ray tracing, treat those as separate search intents and landings rather than overloading this linear magnification page.
What you can do with it
Homework and lab answer keys
Compute signed linear magnification, orientation, and size class from textbook u and v so teachers and auto-graders share one ground truth.
Camera and projector image scale
Estimate how large a subject maps onto a sensor or screen from measured object and image conjugate distances before full optical design.
FAQ
What happens if the object distance is zero?
Magnification m = −v/u is undefined when the object distance is zero, so the calculator refuses to divide by zero.
Do I need matching units for object and image distance?
Yes. Use the same length unit for both (cm, m, mm, …). Magnification is dimensionless; inconsistent units would silently scale the ratio.
Does the sign of the distances matter?
Yes. Under the common textbook convention, real object and real image (both positive) give negative m (inverted); a virtual image (negative v) with positive u gives positive m (upright).
What does it cost?
The browser tool is free and runs locally.
What does a magnification of -2 mean?
The image is twice as large as the object and inverted. The absolute value gives the size, and the minus sign tells you the image is upside down, as with an object at 30 and its image at 60.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/optics/lens-magnification \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"object_distance":30,"image_distance":60}'const res = await fetch("https://api.kit.forhosting.com/optics/lens-magnification", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"object_distance": 30,
"image_distance": 60
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/optics/lens-magnification",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"object_distance": 30,
"image_distance": 60
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/optics/lens-magnification", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"object_distance":30,"image_distance":60}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"object_distance":30,"image_distance":60}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/optics/lens-magnification", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"object_distance": 30,
"image_distance": 60
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "optics.lens_magnification",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How linear magnification is defined for lenses and mirrors
The pipeline is pure floating-point arithmetic with no network, no random seeds, and no wall-clock timestamps, so identical signed distances always produce identical JSON.
What you send and what you get back
Both fields are required. Classic checks include a real object at u equals thirty centimeters with a real image at v equals sixty centimeters giving m equals negative two with inverted orientation and enlarged size, a virtual image case with negative v yielding upright positive magnification, and the explicit zero object-distance error path. Wire the free browser form for homework and lab demos, then call the identical contract from scripts when you need bulk answer keys. Send two finite numbers under the fields object_distance and image_distance, representing u and v in any consistent length unit. Aliases such as u, do, object, s_o for the object distance and v, di, image, s_i for the image distance are accepted so scripts written against common textbook notation do not need a rename layer. Missing fields, non-numeric strings, NaN, and Infinity fail with invalid_input and are not charged. When the object distance is zero or extremely close to zero the request fails with a clear message that m equals minus v over u is undefined, so clients can fix their geometry rather than guessing. On success the response echoes cleaned object_distance and image_distance, the signed magnification, abs_magnification as the absolute value, orientation as inverted when m is negative, upright when m is positive, or point when m is approximately zero, size as enlarged, reduced, or same_size depending on whether the absolute value is greater than, less than, or equal to one, plus formula and unit strings for display. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where lens magnification calculators show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Inspection fixtures and pixel scale
Combine m with sensor pitch to predict millimeters per pixel when part and camera planes are fixed in a machine-vision station.
Technical questions
What formula does this lens magnification calculator use?
Linear (transverse) magnification m = −v/u, where u is object_distance and v is image_distance. The response also returns |m|, orientation (inverted/upright/point), and size (enlarged/reduced/same_size).