ForHosting KIT · Science

Angle of incidence calculator

A ray going from index 1 into glass of index 1.5 at 30° continues at 19.4712206345° from the normal. Enter the angle of incidence and both refractive indices to get the refraction angle, or a warning when total internal reflection occurs. 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
Incidence angle
30
N1
1
N2
1.5
You get
Incidence angle deg
30 degrees
Refraction angle deg
19.4712206345
Refraction angle rad
0.3398369095

The angle of incidence calculator answers the classic optics question in a single call: light strikes the boundary between two transparent media at a known angle, so at what angle does it continue on the other side?

How the refraction angle is computed

The calculation follows Snell's law, n1·sin(θ1) = n2·sin(θ2), rearranged as θ2 = arcsin((n1/n2)·sin(θ1)). The angle of incidence θ1 is measured from the normal — the imaginary line perpendicular to the surface — not from the surface itself, so 0 degrees means the ray arrives head-on and 90 degrees means it skims along the boundary. Both refractive indices must be positive numbers; vacuum is exactly 1, air is about 1.0003, water about 1.333, and common glasses sit between 1.5 and 1.6.

When the light moves into a denser medium (n2 greater than n1) the ray bends toward the normal and the returned angle is smaller than the incidence angle; when it moves into a rarer medium it bends away and the returned angle is larger. At exactly 0 degrees of incidence the refraction angle is always 0, whatever the two media are, because a ray arriving along the normal has no sideways component to bend.

The result is rounded to twelve significant digits so the same request produces byte-identical output on every machine, which matters when the response is stored, compared or hashed downstream.

Total internal reflection and the error case

When light travels from a denser medium into a rarer one (n1 greater than n2), there exists a critical angle θc = arcsin(n2/n1) beyond which the required value of sin(θ2) would exceed 1 — an impossibility, because no real angle has a sine above one. Physically, the ray stops crossing the boundary at all and reflects back inside, which is the principle behind optical fibers and the sparkle of a diamond.

A small numerical tolerance is applied at the boundary so that an incidence angle sitting exactly on the critical angle still resolves to a 90-degree refraction angle instead of flipping on floating-point noise.

Verify optics homework

Students check pencil-and-paper Snell's law exercises: enter the incidence angle and both media's indices and compare the computed refraction angle.

Estimate light entering glazing

Solar-panel and greenhouse planners compute how rays at a given sun angle refract into water or glass layers, and detect total internal reflection.

Which angle convention is used?

Angles are in degrees measured from the surface normal: 0 is head-on incidence, 90 is grazing. The refraction angle is returned in degrees, with a radians copy included.

Which refractive indices should I use?

Vacuum is exactly 1, air about 1.0003, water about 1.333, and common crown glass about 1.52. Both indices must be positive numbers.

What happens beyond the critical angle?

When light goes from a denser medium into a less dense one and the incidence angle passes the critical angle, no refracted ray exists: the light reflects back inside. The calculator tells you so instead of returning an impossible angle.

Does the ray bend toward or away from the normal?

Toward the normal when it enters a denser medium, so the refraction angle is smaller than the incidence angle. Entering a less dense medium, it bends away and the angle grows. At 0° it goes straight through.

At what angle does light continue into glass at 30°?

Coming from a medium of index 1 into glass of index 1.5, a ray at 30° continues at 19.4712206345° from the normal. Both angles are measured from the normal, not from the surface.

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/phys/angle-of-incidence

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/phys/angle-of-incidence \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"incidence_angle":30,"n1":1,"n2":1.5}'
{
  "incidence_angle": 30,
  "n1": 1,
  "n2": 1.5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "phys.angle_of_incidence",
  "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.

You provide the angle of incidence in degrees, measured from the surface normal, together with the refractive index of each medium, and the endpoint applies Snell's law to return the refraction angle in degrees. It accepts common aliases for every field, validates that both indices are positive and the angle lies between 0 and 90 degrees, and — instead of returning a silent NaN — reports a clear invalid_input error when the geometry is impossible because total internal reflection occurs.

Total internal reflection and the error case

There is one physically meaningful failure mode, and the endpoint treats it as a first-class result rather than a crash. In that situation the API rejects the request with an invalid_input error whose message states the offending incidence angle, the two indices, and the computed sine value, so a calling pipeline can catch the error code and switch its logic — for example by treating the ray as reflected — instead of trying to parse a numeric field that is not there.

Inputs, aliases and practical use

Typical integrations include lens and ray-tracing simulators that step a ray through several boundaries, educational tools that let students verify pencil-and-paper optics homework, photography and rendering pipelines that need physically plausible light paths, and solar-panel or greenhouse layout tools estimating how much light actually enters glazing at a given sun angle. The request takes three numeric fields: incidence_angle (or its aliases angle_incidence, theta1, incidence, i, angle_i, theta_i), n1 for the incident medium (aliases n_i, n_incident, incident_index, n1_index) and n2 for the transmitted medium (aliases n_t, n_refracted, transmitted_index, n2_index). Numbers may arrive as JSON numbers or numeric strings, which keeps the endpoint friendly to HTML forms and query parameters; booleans, arrays, NaN and Infinity are rejected. The response echoes the validated inputs and adds refraction_angle_deg, the same angle in radians, the formula applied, and the unit, so a client never has to guess conventions.

Step a ray through a lens simulator

Ray-tracing tools call the endpoint at each glass-air boundary, chaining the output angle into the next segment of the path.

What does it cost?

$0.002 per request. It is also free to run in your browser on this page.

What happens when total internal reflection occurs?

The request is rejected with an invalid_input error explaining that no refraction angle exists for those indices at that incidence angle.

Can I send the values as strings?

Yes. Numeric strings are accepted and coerced; non-numeric values, NaN and Infinity are rejected with invalid_input.

Read the full KIT documentation →