Diffraction calculator
Light of 500 nm passing a 0.1 mm slit puts its first dark fringe a little more than a quarter of a degree off the axis. Enter the wavelength, the slit width in the same unit and the order to get that angle in degrees. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Wavelength
- 0.0000005
- Slit width
- 0.0001
- Order
- 1
- Angle degrees
- 0.2864800912
When monochromatic light passes through a narrow slit it does not stay on a single geometric ray. Wavefronts spread, and a distant screen shows a bright central band flanked by dark minima. The angular location of those minima is a closed-form arcsine: slit width times sine of the diffraction angle equals the integer order times the wavelength. This calculator accepts wavelength, slit width, and order number, then returns that angle in degrees. A non-positive slit width is rejected because the formula would divide by zero.
How the diffraction angle is computed from a, λ and m
Monochromatic light that meets a long, narrow opening does not stay confined to the geometric shadow of that opening. Each point across the aperture acts as a secondary source, and on a distant screen those sources interfere. Dark bands appear where the path difference across the slit is an integer number of wavelengths.
Solving for the unknown angle is a single inverse sine: theta equals arcsine of m lambda over a. This calculator evaluates that closed form and reports the angle in degrees, which is the unit most lab notebooks, exam keys, and instrument drawings still use. Wavelength and slit width must share one length unit so the ratio is dimensionless; metres for both, or nanometres for both, are equally valid as long as they match.
The order is an integer that labels which dark fringe you want, with positive and negative values placing minima on opposite sides of the optical axis and zero returning the undeviated forward direction. Because sine cannot exceed one in magnitude, only orders whose absolute m lambda over a stays at most one have a real angle; higher orders simply do not appear for that aperture. A zero or negative slit width is not a physical opening in this model and is rejected rather than producing a division by zero.
Where a diffraction-angle calculator earns its keep
Secondary-school and college optics courses assign far-field pattern problems that ask for the angle of the first dark fringe, the second minimum, or the half-width of the central peak derived from m equals one; a single trusted oracle that returns degrees speeds grading and demo setup. Teaching labs that measure laser wavelength from measured fringe angles need a forward calculator that matches the same a sine theta equals m lambda relation used in the experiment write-up, so students can check a predicted angle before they invert the formula for lambda.
Instrument sketches for entrance slits and monochromator envelopes estimate how wide a diffraction pattern will be at a design wavelength before a full wave-optics model is run. Failed validation does not consume balance. Keep requests in matching length units end to end, convert millimetre slits and nanometre wavelengths to one shared unit before calling, and pin the degree value in tests so homework checks, LMS plugins, and edge workers stay reproducible without standing up a wave-optics solver of your own.
Circular apertures, double-slit fringe spacing, and ruled diffraction gratings remain separate search intents; treat this page as the single-slit angular condition rather than a general interferometer.
What you can do with it
Homework and lab answer keys
Compute the diffraction angle of the m-th single-slit minimum from textbook slit width and wavelength so teachers and auto-graders share one ground truth in degrees.
Laser wavelength teaching labs
Forward-check measured dark-fringe angles against a·sin(θ)=m·λ for a known slit before solving for λ from the inverse experiment.
Slit and monochromator envelope estimates
Estimate how far the first few diffraction minima sit from the optical axis when sizing entrance slits at a design wavelength.
FAQ
What formula does this diffraction calculator use?
The single-slit condition a·sin(θ) = m·λ, so θ = arcsin(m·λ/a) reported in degrees. Wavelength and slit width must use the same length unit; m is an integer order.
What happens if the slit width is zero or negative?
Non-positive slit width would make the formula divide by zero, so it is rejected with a clear validation error and is not charged.
Do wavelength and slit width have to use the same unit?
Yes. The ratio m·λ/a must be dimensionless. Enter both lengths in metres, or both in nanometres; mixed units produce a wrong angle.
What if |m·λ/a| is greater than one?
There is no real diffraction angle for that order with the given aperture and wavelength.
What does the diffraction calculator cost?
The browser tool is free and runs locally.
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/phys/diffraction \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"wavelength":5e-7,"slit_width":0.0001,"order":1}'const res = await fetch("https://api.kit.forhosting.com/phys/diffraction", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"wavelength": 5e-7,
"slit_width": 0.0001,
"order": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/phys/diffraction",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"wavelength": 5e-7,
"slit_width": 0.0001,
"order": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/phys/diffraction", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"wavelength":5e-7,"slit_width":0.0001,"order":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"wavelength":5e-7,"slit_width":0.0001,"order":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/phys/diffraction", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"wavelength": 5e-7,
"slit_width": 0.0001,
"order": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "phys.diffraction",
"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.
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 the diffraction angle is computed from a, λ and m
The textbook statement of that condition is that the slit width multiplied by the sine of the diffraction angle equals the product of the order number and the wavelength: a times sine of theta equals m lambda. The implementation is pure floating-point arithmetic: no network, no random seeds, and no wall-clock timestamps, so the same three numbers always yield the same JSON object.
Input contract, response shape, and error behaviour
Wavelength must be strictly positive. Slit width must be strictly greater than zero: both a zero opening and a negative opening fail with a message that non-positive slit width is not allowed, matching the product promise that a one-over-a singularity never masquerades as a finite angle. Order must be an integer; a fractional order is not defined for this discrete-fringe condition. POST a JSON body with three required finite numbers: wavelength, the incident λ in any length unit; slit_width, the aperture width a in that same unit; and order, the integer m of the fringe you want. Each field may arrive as a JSON number or as a numeric string. Aliases lambda, wl and wave_length for the wavelength, a, width and slit for the aperture, and m or n for the order are accepted so notebooks written against textbook notation do not need a rename layer. Missing fields, empty strings, and non-finite values fail with invalid_input naming the field. When the absolute value of m lambda over a exceeds one, that order has no real angle and the request fails instead of returning a complex arcsine. On success the body echoes the cleaned wavelength, slit_width, and order, reports angle_degrees, and includes the formula string a sine theta equals m lambda for display next to a lab sketch. Pair the response with your own screen-distance multiplication if you next need a linear position y equals L tan theta; this endpoint returns the angle only and does not emit plots, intensity envelopes, or grating resolving power. Successful API calls are billed at the published $0.002 per item; validation failures do not consume prepaid balance.
Where a diffraction-angle calculator earns its keep
Because this capability is a pure parse engine, every successful call costs the published $0.002 base price with no model tokens and no outbound network.