Optical path length calculator
Light crossing 0.25 m of material with a refractive index of 1.5 covers an optical path of 0.375 m: distance times index, shown step by step. Handy for interference and lab checks in a single uniform medium. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Physical path length m
- 0.25
- Refractive index
- 1.5
- Optical path length m
- 0.375
This optical path length calculator finds the effective distance light travels through a uniform medium by multiplying the physical path length by the medium’s refractive index. Enter the distance in metres and a dimensionless refractive index to receive the optical path length in metres, normalized inputs, explicit units, and readable substitution steps. The calculation uses OPL = n × L, a standard relation for a single homogeneous region. It is useful for optics coursework, interferometer planning, laboratory checks, and software tests that need reproducible values.
What optical path length represents
Optical path length describes how far light effectively travels when the refractive properties of a medium are taken into account. For a single uniform medium, it equals the physical distance L multiplied by the dimensionless refractive index n. A ray that crosses 0.25 metres of material with refractive index 1.5 therefore accumulates an optical path length of 0.375 metres.
The result is expressed as a length even though one factor is an index, because refractive index has no unit. In vacuum, where n is conventionally 1, optical path length equals physical path length. In common transparent materials with an index greater than 1, optical path length is greater than the geometric distance.
This quantity is central to phase comparisons: two rays can travel different physical routes yet accumulate equal optical paths, or travel equal physical distances through different materials and accumulate different optical paths. The calculator intentionally handles one homogeneous region, making the governing formula direct and auditable. It does not infer the index from a material name or wavelength, and it does not apply Snell’s law to determine the ray’s geometric route.
Supply the actual traveled distance inside the medium and the refractive index appropriate to your model, wavelength, and conditions.
Scope, assumptions, and practical applications
Use this calculator when the light path lies entirely within one region whose refractive index can be treated as constant. That approximation fits many introductory problems, quick laboratory estimates, and individual segments in a larger optical model. If a ray passes through several uniform materials, calculate n multiplied by L for each segment and add the segment optical path lengths outside this single-medium capability.
If the index changes continuously with position, the correct model is an integral of n along the path rather than one multiplication. Also remember that refractive index can depend on wavelength, temperature, pressure, polarization, and material composition; the solver uses the number you provide and does not select or verify a material property. Optical path length is not the same as the geometric ray path, focal length, lens power, or an automatic travel-time calculation.
It can support interferometer arm comparisons because phase differences depend on optical path differences, but this response does not calculate wavelength cycles or phase angles. For reliable work, document where the refractive index came from, keep all path lengths in metres, preserve adequate source precision, and split compound systems into physically meaningful uniform sections before summing their contributions.
What you can do with it
Interferometer path comparison
Estimate the optical contribution of a uniform glass, liquid, or air segment before comparing two interferometer arms.
Optics coursework checks
Verify hand calculations of OPL = n × L with explicit substitution steps and consistent SI units.
FAQ
What is the optical path length formula?
For one uniform medium, optical path length is OPL = n × L, where n is refractive index and L is physical path length in metres.
What unit does optical path length use?
The result uses metres because refractive index is dimensionless and the supplied physical path length is measured in metres.
Can I calculate several media at once?
Not in one call. Calculate each uniform segment separately and add the returned optical path lengths.
Does refractive index depend on wavelength?
It often does. Supply an index appropriate to the material, wavelength, temperature, and other conditions in your optical model.
Is the optical path always longer than the actual distance?
Only when the refractive index is above 1, as in most transparent materials. In vacuum the index is 1, so optical path and physical distance are equal.
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/optical-path-length \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"physical_path_length_m":0.25,"refractive_index":1.5}'const res = await fetch("https://api.kit.forhosting.com/optics/optical-path-length", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"physical_path_length_m": 0.25,
"refractive_index": 1.5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/optics/optical-path-length",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"physical_path_length_m": 0.25,
"refractive_index": 1.5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/optics/optical-path-length", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"physical_path_length_m":0.25,"refractive_index":1.5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"physical_path_length_m":0.25,"refractive_index":1.5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/optics/optical-path-length", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"physical_path_length_m": 0.25,
"refractive_index": 1.5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "optics.optical_path_length",
"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.
Limits
max_value | 1000000000000 |
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 to enter values and read the result
Values must be greater than zero and no input or computed result may exceed one trillion. Convert centimetres or millimetres to metres before calling: divide centimetres by 100 and millimetres by 1,000. For example, 5 millimetres is 0.005 metres. Do not attach unit text to a numeric string; send 0.005 rather than a string such as 5 mm. Provide physical_path_length_m as a positive finite number measured in metres and refractive_index as a positive finite dimensionless number. Text clients may send strict numeric strings, and common aliases such as distance_m, length_m, path_length_m, n, and index are accepted. The response returns optical_path_length_m, echoes normalized versions of both inputs, names the formula, identifies every unit, and lists three calculation steps. Those steps state the relation, substitute the supplied values, and show the multiplication result, which makes the response convenient for a worksheet or an automated audit trail. Missing fields, zero, negative values, malformed numeric strings, non-finite numbers, and excessive results return invalid_input rather than misleading output. Successful API requests cost $0.002 per item, while the browser calculation is free. Fixed decimal rounding keeps JSON output stable across repeated calls and helps expected values remain dependable in automated tests.
Integration use cases
Deterministic simulation fixtures
Generate stable expected optical path lengths for unit tests without material databases or network dependencies.
Technical questions
How much does the calculator cost?
The browser calculator is free. Each successful API request costs $0.002; invalid requests are not charged.