# Bragg’s law calculator: d-spacing from 2θ

> XRD d-spacing from 2θ and back. Bragg’s law nλ = 2d sin θ with Cu, Mo or Co Kα, and lattice parameters from (hkl) for cubic, tetragonal or hexagonal cells.

URL: https://www.labcanvas.com/tools/bragg-law-calculator

Bragg’s law, nλ = 2d sin θ, links the angle of an X-ray diffraction peak to the spacing d of the lattice planes that make it: d = nλ / (2 sin θ), where θ is half the 2θ peak position. A peak at 2θ = 28.44° with Cu Kα1 radiation (λ = 1.540562 Å) comes from planes d = 3.1357 Å apart. Choose the X-ray source, then convert 2θ to d, d to 2θ, or paste indexed reflections (2θ h k l) to get the lattice parameters of a cubic, tetragonal, hexagonal or orthorhombic cell by least squares.

## Quick answer

- **What it does:** Converts an XRD peak position 2θ to the d-spacing and back with Bragg’s law, and fits lattice parameters a, b, c from indexed reflections for cubic, tetragonal, hexagonal and orthorhombic cells.
- **Formula:** nλ = 2d sin θ;  d = nλ / (2 sin θ);  cubic 1/d² = (h² + k² + l²)/a²;  hexagonal 1/d² = 4(h² + hk + k²)/(3a²) + l²/c²
- **Example:** A peak at 2θ = 28.44° with Cu Kα1 (λ = 1.540562 Å): d = 1.540562 / (2 sin 14.22°) = 3.1357 Å. Five silicon reflections, (111) at 28.44° to (331) at 76.38°, give a = 5.4308 ± 0.0001 Å.

Free, in the browser, no account needed. Updated 2026-11-28.

## Features

- 2θ to d-spacing and d to 2θ for any order of diffraction n
- X-ray tube lines with their source: Cu Kα1, Cu Kα (mean), Mo Kα1, Mo Kα, Co Kα1, Co Kα, or any wavelength
- Lattice parameters from indexed reflections (2θ h k l) for cubic, tetragonal, hexagonal and orthorhombic cells
- Least squares on 1/d² with the standard error of each parameter, the cell volume and each peak’s 2θ residual
- Paste reflections from Excel or a peak list; copy the results as a table or a methods sentence; CSV download
- Warnings for impossible reflections (nλ/2d > 1) and peaks that do not fit the cell

## How to use it

1. **Choose what to calculate**: A d-spacing from a peak position, the peak position of a known spacing, or the lattice parameters from several indexed peaks.
2. **Choose the X-ray source**: Cu Kα1 if your instrument removes Kα2, the Kα mean if the doublet is not resolved, or type the wavelength in Å.
3. **Enter the peak or the reflections**: Type 2θ in degrees (or d in Å), or paste one reflection per line as “2θ h k l” and pick the crystal system.
4. **Read the answer**: d in Å and nm, 2θ in degrees, or a, b, c with their standard errors, the cell volume and the residual of every peak.

## At a glance

| | |
| --- | --- |
| Formula | \(n\lambda = 2d\sin\theta\); \(1/d^2\) from \((hkl)\) and the cell |
| Solves for | d from 2θ, 2θ from d, lattice parameters a, b, c from indexed peaks |
| Crystal systems | Cubic, tetragonal, hexagonal, orthorhombic |
| Wavelengths | Cu, Mo and Co Kα1 and Kα means (Bearden 1967), or any λ in Å |
| Fit | Least squares on 1/d², with standard errors and 2θ residuals |

## How it works

$$n\lambda = 2d\sin\theta \qquad d = \frac{n\lambda}{2\sin\theta}$$

**Bragg’s law.** X-rays scattered by parallel lattice planes a distance \(d\) apart add up in phase when the path difference between neighbouring planes, \(2d\sin\theta\), is a whole number \(n\) of wavelengths. A diffractometer records the angle between the incident and the diffracted beam, \(2\theta\), so \(\theta\) is half the peak position. Higher orders (\(n = 2, 3\)) are written in crystallography as first-order reflections from planes \(n\) times closer: the second order of (111) is the (222) reflection. Planes closer than \(\lambda/2\) cannot diffract at that wavelength, because \(\sin\theta\) would exceed 1.

**Plane spacing and the cell.** For a reflection with Miller indices \((hkl)\), the spacing depends on the cell parameters (Cullity & Stock, Appendix 3):

$$\begin{aligned} \text{cubic:}\quad \frac{1}{d^2} &= \frac{h^2+k^2+l^2}{a^2} \\ \text{tetragonal:}\quad \frac{1}{d^2} &= \frac{h^2+k^2}{a^2} + \frac{l^2}{c^2} \\ \text{hexagonal:}\quad \frac{1}{d^2} &= \frac{4}{3}\,\frac{h^2+hk+k^2}{a^2} + \frac{l^2}{c^2} \\ \text{orthorhombic:}\quad \frac{1}{d^2} &= \frac{h^2}{a^2} + \frac{k^2}{b^2} + \frac{l^2}{c^2} \end{aligned}$$

Each equation is linear in \(1/a^2\), \(1/b^2\) and \(1/c^2\), so the calculator turns every peak into \(1/d^2\) with Bragg’s law and fits those unknowns by ordinary least squares; \(a = (1/a^2)^{-1/2}\) and so on. With exactly as many reflections as parameters the cell passes through them; with more, the residuals give a standard error for each parameter, propagated as \(\sigma_a = \sigma_{x}/(2x^{3/2})\) with \(x = 1/a^2\). Rhombohedral, monoclinic and triclinic cells are not included.

**Wavelengths.** The tube lines are Bearden’s (1967) values, on his Å* scale, which Bearden gives for Cu Kα1 with an uncertainty of about 5 ppm, far below what a 2θ reading resolves. Kα is a doublet (Kα1 and Kα2, about 2:1 in intensity); when the two are not separated, the weighted mean \((2\lambda_{K\alpha1} + \lambda_{K\alpha2})/3\) is used, 1.541838 Å for copper.

**Accuracy.** d depends on \(1/\sin\theta\), so the same 2θ error matters less at high angle: high-angle peaks fix the cell best. A sample displaced from the focusing circle or a zero shift of the goniometer moves every peak; calibrate with an internal standard when you need the cell to better than about 0.01 Å. For crystallite size from the peak widths use the [XRD Scherrer calculator](https://www.labcanvas.com/tools/xrd-scherrer-calculator), and for size and strain together the [Williamson–Hall plot](https://www.labcanvas.com/tools/williamson-hall-plot).

## Worked examples: d-spacing, peak position and lattice parameters

- **2θ to d-spacing.** A peak at \(2\theta = 28.44^\circ\) measured with Cu Kα1 (\(\lambda = 1.540562\) Å): \(\theta = 14.22^\circ\), so \(d\) \({}= 1.540562 / (2 \times \sin 14.22^\circ)\) \({}= \mathbf{3.1357\ \text{Å}}\) (0.31357 nm). With the unresolved Cu Kα mean (1.541838 Å) the same peak gives 3.1383 Å: choose the wavelength your instrument used.
- **d to 2θ with another tube.** The same planes (\(d = 3.1357\) Å) appear at \(2\theta\) \({}= 2\arcsin(0.7093 / (2 \times 3.1357))\) \({}= \mathbf{12.988^\circ}\) with Mo Kα1 and at \(33.149^\circ\) with Co Kα1.
- **A cubic cell from one peak.** A face-centred cubic metal shows its (111) peak at \(2\theta = 38.47^\circ\) (Cu Kα1): \(d = 2.3381\) Å and \(a = d\sqrt{1^2+1^2+1^2} = \mathbf{4.0498\ \text{Å}}\).
- **A cubic cell from five peaks.** Silicon (diamond cubic) reflections read to 0.01° with Cu Kα1: (111) 28.44°, (220) 47.30°, (311) 56.12°, (400) 69.13° and (331) 76.38°. The least-squares fit gives \(a = \mathbf{5.4308 \pm 0.0001\ \text{Å}}\) and a cell volume of 160.17 Å³; every peak lies within 0.003° of where that cell puts it.
- **A hexagonal cell.** Five reflections of a wurtzite-type (ZnO-like) powder with Cu Kα1: (100) 31.77°, (002) 34.42°, (101) 36.25°, (102) 47.54°, (110) 56.60°. The fit gives \(a = \mathbf{3.2496 \pm 0.0001\ \text{Å}}\), \(c = \mathbf{5.2069 \pm 0.0003\ \text{Å}}\), \(c/a = 1.6023\) and \(V = \tfrac{\sqrt3}{2}a^2c = 47.617\ \text{Å}^3\). For a and c you need at least one peak with \(l \ne 0\) and one with \(h\) or \(k \ne 0\).


## X-ray wavelengths of common tube anodes

| Line | λ (Å) | Notes |
| --- | --- | --- |
| Cu Kα1 | 1.540562 | Copper anode, Kα2 removed (monochromator or stripping). |
| Cu Kα (Kα1/Kα2 mean) | 1.541838 | Copper anode, unresolved doublet: (2 × 1.540562 + 1.544390) / 3. |
| Mo Kα1 | 0.7093 | Molybdenum anode. |
| Mo Kα (Kα1/Kα2 mean) | 0.71073 | Molybdenum anode, unresolved doublet (the value usually quoted for Mo radiation). |
| Co Kα1 | 1.788965 | Cobalt anode (iron-rich samples fluoresce less than with Cu). |
| Co Kα (Kα1/Kα2 mean) | 1.79026 | Cobalt anode, unresolved doublet (Kα2 1.79285 Å). |

Cu Kα2 is 1.544390 Å. 1 Å = 0.1 nm. Bearden’s values are on his Å* scale, defined through the W Kα1 line; for diffraction work they are the ångström.

## References

- Bearden JA. X-ray wavelengths. *Rev Mod Phys* 1967;39:78–124. [doi:10.1103/RevModPhys.39.78](https://doi.org/10.1103/RevModPhys.39.78) (also issued as NSRDS-NBS 14).
- Cullity BD, Stock SR. *Elements of X-Ray Diffraction*, 3rd ed. Prentice Hall, 2001. Appendix 3: lattice geometry (plane spacings of each crystal system).


## Related calculators

- [XRD Scherrer & Bragg calculator](https://www.labcanvas.com/tools/xrd-scherrer-calculator): Crystallite size from XRD peak widths (Scherrer) and d-spacing from Bragg’s law.
- [Williamson–Hall plot calculator](https://www.labcanvas.com/tools/williamson-hall-plot): Crystallite size and microstrain from several XRD peaks by a Williamson–Hall plot, with 95% CIs.
- [Photon energy and wavelength converter](https://www.labcanvas.com/tools/photon-energy-wavelength-converter): Photon energy from wavelength and back: nm, eV, cm⁻¹, THz, J and kJ/mol, and photons per second from a power.
- [All 43 lab calculators](https://www.labcanvas.com/tools/lab-calculators)

## Use this calculator from code or an AI agent

This calculator also answers as JSON, computed by the same code as this page: no key, no account, CORS open. Send the parameters as a query string (numbers may carry units; lists comma-separated) or POST them as JSON to https://www.labcanvas.com/api/tools/bragg-law-calculator. An example, with the answer shortened to its first values:

```
GET https://www.labcanvas.com/api/tools/bragg-law-calculator?two_theta=28.44&source=cu1
```

```json
{
 "ok": true,
 "tool": "bragg-law-calculator",
 "inputs": {"two_theta":{"value":[28.44]},"source":{"value":"cu1"}},
 "result": {"d":{"label":"d-spacing","value":3.135738899,"unit":"Å"},"d_nm":{"label":"d-spacing","value":0.3135738899,"unit":"nm"}},
 "answer": "A peak at 2θ = 28.44° (Cu Kα1, λ = 1.540562 Å, n = 1) comes from planes d = 3.136 Å apart.",
 "formula": "d = nλ / (2 sin θ), θ = 2θ/2",
 "page": "https://www.labcanvas.com/tools/bragg-law-calculator",
 "citation": "LabCanvas Bragg’s law calculator, https://www.labcanvas.com/tools/bragg-law-calculator"
}
```

Parameters:

- `two_theta` (number[]): Peak positions 2θ in degrees: one for a d-spacing, several (with h, k, l) for lattice parameters.
- `d` (number, Å): A d-spacing (Å) to convert to 2θ, instead of two_theta.
- `source` (string, default cu1: cu1 | cu | mo1 | mo | co1 | co): X-ray line: cu1 = Cu Kα1 1.540562 Å; cu = Cu Kα (Kα1/Kα2 mean) 1.541838 Å; mo1 = Mo Kα1 0.7093 Å; mo = Mo Kα (Kα1/Kα2 mean) 0.71073 Å; co1 = Co Kα1 1.788965 Å; co = Co Kα (Kα1/Kα2 mean) 1.79026 Å (Bearden 1967).
- `wavelength` (number, Å): Any wavelength in Å; overrides source.
- `order` (integer, default 1): Order of diffraction n (1 for lattice parameters).
- `system` (string, default cubic: cubic | tetragonal | hexagonal | orthorhombic): Crystal system for lattice parameters (used when h, k and l are given).
- `h` (number[]): Miller index h of each reflection (same order as two_theta).
- `k` (number[]): Miller index k of each reflection.
- `l` (number[]): Miller index l of each reflection.

All calculators: https://www.labcanvas.com/api/tools · OpenAPI 3.1: https://www.labcanvas.com/api/tools/openapi.json · MCP tool: `calc_bragg_law` (LabCanvas MCP server).

## Questions

### How do I calculate d-spacing from 2θ?

Halve the peak position to get θ, then d = λ / (2 sin θ) for first order. With Cu Kα1 (1.540562 Å), a peak at 2θ = 28.44° gives d = 1.540562 / (2 × sin 14.22°) = 3.1357 Å.

### What is Bragg’s law?

nλ = 2d sin θ: X-rays reflected from parallel lattice planes a distance d apart interfere constructively when the extra path, 2d sin θ, is a whole number n of wavelengths. θ is half the 2θ angle a diffractometer reports.

### What wavelength should I use for Cu Kα?

1.540562 Å (Cu Kα1) if your diffractometer removes Kα2 with a monochromator or in software, and the weighted mean 1.541838 Å (often rounded to 1.5418 Å) if the Kα1/Kα2 doublet is not resolved. Many papers quote 1.5406 Å, Cu Kα1 rounded.

### How do I calculate the lattice parameter from XRD?

Index the peaks (assign hkl), convert each 2θ to d, then use the plane-spacing equation of the crystal system. For a cubic crystal a = d√(h² + k² + l²); for tetragonal and hexagonal crystals you need at least one reflection with l ≠ 0 and one with h or k ≠ 0. With several peaks, fit them by least squares, as this calculator does.

### How do I convert d-spacing to 2θ?

2θ = 2 arcsin(nλ / 2d). For d = 3.1357 Å with Cu Kα1, 2θ = 28.44°; with Mo Kα1 (0.7093 Å), 12.99°. If nλ/2d is above 1 there is no reflection at that wavelength.

### Is θ in Bragg’s law the same as 2θ on my XRD pattern?

No. The pattern’s x-axis is 2θ, the angle between the incident and diffracted beams; Bragg’s law uses θ, half of it. Using 2θ directly gives a d about half the true value.

### Why do my high-angle peaks give a better lattice parameter?

d = λ / (2 sin θ), so an error in 2θ changes d less where sin θ changes slowly relative to its value, at high angles. A 0.01° error at 2θ = 30° shifts d about three times more, relatively, than the same error at 2θ = 80°.

### Does this work for Mo or Co radiation?

Yes: choose Mo Kα1 (0.7093 Å), Mo Kα (0.71073 Å), Co Kα1 (1.788965 Å) or Co Kα (1.79026 Å), or type any wavelength, such as a synchrotron energy converted with the photon energy converter.
