Braggs Law Calculator - n*lambda = 2 d sin(theta)
Use this Braggs law calculator to solve n*lambda = 2 d sin(theta) for wavelength, d spacing, angle, or order, with a 2 theta result for diffractometer work.
Braggs Law Calculator
Results
What Is the Braggs Law Calculator?
A Braggs law calculator solves the equation n*lambda = 2 d sin(theta) for X-ray, neutron, and electron diffraction problems, returning the wavelength, interplanar spacing, glancing angle, or diffraction order you need to interpret a diffraction pattern. Type three of the four variables and pick the one to solve; the calculator returns the missing value together with the measured 2 theta angle and the maximum integer order that geometry allows.
- • XRD pattern indexing: Plug a measured 2 theta peak into the calculator to back out the d spacing and match the reflection to a Miller index.
- • Cu K-alpha homework: Confirm that Cu K-alpha 1 at 154.06 pm hits the (200) plane of NaCl at about 15.87 degrees, giving a 2 theta peak near 31.73 degrees.
- • Neutron and electron diffraction: Use the same equation with electron wavelength from de Broglie or neutron wavelength from a monochromator to plan an experiment.
- • Picking a source wavelength: Given a known d spacing and a target angle, solve for the wavelength and pick the right anode material (Cu, Mo, Cr, Fe) for the diffractometer.
Bragg's law is the geometric condition for constructive interference from a family of parallel crystal planes. When an X-ray, neutron, or electron beam strikes a crystal, waves reflected from one plane travel a slightly different path than waves reflected from the plane below. If that extra path equals an integer number of wavelengths, the two reflections add in phase and produce a sharp peak. The integer is the diffraction order n, the wavelength is lambda, the spacing between adjacent planes is d, and the glancing angle between the incident beam and the planes is theta. Diffractometers measure 2 theta between the incident beam and the detector, never theta alone, and the calculator reports both so the result lines up directly with the 2 theta column in a diffractometer log file.
For the atomic-physics side of the same intro-physics toolkit, the Bohr Model Calculator handles hydrogen and hydrogen-like ion problems that often share a homework set with X-ray diffraction.
How the Braggs Law Calculator Works
The Braggs law calculator implements the Bragg condition n*lambda = 2 d sin(theta) as a pure function. The three variables you supply go in as numbers with their units attached, and the variable you select as the solve target is the output.
- n: Diffraction order, a positive integer counting how many whole wavelengths fit into the path difference.
- lambda (pm): Vacuum wavelength of the incident beam. Cu K-alpha 1 is 154.06 pm and Mo K-alpha 1 is 70.93 pm.
- d (pm): Interplanar spacing between adjacent planes of the same family.
- theta (degrees): Glancing angle between the incident beam and the crystal planes. The detector measures 2*theta.
The pure function reads the solve-for choice, validates the three input fields, and inverts the Bragg equation. When the solve target is the angle, it computes sin(theta) = n*lambda / (2 d) and takes the arcsine; when the target is the wavelength, it multiplies 2 d by sin(theta); when the target is the d spacing, it divides n*lambda by 2 sin(theta); and when the target is the order, it rounds 2 d sin(theta) / lambda to the nearest positive integer. If the requested order is too large for the wavelength and d spacing you have chosen, the function returns a NaN angle and the user interface flags the violation. For Cu K-alpha 1 on sodium chloride (200), the n_max is 3.
Sodium chloride (200) with copper K-alpha 1 X-rays
n = 1, lambda = 154.06 pm, d = 281.8 pm (NaCl has a lattice parameter a = 5.64 angstrom, and d_200 = a / 2 = 2.82 angstrom)
sin(theta) = (1 * 154.06) / (2 * 281.8) = 0.2734, so theta = arcsin(0.2734) = 15.87 degrees
theta = 15.87 degrees, 2 theta = 31.73 degrees, n_max = floor(2 * 281.8 / 154.06) = 3
Match a measured peak near 2 theta = 31.7 degrees to the (200) reflection and use d = 281.8 pm to back out the unit cell parameter.
Solving for wavelength from a known d spacing and angle
n = 1, d = 400 pm, theta = 14.4775 degrees (sin = 0.25)
lambda = 2 * d * sin(theta) = 2 * 400 * 0.25 = 200 pm
lambda = 200 pm, n_max = 4
A diffractometer with a 200 pm X-ray source sees a first-order peak at 2 theta = 28.96 degrees on any family of planes spaced 400 pm apart.
According to Wikipedia - Bragg's law, constructive interference from lattice planes occurs when the path difference 2 d sin(theta) equals an integer n times the wavelength lambda, giving the relation n lambda = 2 d sin(theta) that the calculator implements.
When the diffraction pattern is paired with atomic-emission spectroscopy, the Rydberg Equation Calculator covers the hydrogen-like line spectra that identify the elements in the sample.
Key Concepts Explained
Four ideas make the calculator predictable: the geometry of the path difference, the integer nature of the order, the 2 theta convention, and the lattice-parameter link that connects d to the Miller indices.
Path difference geometry
Reflection from the second lattice plane travels an extra 2 d sin(theta) compared with the first. This path difference is the only geometric quantity the Bragg condition depends on.
Integer diffraction order
The order n is a positive integer because the path difference has to equal an integer number of wavelengths. n_max = floor(2 d / lambda) sets the highest order that geometry allows.
Two theta convention
Diffractometers measure the angle between the incident beam and the diffracted beam, called 2 theta, rather than theta itself.
Miller index to d spacing link
For a cubic crystal with lattice parameter a, d = a / sqrt(h^2 + k^2 + l^2), where h, k, l are the Miller indices.
The interference condition is a special case of the general wave-superposition result that the Harmonic Wave Equation Calculator works through for any two coherent sources.
How to Use This Calculator
Run the calculator in any of its four solve modes in under a minute. Each step is real-time, so changing one input updates every result field immediately.
- 1 Choose the solve target: Open the Solve for dropdown and pick the variable to compute: angle theta, wavelength lambda, d spacing, or order n.
- 2 Enter the diffraction order: Type a positive integer for n. First order is the default because it gives the strongest peak; use 2 or higher for higher-order predictions.
- 3 Fill in the wavelength: Type the incident wavelength in picometers. The default is 154.06 pm, the Cu K-alpha 1 line. Pick 70.93 pm for Mo, 229.10 pm for Cr, or 193.74 pm for Co.
- 4 Add the interplanar spacing: Type d in pm. For a cubic crystal, compute it from a and the Miller indices with d = a / sqrt(h^2 + k^2 + l^2). The default is 281.8 pm, the (200) d spacing of NaCl.
- 5 Optionally enter the angle: Type theta in degrees only if your solve target is wavelength, d spacing, or order. Leave it at the default if the target is the angle itself.
- 6 Read the result and 2 theta: The primary output shows the value of the selected variable; the secondary rows show 2 theta, sin theta, and n_max. Press Reset to restore defaults.
Run the calculator in 'angle' mode with n = 1, lambda = 154.06 pm, and d = 281.8 pm. The result panel shows theta = 15.87 degrees, 2 theta = 31.73 degrees, sin theta = 0.2734, and n_max = 3.
When the same crystal is studied in a different mode, the Vibration Natural Frequency Calculator covers the resonance side of the same lattice-physics toolkit.
Benefits of Using This Calculator
A focused Braggs law calculator gives you faster, more reliable answers than rebuilding the formula.
- • Solves for any of the four variables: Switch the solve target between theta, lambda, d, and n with a single click. There is no need to keep four separate formulas in your head.
- • Reports 2 theta directly: Powder diffractometer software and most journal plots label the x axis 2 theta, so the calculator returns that value alongside the glancing angle theta.
- • Computes n_max automatically: Knowing the maximum integer order is the easiest way to spot over-estimated orders.
- • Works for X-ray, neutron, and electron diffraction: Plug any wavelength and any d spacing in pm and the same equation returns the correct angle, covering lab X-ray sources, synchrotron beams, neutron diffractometers, and TEMs.
- • Includes a worked Cu K-alpha example: The default values reproduce the textbook sodium chloride (200) first-order peak on copper K-alpha 1.
When the same X-ray data are used to estimate lattice energies or thermal Debye-Waller factors, the Boltzmann Factor Calculator handles the statistical-mechanics side of the calculation.
Factors That Affect Your Results
Three experimental factors control whether the calculator's output matches what a diffractometer records, and three physical limitations set the boundary of the Bragg condition.
Wavelength choice
Shorter wavelengths pack more diffraction orders into the same 2 theta range and resolve closely spaced planes. Copper K-alpha 1 at 154.06 pm is the standard laboratory choice; Mo K-alpha 1 at 70.93 pm gives more peaks for complex unit cells.
d spacing of the plane family
Larger d spacings push the first-order peak to a smaller 2 theta angle.
Order n
Higher orders give larger angles and weaker intensity, reaching the n_max = floor(2 d / lambda) ceiling quickly.
Index of refraction correction
For very accurate X-ray work, the real wavelength inside the crystal differs from the vacuum wavelength. The correction is a few parts per million and is usually ignored in a teaching calculator.
Crystal size and strain broadening
Bragg's law assumes an ideal infinite crystal lattice. Real samples with crystallite sizes below about 100 nm show peak broadening described by the Scherrer equation.
- • The Bragg condition is exact only for an infinite, perfect crystal lattice. Real samples with small grains, defects, or strain still place the peak at the predicted angle but with extra broadening and reduced intensity.
- • Bragg's law applies to elastic scattering only. Inelastic processes shift the diffracted beam to different energies and angles.
- • The glancing angle convention used here is measured from the crystal plane, not the surface normal. This differs from the Snell's law convention.
According to Nobel Prize 1915, the 1915 Nobel Prize in Physics was awarded jointly to William Henry Bragg and William Lawrence Bragg for their services in the analysis of crystal structure by means of X-rays, which is the practical workflow this calculator supports.
When the same experiment is extended to inelastic scattering or to lattice-dynamics measurements, the Work-Energy-Power Calculator covers the energy and power side of the same radiation-matter toolkit.
Frequently Asked Questions
Q: What does a Braggs law calculator compute?
A: It computes any one of the four variables in n*lambda = 2 d sin(theta) given the other three: the wavelength lambda, the interplanar spacing d, the glancing angle theta, or the diffraction order n. The result panel also reports the 2 theta value that powder diffractometers actually record, the sine of theta, and the maximum integer order allowed for the chosen wavelength and d spacing.
Q: What is the Bragg's law formula?
A: The formula is n*lambda = 2 d sin(theta), where n is a positive integer (the diffraction order), lambda is the wavelength of the incident X-ray, neutron, or electron beam, d is the spacing between adjacent crystal planes of the same family, and theta is the glancing angle between the incident beam and those planes. The detector measures 2 theta, so most plots label the x axis 2 theta rather than theta.
Q: What is the highest diffraction order for a given wavelength and d spacing?
A: The highest integer order is n_max = floor(2 d / lambda), which is the largest integer n for which n*lambda is less than or equal to 2 d. For Cu K-alpha 1 (154.06 pm) on NaCl (200) with d = 281.8 pm, n_max = floor(2 * 281.8 / 154.06) = 3, so only first, second, and third order peaks are ever observed on that family of planes.
Q: Does Bragg's law work for neutron and electron diffraction?
A: Yes. The same geometric condition applies to any wave whose wavelength is comparable to the spacing between atomic planes, which is roughly 50 to 500 pm. Neutron diffractometers use a monochromator to pick a wavelength from the Maxwell-Boltzmann distribution of the beam, and transmission electron microscopes use the de Broglie wavelength of electrons accelerated through a known voltage.
Q: What is the difference between theta and two theta in Bragg diffraction?
A: Theta is the glancing angle between the incident beam and the crystal planes, and it is the variable that appears in n*lambda = 2 d sin(theta). Two theta is the angle between the incident beam and the diffracted beam that reaches the detector, and it is equal to 2*theta. Powder diffractometer software and journal plots almost always label the x axis 2 theta, so the calculator reports both to keep the output consistent with how the data is recorded.
Q: How is the interplanar spacing d related to the Miller indices and lattice parameter?
A: For a cubic crystal with lattice parameter a and Miller indices h, k, l, the d spacing is d = a / sqrt(h^2 + k^2 + l^2). Hexagonal, tetragonal, and orthorhombic systems add geometric factors, but the Bragg condition itself only depends on the resulting d, not on the specific lattice symmetry. The Braggs law calculator treats d as a single input in pm so the same equation works for any crystal system.