A particle in a box is the simplest system the Schrodinger equation can be solved exactly for: one particle trapped between two walls it has no chance of crossing. Its energies are not continuous but come in a ladder, E = n²h² / 8mL². This free calculator solves that relation three ways — for the energy, for the box width, or for the level number — and shows every step.
Trap a particle between two walls it cannot pass and its wave function has to vanish at both of them. Only waves that fit a whole number of half-wavelengths in the gap survive that condition, which means only certain wavelengths are allowed, which — because momentum and wavelength are tied together — means only certain energies are allowed. Running that argument through gives E = n²h² / (8mL²), where n is the level number, L is the width of the box, m is the mass of the trapped particle and h is the Planck constant. The full derivation, starting from the equation itself rather than from the standing-wave shortcut, is set out in the guide to the Schrodinger equation.
There are three things you might be missing, and the Solve for menu covers all three. Pick Energy of the level when you know the box, the particle and which level you want. Pick Box length when you know an energy and want the width that would produce it — the working rearranges to L = nh / sqrt(8mE). Pick Quantum number when you have measured an energy and want to know which level it is; that solves n = (L/h) · sqrt(8mE), rounds to the nearest whole number, and tells you plainly whether the energy you entered actually is an allowed level of that box or falls between two of them.
Two habits prevent almost every wrong answer here. Enter L as the full wall-to-wall width, never a radius: L is squared, so a factor of two in the width is a factor of four in every energy. And remember that n counts from 1, not 0 — the ground state is n = 1 and it has a non-zero energy, which is not a quirk of the arithmetic but the physical content of the result. The wavelength that has to fit inside is exactly the de Broglie wavelength of the trapped particle, 2L/n, and the de Broglie wavelength calculator works the same relation from the momentum side.
Put an electron in a box 0.50 nm wide, roughly the span of a small molecule. The ground state is E = 1² × (6.62607015×10-34)² / (8 × 9.109×10-31 × (5.0×10-10)²) = 2.410×10-19 J, which is 1.504 eV. The second level is four times that, 6.016 eV, so the gap between them is 4.512 eV and an electron falling from n = 2 to n = 1 emits a 274.8 nm photon — ultraviolet, just outside what the eye can see.
Every figure in the table below came out of this page's own solver rather than off a separate calculator, so if the table and the tool ever disagree, the tool is right.
| Case | Level | Box width | Particle | Energy | In electronvolts | Gap to the level below | Photon emitted |
|---|---|---|---|---|---|---|---|
| Ground state of a 0.50 nm electron box | 1 | 0.50 nm | electron | 2.410e-19 J | 1.504 eV | no lower level | nothing to emit |
| Same box, first excited state | 2 | 0.50 nm | electron | 9.639e-19 J | 6.016 eV | 4.512 eV | 274.8 nm |
| Same box, second excited state | 3 | 0.50 nm | electron | 2.169e-18 J | 13.54 eV | 7.521 eV | 164.9 nm |
| Halve the box to 0.25 nm, back to n = 1 | 1 | 0.25 nm | electron | 9.639e-19 J | 6.016 eV | no lower level | nothing to emit |
| Widen it to 1.00 nm, back to n = 1 | 1 | 1.00 nm | electron | 6.025e-20 J | 0.376 eV | no lower level | nothing to emit |
| A proton in the original 0.50 nm box | 1 | 0.50 nm | proton | 1.312e-22 J | 0.0008192 eV | no lower level | nothing to emit |
| An electron in a 10 nm quantum dot | 1 | 10.0 nm | electron | 6.025e-22 J | 0.00376 eV | no lower level | nothing to emit |
Rows two and four are the pair worth staring at. Doubling n and halving L land on the same energy, 6.016 eV, because n appears squared on the top and L appears squared on the bottom. Row six is the mass term doing its work: swapping the electron for a proton in an unchanged box drops the ground state by a factor of 1836, from 1.504 eV to 0.00082 eV, which is why the quantised energies of heavy particles almost never matter at everyday scales.
| Symbol | Meaning | SI unit | Typical range |
|---|---|---|---|
| E | Energy of the level the particle occupies | joule (J) | 1e-29 J to 1e-12 J over the supported band |
| n | Quantum number: which level, counting from 1 | none (a pure count) | 1 to 100 |
| L | Width of the box, wall to wall | metre (m) | 0.01 nm to 1000 nm |
| m | Mass of the trapped particle | kilogram (kg) | 9.109e-31 kg (electron) to 1.675e-27 kg (neutron) |
| h | Planck constant, fixed by definition | joule second (J s) | 6.62607015e-34 exactly |
This is the calculation that makes quantisation concrete. Nothing about the box is exotic — two walls and a particle — and yet the energies that come out are a discrete ladder rather than a continuum, purely because a wave has to fit. The spacing between rungs grows as you climb: the gap from n to n minus 1 is (2n−1)h² / 8mL², so the jumps go 3, 5, 7 and 9 ground-state units rather than staying equal. That is the opposite of what a real atom does, and comparing the two is the fastest way to see that the level pattern comes from the shape of the trap, not from quantum mechanics in the abstract.
The ground state is the other lesson. It cannot be zero, and the reason is the uncertainty principle: pinning a particle inside a width L forces a momentum spread of order h-bar over L, and a spread in momentum is kinetic energy that cannot be removed. Squeeze the box and that irreducible energy rises as 1 over L squared. The uncertainty principle calculator quantifies the same floor from the momentum side and lands on the same order of magnitude. If you would rather see the levels and the wave function move than read about them, the Schrodinger equation simulator draws the ladder to true n-squared scale while you drag L and n.
The walls in this model are infinitely high, which no real wall is. In a genuine quantum well the barrier has a finite height, so the wave function leaks a little way into it rather than stopping dead. The practical consequence is that a real level sits slightly lower than this calculator predicts, because the particle is effectively confined in a box a little wider than the one you measured. The discrepancy is small for deep wells and low levels and grows for shallow wells and high ones; near the top of a finite well the ladder stops entirely, because states above the barrier are not bound at all.
Three further idealisations are worth naming. The box is one-dimensional: a real dot confines in three directions, and its levels are sums of three independent terms, so the tidy 1, 4, 9 pattern is replaced by a denser set with repeats. The bottom is flat: an electron in a molecule feels the individual nuclei, not a uniform floor. And there is only one particle, so nothing here accounts for the electrons repelling one another, which in a many-electron dot shifts the levels appreciably. Treat the numbers as the right order of magnitude and the right scaling — as n squared, as 1 over L squared, as 1 over m — rather than as spectroscopic predictions.
Quantum dots are the clearest case. A CdSe dot a few nanometres across emits at a colour set by its size, and the size dependence is the 1 over L squared of this formula: grow the dot and the emission shifts red, shrink it and it shifts blue. That is the mechanism behind quantum-dot displays, and behind the fluorescent dots used to tag biological samples. Semiconductor lasers use the same physics deliberately, with a thin layer of one material sandwiched in another to make a quantum well whose confinement energy sets the lasing wavelength.
Chemistry uses the box as a back-of-envelope model for conjugated molecules, where electrons are delocalised along a chain of carbon atoms. Treat the chain as a box of length L, fill the levels two electrons at a time, and the gap between the highest filled and lowest empty level predicts roughly where the molecule absorbs — which is why longer conjugated dyes are redder. It gets the trend right and the exact numbers wrong, which is a fair summary of what this model is for.
Whichever of the five the menu offers — nanometres, picometres, angstroms, micrometres or metres — because the calculator converts to metres before it does any arithmetic. Nanometres suit almost every real case: a small molecule is a fraction of one, a quantum dot is a few, a carbon nanotube segment is tens. If you are working from a chemistry text that quotes angstroms, use them directly rather than converting by hand; 1 angstrom is 0.1 nm. What matters far more than the unit is that the number is the full wall-to-wall width, not a radius or a half-width, because L is squared and a factor of two in the width becomes a factor of four in every energy.
Because L sits underneath the division and is squared, so energy is proportional to 1 over L squared. Halving the width therefore multiplies every level by four, and cutting it to a tenth multiplies them by a hundred. You can watch it in the table above: an electron in a 0.50 nm box has a 1.504 eV ground state, and squeezing that box to 0.25 nm raises the ground state to 6.016 eV — which is exactly the energy the n = 2 level had in the wider box. This steepness is the whole reason quantum confinement is a useful engineering knob: changing the size of a quantum dot by a few atoms visibly changes the colour it emits.
Because n = 0 would make the wave function zero everywhere, and a particle whose probability of being found anywhere is zero is not a particle that exists. The wave has to fit a whole number of half-wavelengths between the walls and still be non-zero somewhere in between, and the smallest such fit is one half-wave, n = 1. That is why the lowest energy is not zero either: it is h squared over 8mL squared, and the only way to reduce it is to make the box wider. The calculator rejects a value that rounds to zero rather than returning an energy of zero, because zero energy is not an answer this system has.
Take the energy difference and convert it. The calculator does both steps for you: solve for the energy at your chosen n and the extras list the gap down to n minus 1 in electronvolts and the wavelength that gap corresponds to. The conversion is wavelength in nanometres equals 1239.842 divided by the energy in electronvolts. For the 0.50 nm electron box, dropping from n = 2 to n = 1 releases 4.512 eV, which is 274.8 nm — ultraviolet. If you want a gap that is not to the level immediately below, compute both levels separately and subtract, then divide 1239.842 by the difference.
Not directly, and it is worth being clear about why. A real atom traps its electron in a Coulomb potential that deepens toward the nucleus rather than in a flat box with vertical walls, so its levels go as minus 1 over n squared and crowd together as n rises, rather than spreading out as n squared the way they do here. For hydrogen and other one-electron ions use the Bohr model calculator instead. What the box does model well is a particle confined by an engineered structure rather than by a nucleus: a quantum dot, a quantum well in a semiconductor laser, an electron delocalised along a conjugated molecule. For those the flat-bottomed box is a genuinely good first approximation.