Particle in a Box Calculator

Particle in a Box Calculator

Eₙ = n²h²/8mL² for a particle trapped between two walls, with the level spacing, the allowed wavelength and the photon that would lift it one level — and the diagram that shows why a confined wave can only have whole numbers of half-wavelengths, which is where quantisation comes from.

A particle trapped in a box of width L, in level n

n and L → Eₙ, the gap to the next level, and the wave that fits
Masses are CODATA 2022. Energy goes as 1/m, so a proton in the same box has 1/1836 of the electron’s energy — which is why electron confinement shows up in the colour of a quantum dot and nucleon confinement does not show up in chemistry at all.
In unified atomic mass units; 1 u = 1.66053906892×10⁻²⁷ kg and a carbon-12 atom is exactly 12 u by definition.
A whole number from 1 upwards. n = 1 is the ground state, and there is no n = 0: that would mean a wavefunction which is zero everywhere, which is no particle. The number of half-wavelengths inside the box is n, and the number of nodes strictly inside it is n − 1 — the diagram draws both for n up to 10.
In nanometres. 0.1 nm is roughly an atom, 1 nm a small quantum dot or a short conjugated molecule, 5 nm a colloidal dot of the kind used in displays. Energy goes as 1/L², so halving the box quadruples every level — which is the whole reason a smaller quantum dot glows bluer.
Left: the box, with the wavefunction for your own n drawn inside it and a dot on every node. Change n and the number of nodes changes with it, because the only waves allowed are the ones that reach zero at both walls — that is where quantisation comes from. Right: the first five levels at their true relative spacing, 1 : 4 : 9 : 16 : 25, with your level marked in red and the energies printed from your own box width and particle.
3.384271eVExample

An electron in a 1 nm box, in the n = 3 level

Advertisement

Three lines, and the boundary condition that does all the work

λn = 2L/n  ·  p = h/λ = nh/2L  ·  En = p²/2m = n²h²/8mL²  ·  En+1 − En = (2n+1)h²/8mL²  ·  h²/8me = 0.376 030 eV nm²
λ = 2L/n
the whole of the quantisation, in one step. The wave must be zero at both walls, so a whole number of half-wavelengths has to fit between them: L = nλ/2. This is the same condition as for a standing wave on a string fixed at both ends, and the two problems have identical mathematics
n
a positive whole number, 1, 2, 3 … There is no n = 0, because λ would be infinite and the wavefunction identically zero — not a particle at rest, but no particle at all. The lowest state therefore has energy, and that is forced rather than assumed
E ∝ 1/L²
squeeze the box and every level climbs as the inverse square. Halve L and all energies go up by four. This is the single most useful proportionality on the page: it is why a 2 nm quantum dot emits blue light where a 6 nm one of the same material emits red
E ∝ n²
levels get further apart as you go up, not closer, which is the opposite of the hydrogen atom. The gap from n to n+1 is (2n+1) times the ground-state energy, so it grows roughly linearly with n
h²/8mₑ
0.376 030 162 eV nm² for the electron, which turns the formula into a one-step calculation: En = 0.37603 n²/L² electronvolts with L in nanometres. For a proton the same constant is 2.0479×10−4 eV nm²
infinite walls
the assumption. The potential outside is taken to be infinite, so the wavefunction is exactly zero there and exactly zero at the walls. A real well is finite, the wavefunction leaks into the barrier, the effective box is slightly wider and every level comes out a little lower than this page says

Worked example

An electron in a 1 nm box, in the n = 3 level
THE WAVE THAT FITS. The wavefunction must vanish at both walls, so three half-wavelengths fit across the box: λ = 2L/n = 2 × 1/3 = 0.6667 nm. Count the nodes in the diagram and there are two strictly inside, plus the two at the walls. Nothing else about the box has been used yet.
THE MOMENTUM. de Broglie: p = h/λ = 6.62607015×10−34 ÷ 6.667×10−10 = 9.939×10−25 kg m/s, or 1859.76 eV/c. This is the only place quantum mechanics enters; the rest is arithmetic.
THE ENERGY. E = p²/2m = (9.939×10−25)² ÷ (2 × 9.1093837139×10−31) = 5.4222×10−19 J = 3.384 271 eV. The shortcut: E = 0.37603 n²/L² = 0.37603 × 9 ÷ 1 = 3.3843 eV. Same number, one line.
THE SPACING, which is what most questions want. E4 − E3 = 0.37603 × (16 − 9) = 2.632 211 eV. A photon of that energy has λ = 1239.84/2.6322 = 471.03 nm — blue, and visible. That is the entire principle behind a quantum dot: pick the box size, get the colour.
IS IT SAFE FROM THERMAL NOISE? kT at 300 K is 25.85 meV, and the level is 3.384 eV, which is 131 times larger. A room-temperature kick cannot move this electron between levels, so the state is well defined. Open the box to 10 nm and E1 drops to 3.76 meV, below kT, and the levels blur together.
WHAT CHANGES IF YOU ALTER THE BOX. Double L to 2 nm and E3 falls by four, to 0.846 eV. Swap the electron for a proton and it falls by 1836, to 1.84 meV. Go to n = 30 and it rises by (30/3)² = 100, to 338.4 eV. All three follow from the single formula and none of them needs it rederiving.
AND THE SANITY CHECK. At n = 3 in a 1 nm box the implied speed is 1.09×106 m/s, 0.36 per cent of c, so the non-relativistic E = p²/2m is fine. Put L = 0.001 nm into the page and the speed row goes above c, at which point the formula is not slightly wrong but the wrong formula. The page bands that case and says so.
Advertisement

An electron in a 1 nm box, every level from 1 to 6

nEₙEₙ/E₁gap to n+1λ = 2L/nnodes insidemomentum
10.376030 eV11.128090 eV2.0000 nm0619.92 eV/c
21.504121 eV41.880151 eV1.0000 nm11239.84 eV/c
33.384271 eV92.632211 eV0.6667 nm21859.76 eV/c
46.016483 eV163.384271 eV0.5000 nm32479.68 eV/c
59.400754 eV254.136332 eV0.4000 nm43099.61 eV/c
613.537086 eV364.888392 eV0.3333 nm53719.53 eV/c
Computed on this page’s own expressions. Read the fourth column, not the second: the GAPS grow as you climb, as (2n+1) times the ground state, so the spectrum of a box spreads out at high energy. Hydrogen does the opposite — its levels crowd towards the ionisation limit — and the reason is the shape of the potential, a flat bottom with vertical walls here against a −1/r funnel there. Noticing which way the levels go is often enough to tell you which system a question is about.

The ground state against the size of the box — why small dots glow blue

LSomething that sizeE₁ (electron)E₂ − E₁photon for that gapE₁ for a proton
0.1 nma hydrogen atom37.603016 eV112.809 eV10.99 nm (far UV)0.020479 eV
0.25 nmacross a benzene ring6.016483 eV18.0494 eV68.69 nm (far UV)0.003277 eV
0.5 nma short conjugated chain1.504121 eV4.51236 eV274.77 nm (UV)0.000819 eV
1 nma small quantum dot0.376030 eV1.12809 eV1099.06 nm (near IR)0.000205 eV
2 nma longer conjugated chain0.094008 eV0.282023 eV4396.25 nm (IR)5.12×10⁻⁵ eV
5 nma colloidal quantum dot0.015041 eV0.045124 eV27.48 µm (far IR)8.19×10⁻⁶ eV
10 nma semiconductor quantum well0.003760 eV0.011281 eV109.91 µm (far IR)2.05×10⁻⁶ eV
The 1/L² law in one column. Shrink the box by ten and every level rises by a hundred. The last column is the same calculation for a proton and is smaller by the mass ratio 1836 throughout, which is why nuclear confinement never competes with electronic confinement in chemistry. One honest caution on the first row: a one-dimensional box of atomic width is a caricature of a hydrogen atom, and 37.6 eV is not hydrogen’s 13.6 eV — it is the right order of magnitude from the wrong potential, and the agreement should not be oversold. Use the Bohr model page for the real thing.

Why trapping a wave quantises it, and where this model actually applies

The argument is about waves, not about energy. Nothing in the derivation starts from a quantisation rule. It starts from a boundary condition: the wavefunction must be zero at both walls, because the particle cannot be there. A sine wave that is zero at x = 0 and zero again at x = L must have a whole number of half-wavelengths in between, so λ can only be 2L, L, 2L/3, L/2 and so on. de Broglie then turns each allowed wavelength into an allowed momentum, p = h/λ, and p²/2m turns each allowed momentum into an allowed energy. The discreteness is forced by the geometry. Free the particle — take the walls away — and every wavelength is allowed again and the spectrum becomes continuous.

It is the standing-wave problem you already know. A guitar string fixed at both ends has exactly the same boundary condition and exactly the same allowed wavelengths, 2L/n. The difference is what you do with them: for the string, f = v/λ gives frequencies in the ratio 1 : 2 : 3; for the particle, E = h²/2mλ² gives energies in the ratio 1 : 4 : 9. Same wave, different relationship between wavelength and the quantity you care about. If you can draw the harmonics of a string you can draw the states of a box, and that is worth knowing the night before an exam.

Where this goes wrong. Four places. The commonest by far is the 8 in the denominator: E = n²h²/8mL² with h, and n²π²ħ²/2mL² with ħ, are the same formula, and mixing them gives an answer out by 4π² ≈ 39.5. The second is L in nanometres left unconverted, worth 1018 in the answer. The third is answering with En when the question asked for a transition: a photon carries the DIFFERENCE between two levels, never a level. The fourth is forgetting that n starts at 1, so the ground state is n = 1 and the first excited state is n = 2 — the first excited state is not n = 1.

And where the model is honestly useful. It is a caricature, and it earns its place anyway. The π electrons of a long conjugated molecule — a dye, a polyene — behave surprisingly like particles in a one-dimensional box a few nanometres long, and the predicted shift of colour with chain length is right. A semiconductor quantum dot is a three-dimensional version, and the 1/L² law is why a smaller dot emits bluer light; that is the physics inside a quantum-dot display. A nucleon in a nucleus is sometimes modelled this way for a first estimate. What the model is not good for is an atom: the potential there is a −1/r funnel, not a flat-bottomed box, and the levels come out crowding upwards instead of spreading out. A box gives 37.6 eV for an electron in 0.1 nm against hydrogen’s real 13.6 eV — the right order of magnitude and the wrong number, which is the fairest thing that can be said for it.

One deeper point worth taking away. The ground state has energy and cannot be talked out of it. E1 = h²/8mL² is never zero for a box of finite width, and that is the same statement as the uncertainty principle: confine something to Δx and you force a momentum spread, and a momentum spread means kinetic energy. Put Δx = L into that inequality and you get an energy of the same order as E1 here, from an argument that never mentions a wavefunction. Two routes, one answer, and the agreement is the reason to believe either.

Frequently asked questions

Why can’t the particle just sit still at the bottom of the box?

Because sitting still means p = 0 exactly, which means λ is infinite, which means no half-wavelength fits between the walls — the only wave that is zero at both walls and has infinite wavelength is zero everywhere, and that is not a particle. So the lowest state is n = 1, with λ = 2L, and it carries energy E1 = h²/8mL². This is the zero-point energy, and it is not a correction or an approximation: it is what the boundary condition forces. The same conclusion follows from the uncertainty principle without any wave mechanics at all.

Why does the energy go as n² and not n?

Because the momentum goes as n and the energy goes as the square of the momentum. λ = 2L/n, so p = h/λ = nh/2L is proportional to n — and E = p²/2m, so E is proportional to n². The contrast with a vibrating string is instructive: the string has the same allowed wavelengths, but its frequency is v/λ, which is proportional to n, giving the familiar harmonic series 1 : 2 : 3. Same wavelengths, different physics on top of them.

What happens at very large n?

Two things. The probability density |ψ|² has n peaks and, averaged over any small region, becomes nearly uniform — which is what a classical particle bouncing between two walls does, equally likely to be found anywhere. That is the correspondence principle at work. But the FRACTIONAL spacing of the levels, (En+1 − En)/En = (2n+1)/n², shrinks like 2/n, so the ladder looks continuous even though the absolute gaps are growing. Both statements are true at once and they are not in conflict: the steps get bigger and the staircase gets relatively smoother.

Does a real quantum well behave like this?

Close enough to be useful, not close enough to trust in the fourth figure. A real well has finite depth, so the wavefunction does not stop dead at the wall — it decays into the barrier. The particle is effectively in a slightly wider box, so every level is slightly LOWER than this page gives, and a shallow well holds only a few bound states instead of an infinite ladder. In a semiconductor you also have to use the effective mass of the electron in that material rather than the free-electron mass, which can change the answer by a factor of several. Use this page for the scaling and the order of magnitude, which it gets right, and a band-structure calculation for a real device.

Related calculators

References

  1. CODATA Internationally Recommended 2022 Values of the Fundamental Physical Constants, NIST Standard Reference Database 121. Read on 11 November 2026 from the machine-readable table at physics.nist.gov/cuu/Constants/Table/allascii.txt. Every constant on this page comes from that file. It marks h = 6.626 070 15×10−34 J Hz−1, c = 299 792 458 m/s and e = 1.602 176 634×10−19 C as (exact), because the 2019 SI defines the kilogram, the metre and the ampere through them; the masses are measured, the electron being 9.109 383 7139(28)×10−31 kg.
  2. Quantum Mechanics — Lecture notes for PHYS223, §4 (the infinite square well), Lancaster University; read 11 November 2026 at lancaster.ac.uk/people/schomeru/lecturenotes/Quantum Mechanics/S4.html. Verified from it: the boundary conditions are ψ(−L/2) = 0 and ψ(+L/2) = 0 because the wavefunction “has to vanish” at the walls; the allowed wavenumbers are kn = nπ/L with n a positive integer; and the eigenvalues are En = π²ħ²n²/2mL², which is algebraically the same as the n²h²/8mL² this page prints. The page does not name its author, so none is attributed. The node count and the wavelength form 2L/n are not stated there in those words and are derived here from the quoted kn.
  3. The International System of Units (SI), 9th edition, Bureau International des Poids et Mesures, 2019 (the copy read on 11 November 2026 is marked V4.01, June 2026). §2.2 fixes the numerical values of h, c and e, which is why those three carry no uncertainty here while every mass does. A school question that says “take h = 6.63×10−34 J s” is now rounding an exact number rather than quoting a measured one.
  4. NCERT, Physics, Textbook for Class XII, Part II — the syllabus most Indian readers of this page are working to. This could not be read for this build: the chapter PDFs at ncert.nic.in covering these topics refused automated retrieval, and every other copy a search returns is an unattributed mirror. Nothing here is attributed to NCERT, and where this page and a school table differ the difference is stated against sources that could be read — a weaker claim than “the textbook is wrong”, and deliberately the weaker one.