ForHosting KIT · Developer Utilities

Grating wavelength from angle calculator

This grating wavelength from angle calculator finds the wavelength associated with a measured diffraction angle.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter the spacing between adjacent grating lines, the signed angle measured from the grating normal, and the signed nonzero diffraction order. The calculator rearranges the normal-incidence grating equation, d sin(theta) = m lambda, and returns wavelength in the same length unit used for spacing. It also shows the radian angle, sine value, formula, and substitution steps so the result can be checked or recorded.

Enter line spacing, angle, and order consistently

Begin with the physical spacing d between neighboring lines on the grating. You may enter metres, millimetres, micrometres, nanometres, or another length unit, because the calculation is scale-neutral: the returned wavelength uses exactly the same unit as the spacing. Do not enter a groove density directly. If a grating is specified in lines per millimetre, first take the reciprocal to obtain millimetres per line. Next enter the diffraction angle in degrees, measured from the normal to the grating rather than from its surface. The angle is signed, as is the diffraction order. A positive angle belongs with a positive order and a negative angle with a negative order. Their matching signs make the calculated wavelength positive. The order must be a nonzero integer because the zero-order beam is not wavelength-separated and therefore cannot determine wavelength through this rearrangement. These conventions assume normal incidence, meaning the incoming beam follows the grating normal. If the source arrives obliquely, use the generalized grating equation instead of treating its incidence angle as zero.

Understand the rearranged grating equation

For normal incidence, a transmission or reflection grating is described by d sin(theta) = m lambda, where d is line spacing, theta is the diffraction angle, m is the integer order, and lambda is wavelength. Solving for the requested quantity gives lambda = d sin(theta) / m. The calculator converts the supplied degree angle to radians before evaluating the sine, then multiplies that dimensionless sine by the spacing and divides by the order. Because sine carries no unit and order is a pure integer, wavelength inherits the spacing unit. This unit behavior is useful for quick laboratory work: a spacing entered in micrometres produces a wavelength in micrometres without an extra conversion. The signs encode which side of the grating normal contains a diffracted order. Negative angle with negative order gives the same positive wavelength as the corresponding positive pair. An angle of zero cannot yield a positive wavelength for a nonzero order, so it is rejected. Angles are restricted to the physical principal range from minus ninety through plus ninety degrees.

Check assumptions and interpret the result

Use the returned steps to verify both the numerical substitution and the experimental assumptions. First confirm that the reported sine has the expected magnitude and sign. Then check that the wavelength scale makes sense relative to the spacing: since the absolute sine cannot exceed one, the wavelength cannot exceed d divided by the absolute order under this model. A result near that upper bound corresponds to diffraction near grazing angle, where small angular measurement errors can strongly affect inferred wavelength. The calculation describes ideal geometric diffraction and does not estimate intensity, resolving power, blaze efficiency, polarization response, finite slit width, or uncertainty. It also does not decide whether a detector can observe the resulting wavelength. For measured data, retain the angle convention, grating specification, order assignment, and spacing unit alongside the answer. If you know groove density rather than spacing, document the reciprocal conversion. If the incident beam is not normal to the grating, if the medium has a relevant refractive index, or if the optical arrangement uses a different sign convention, adapt the governing equation before relying on this result.

Identify a spectral line

Convert a measured detector angle into a candidate wavelength for a known grating spacing and diffraction order.

Check a spectrometer setup

Confirm that an expected wavelength should appear at the observed signed angle in the selected order.

Analyze a teaching experiment

Show the rearrangement and substitution used to infer wavelength from diffraction measurements.

Which grating equation does this calculator use?

It uses d sin(theta) = m lambda for normal incidence and rearranges it to lambda = d sin(theta) / m.

What unit is the wavelength returned in?

The wavelength is returned in the same length unit as the spacing. If spacing is in micrometres, wavelength is in micrometres.

Can I enter lines per millimetre as spacing?

No. Convert groove density to line spacing first by taking its reciprocal; lines per millimetre becomes millimetres per line.

Why must angle and order have matching signs?

Their signs identify the side of the normal. Matching nonzero signs make d sin(theta) divided by m a positive physical wavelength.

What does an API request cost?

The API price is $0.002 per request. The same deterministic calculation is also available in the browser.

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/grating-wavelength-from-angle

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/grating-wavelength-from-angle \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spacing":0.001,"angle_deg":30,"order":1}'
{
  "spacing": 0.001,
  "angle_deg": 30,
  "order": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "optics.grating_wavelength_from_angle",
  "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.

Read the full KIT documentation →