Bragg law interplanar spacing calculator
This Bragg law interplanar spacing calculator determines the separation between parallel crystal lattice planes from an experimentally measured Bragg angle, a known X-ray wavelength, and the diffraction order.
Run — free
It applies the standard relation n lambda equals 2 d sine theta and reports the resulting spacing in metres, nanometres, picometres, and ångströms. The calculation is deterministic and runs without external data, making it useful for checking diffraction measurements, teaching crystallography, and preparing repeatable laboratory workflows.
Enter the angle that Bragg law actually uses
The angle in the equation is the Bragg angle theta: the angle between the incident X-ray beam and the reflecting lattice plane. In many diffractometer outputs, the horizontal axis is labelled 2 theta because the instrument records the angle between the incident and diffracted beams. If your measured peak position is reported as 2 theta, divide that value by two before entering it as angle_deg. Confusing theta with 2 theta is one of the most common reasons for obtaining an incorrect interplanar spacing. The calculator accepts angles strictly between zero and ninety degrees. It evaluates the sine after converting degrees to radians internally, so the input remains familiar to laboratory users. Choose the peak position consistently, ideally after background subtraction and peak fitting when measurement precision matters. The result inherits uncertainty from the measured angle: at small angles, a modest angular error can noticeably alter the calculated spacing. This tool calculates the central value only and does not infer an uncertainty interval from instrument resolution or peak width.
Match the wavelength and diffraction order to the experiment
Enter the X-ray wavelength as a positive number and select its unit explicitly. Ångströms are common in crystallography, while nanometres, picometres, and metres are also supported. For example, Cu K-alpha radiation is often represented by a wavelength near 1.54 ångströms, but you should use the wavelength appropriate to the source, line selection, and calibration behind your measurement. The diffraction order n must be a positive integer. Most routine powder-diffraction indexing uses first-order reflections, so n equals one is usually the appropriate starting point. A higher order means that the path difference spans multiple wavelengths and therefore produces a proportionally larger calculated d value for the same wavelength and angle. Do not use the Miller indices as the diffraction order: an index such as (111) identifies a plane family, whereas n is the integer in Bragg's equation. The calculator keeps these concepts separate and limits the order to 100, which is ample for practical calculations while preventing accidental extreme input.
Interpret and verify the calculated plane spacing
The algorithm rearranges Bragg's law, n lambda equals 2 d sine theta, to obtain d equals n lambda divided by twice the sine of theta. It first converts the chosen wavelength unit to metres, performs the calculation, and then presents the same physical spacing in four units. Reporting multiple units makes the result easier to compare with crystallographic tables, simulation output, and software that may use different conventions. A numerical result alone does not identify the material or assign Miller indices. Compare the spacing with reference patterns only after considering phase composition, systematic absences, calibration, strain, and possible peak overlap. You can also check the calculation by substituting the returned d value into the original equation; both sides should agree to the displayed precision. The calculation assumes monochromatic radiation and the usual geometric form of Bragg's law. It does not correct for wavelength doublets, specimen displacement, refraction, instrumental zero shift, or uncertainty. For automated use, the API charges $0.002 per request; the browser calculation uses the same deterministic core logic.
What you can do with it
Check an X-ray diffraction peak
Convert a fitted peak angle and known source wavelength into a plane spacing for comparison with a reference diffraction pattern.
Teach Bragg law with unit-aware examples
Show how angle, wavelength, and diffraction order affect d while presenting the same answer in common crystallographic units.
Standardize laboratory calculations
Use a deterministic API calculation in notebooks or data pipelines instead of maintaining separate spreadsheet formulas.
FAQ
What equation does the calculator use?
It uses Bragg's law, n lambda = 2 d sin(theta), rearranged as d = n lambda / (2 sin(theta)).
Should I enter theta or 2 theta?
Enter theta. If the diffractometer reports a peak position as 2 theta, divide that reported angle by two first.
Which wavelength units are supported?
You can enter the wavelength in ångströms, nanometres, picometres, or metres by selecting the matching unit.
What diffraction order should I use?
Use the positive integer order associated with the reflection. First order, n = 1, is the usual choice for routine powder diffraction calculations.
Does the result identify the crystal or Miller indices?
No. It calculates d from the supplied measurement. Material identification and plane indexing require comparison with structural or reference diffraction data.
How much does the API calculation cost?
The API costs $0.002 per request. The calculation is also available in the browser using the same deterministic logic.
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/bragg-plane-spacing \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"angle_deg":20,"wavelength":1.5406,"wavelength_unit":"angstrom","diffraction_order":1}'const res = await fetch("https://api.kit.forhosting.com/optics/bragg-plane-spacing", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"angle_deg": 20,
"wavelength": 1.5406,
"wavelength_unit": "angstrom",
"diffraction_order": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/optics/bragg-plane-spacing",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"angle_deg": 20,
"wavelength": 1.5406,
"wavelength_unit": "angstrom",
"diffraction_order": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/optics/bragg-plane-spacing", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"angle_deg":20,"wavelength":1.5406,"wavelength_unit":"angstrom","diffraction_order":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"angle_deg":20,"wavelength":1.5406,"wavelength_unit":"angstrom","diffraction_order":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/optics/bragg-plane-spacing", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"angle_deg": 20,
"wavelength": 1.5406,
"wavelength_unit": "angstrom",
"diffraction_order": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "optics.bragg_plane_spacing",
"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_diffraction_order | 100 |
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. |