ForHosting KIT · Science

Relative refractive index calculator

With air at 1 and glass at 1.5, the relative index of glass to air is 1.5, so glass is the optically denser medium. Enter both indices; the calculator divides n₂ by n₁ and names the relation. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N1
1
N2
1.5
You get
Relative refractive index
1.5
Relation
medium_2_optically_denser

The relative refractive index describes the optical index of one medium compared with another, rather than compared with vacuum. Enter the absolute refractive index of the first medium as n1 and the absolute refractive index of the second medium as n2. The calculator divides n2 by n1 and reports whether medium two is optically denser, optically rarer, or equal to medium one. It is useful for checking interface calculations, preparing Snell's-law work, comparing optical materials, and producing stable results for lessons or software tests.

What relative refractive index means

An absolute refractive index compares the speed of light in vacuum with its speed in a material. A relative refractive index instead compares two media directly. For medium two measured with respect to medium one, the definition is n relative equals n2 divided by n1.

The order matters: exchanging the media changes the result to its reciprocal. If air is medium one with an index near one and glass is medium two with an index near one point five, the relative index is near one point five. If glass is medium one and air is medium two, the result is near two thirds.

A value greater than one means that medium two has the higher absolute refractive index and is optically denser under the usual terminology. A value below one means it has the lower index and is optically rarer. Exactly one means the indices match.

The ratio is dimensionless because both inputs are dimensionless. Use indices measured for compatible conditions, especially the same wavelength, because real materials can be dispersive and their indices may change with wavelength, temperature, composition, or pressure.

How to enter the two media and read the result

Provide n1 for the first, reference medium and n2 for the second medium whose index you want relative to the first. Both fields are required and must be finite numbers greater than zero. For example, n1 equal to one and n2 equal to one point five produces one point five.

With n1 equal to one point five and n2 equal to one, the result is approximately zero point six six seven. This capability performs only the direct n2 divided by n1 calculation. It does not infer an unknown absolute index, look up material data, calculate a refraction angle, or choose the direction of propagation for you.

Using the ratio in optics work and automated systems

The relative index is commonly used as an intermediate value in refraction and interface problems. It can help organize a Snell's-law calculation, compare a core with its cladding, check the direction in which a ray bends, or confirm that two implementations agree on the convention for medium order. Browser use is convenient for a quick classroom, laboratory, or design check.

The algorithm has no network call, material database, language model, randomness, or clock dependency. Therefore identical numeric inputs produce identical output. Remember that the ratio alone does not describe absorption, birefringence, dispersion, surface geometry, polarization, or multilayer behavior.

For a physically meaningful comparison, obtain both absolute indices from reliable data at the same relevant wavelength and environmental conditions, then preserve the intended first-to-second ordering when interpreting the result.

Check an optical interface

Compare the second medium with the first before using the ratio in a refraction or ray-bending calculation.

Prepare teaching examples

Generate repeatable ratios for air, water, glass, and other media while making the n2/n1 ordering explicit.

What does a relative refractive index greater than one mean?

It means medium two has a greater absolute refractive index than medium one and is optically denser in that comparison.

Can the relative refractive index be less than one?

Yes. A value below one means n2 is smaller than n1; this is valid and indicates that medium two is optically rarer.

Does the calculator use wavelength-dependent material data?

No. It uses only the two indices you provide. Supply values measured or specified at compatible wavelengths and conditions.

How do I find the relative refractive index of glass with respect to air?

Divide the index of the second medium by the index of the first. With air at 1 as the first medium and glass at 1.5 as the second, the result is 1.5.

What happens if I swap the two media?

The result turns into its reciprocal. Air to glass gives 1.5, while glass to air gives about two thirds, so decide which medium comes first before you calculate.

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.

POSThttps://api.kit.forhosting.com/optics/relative-refractive-index

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.

curl -X POST https://api.kit.forhosting.com/optics/relative-refractive-index \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n1":1,"n2":1.5}'
{
  "n1": 1,
  "n2": 1.5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "optics.relative_refractive_index",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How to enter the two media and read the result

The calculator validates those conditions before dividing, so missing values, text, zero, negative numbers, and non-finite values produce an invalid_input response instead of a misleading ratio. The output repeats the validated n1 and n2 values, gives relative_refractive_index, states the formula, and includes a machine-friendly relation. The relation is medium_2_optically_denser when the ratio is greater than one, medium_2_optically_rarer when it is less than one, and equal_refractive_indices when it equals one. Label the two media deliberately before sending the request.

Using the ratio in optics work and automated systems

Each successful API request costs $0.002; validation errors do not produce a calculated result.

Validate engineering software

Use deterministic JSON fixtures to confirm that an optics pipeline applies the same relative-index convention.

What is the formula for relative refractive index?

For medium two relative to medium one, the formula is n_relative = n2 / n1. Reversing the media gives the reciprocal.

How much does an API calculation cost?

Each successful API request costs $0.002. The browser calculator runs locally for free.

Read the full KIT documentation →