Refractive index calculator
Light moving at two-thirds of its vacuum speed gives a refractive index of 1.5. Enter either the medium speed or the index and get the other, with c set to 299792458 m/s unless you change it. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Speed
- 199,861,638.66666666
- Refractive index
- 1.5
- C
- 299,792,458
- Calculation mode
- speed_to_index
- Precision
- 10
This refractive index calculator converts the phase speed of light in a medium into the absolute refractive index, or the reverse, using the defining relation n equals c over v. Absolute index compares the vacuum speed of light c to the phase speed v inside glass, water, plastic, or air, and is the starting number for Snell's law, optical path length, and many thin-film and fiber formulas. The identities are fully deterministic: n equals c divided by v, and v equals c divided by n, with a default vacuum speed of two hundred ninety-nine million seven hundred ninety-two thousand four hundred fifty-eight meters per second, the SI exact value. Classic checks include a medium at two-thirds of c yielding n equals one point five, and n equals one point three three three recovering a water-like speed near two point two five times ten to the eight meters per second. The engine uses only finite arithmetic with no network calls, no sampling, and no date-dependent shortcuts.
Where refractive-index checks fit in study, labs, and software
Students meet this conversion when a lab measures speed or optical path and asks for n, when a homework set gives the speed of light in glass and wants the index, or when a contest problem states n and expects the phase speed without a full wave chapter. Teachers can pre-generate answer keys for modest speeds and indexes without trusting opaque calculator apps that silently switch units or round c inconsistently.
Developers call the same contract from scripts to seed deterministic test vectors for optics widgets, to normalize user-entered medium speed before a classroom demo, or to satisfy programming-challenge statements that demand n rather than a hand-waved material label. Contest practice often needs a fast, offline source of refractive indexes so solutions can be checked without programmable calculators under time pressure.
Product and education tools use the solve when a learner types a medium speed or an index and the UI must show the matching partner quantity with a clear mode tag.
What you can do with it
Homework and lab checks
Convert measured or textbook medium speeds into absolute n, or recover v from a known refractive index before Snell's law.
Tutoring and optics widgets
Normalize user-entered speed or n for interactive lessons, material demos, and quick c/v quizzes.
FAQ
What does the refractive index calculator cost?
It is free in your browser on this page.
How is refractive index defined here?
Absolute refractive index n = c/v, where c is the vacuum speed of light and v is the phase speed in the medium. Equivalently v = c/n.
What happens if speed is zero or negative?
Non-positive medium speed makes n = c/v undefined or non-physical for this calculator.
What vacuum speed c is used by default?
The SI exact value 299792458 m/s. You may override c when a problem uses a rounded constant such as 3e8.
How do I get the speed of light in a medium from its refractive index?
Enter the index instead of the speed and the calculator divides c by n. With an index of 1.5, light moves at two-thirds of its vacuum speed.
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/refractive-index \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"speed":199861638.66666666,"v":1}'const res = await fetch("https://api.kit.forhosting.com/optics/refractive-index", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"speed": 199861638.66666666,
"v": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/optics/refractive-index",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"speed": 199861638.66666666,
"v": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/optics/refractive-index", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"speed":199861638.66666666,"v":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"speed":199861638.66666666,"v":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/optics/refractive-index", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"speed": 199861638.66666666,
"v": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "optics.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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs_value | 1000000000000000 |
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
What the refractive-index solve returns and how to read the fields
The absolute refractive index of a homogeneous isotropic medium is defined by n equals c over v, where c is the speed of light in vacuum and v is the phase speed of a monochromatic plane wave in that medium. Values greater than one mean light travels slower than in vacuum; vacuum itself has n equals one when v equals c; exotic metamaterial contexts can discuss n below one, but this calculator still requires positive finite inputs so the quotient stays defined. Solving for speed is just the reciprocal form v equals c over n. This calculator returns the speed and refractive_index pair after the solve, the vacuum speed c used (defaulting to the SI exact constant when you omit it), a mode tag of speed_to_index or index_to_speed so callers know which direction ran, the precision used, a short formula string, and the method tag refractive_index. There is no material database lookup, no wavelength-dependent dispersion model, and no random sampling of samples: the engine either builds an exact floating-point quotient inside the supported magnitude range or rejects the input with invalid_input. Rejected cases include missing both speed and index, providing both at once, non-finite values, magnitudes above the documented ceiling, and any non-positive speed, index, or vacuum c, because a zero or negative medium speed makes n equals c over v undefined or non-physical for this absolute definition.
How speed, index, and vacuum c are read and stay reproducible
Optional leading plus signs and scientific notation on numeric strings are allowed when they parse as finite decimals; embedded spaces, hex prefixes, and non-numeric tokens are rejected with a clear message so a bad cell does not become a wrong index. The preferred fields are speed for the medium phase velocity and refractive_index for n, but aliases v, velocity, medium_speed, and speed_of_light for the medium speed, and n, index, and n_medium for the refractive index, are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. Provide exactly one of those two quantities: speed alone drives n equals c over v, while refractive_index alone drives v equals c over n; sending both is rejected so the engine never silently prefers one side of a conflicting pair. Optional vacuum speed c, with aliases c0, vacuum_speed, and speed_vacuum, defaults to two hundred ninety-nine million seven hundred ninety-two thousand four hundred fifty-eight meters per second when omitted, matching the SI definition; override it only when a textbook problem uses a rounded c such as three times ten to the eight. Non-positive speed is never valid: if speed is at or below a tiny epsilon, the request fails with invalid_input because the refractive index is undefined or non-physical. The same positive check applies to refractive_index and to c. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for the numeric fields, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the quotient yourself.
Where refractive-index checks fit in study, labs, and software
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with focal-length and thin-lens tools and other math and science endpoints when you are building a small lab of free, deterministic helpers for geometry, algebra, and introductory physics optics.
Integration use cases
Deterministic test fixtures
Generate reproducible refractive_index and speed pairs for unit tests, property checks, and CI assertions.
Technical questions
Can I send both speed and refractive_index?
No. Provide exactly one: speed alone computes n, or refractive_index alone computes speed. Sending both returns invalid_input.